-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,19 @@ | |
*/ | ||
import net.ltgt.gradle.errorprone.CheckSeverity | ||
import net.ltgt.gradle.errorprone.errorprone | ||
import cl.franciscosolis.sonatypecentralupload.SonatypeCentralUploadTask | ||
|
||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
`jacoco` | ||
alias(libs.plugins.errorprone) | ||
alias(libs.plugins.spotless) | ||
id("cl.franciscosolis.sonatype-central-upload") version "1.0.2" | ||
} | ||
|
||
group = "com.github.wreulicke.errorprone.logstash" | ||
group = "io.github.wreulicke.errorprone.logstash" | ||
version = "0.0.1" | ||
|
||
repositories { | ||
mavenCentral() | ||
|
@@ -40,6 +43,8 @@ java { | |
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(17)) | ||
} | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
|
||
|
@@ -109,4 +114,65 @@ spotless { | |
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
register<MavenPublication>("maven") { | ||
pom { | ||
name.set(project.name) | ||
description.set("Custom Errorprone check for logstash-logback-encoder") | ||
url.set("https://github.com/wreulicke/errorprone-logstash-logback-encoder") | ||
|
||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://github.com/wreulicke/errorprone-logstash-logback-encoder/blob/master/LICENSE") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("wreulicke") | ||
name.set("wreulicke") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:[email protected]:wreulicke/errorprone-logstash-logback-encoder.git") | ||
developerConnection.set("scm:git:[email protected]:wreulicke/errorprone-logstash-logback-encoder.git") | ||
url.set("https://github.com/wreulicke/errorprone-logstash-logback-encoder") | ||
} | ||
issueManagement { | ||
system.set("GitHub Issues") | ||
url.set("https://github.com/wreulicke/errorprone-logstash-logback-encoder/issues") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.named<SonatypeCentralUploadTask>("sonatypeCentralUpload") { | ||
// 公開するファイルを生成するタスクに依存する。 | ||
dependsOn("jar", "sourcesJar", "javadocJar", "generatePomFileForMavenPublication") | ||
|
||
// Central Portalで生成したトークンを指定する。 | ||
username = System.getenv("SONATYPE_CENTRAL_USERNAME") | ||
password = System.getenv("SONATYPE_CENTRAL_PASSWORD") | ||
|
||
// タスク名から成果物を取得する。 | ||
archives = files( | ||
tasks.named("jar"), | ||
tasks.named("sourcesJar"), | ||
tasks.named("javadocJar"), | ||
) | ||
// POMファイルをタスクの成果物から取得する。 | ||
pom = file( | ||
tasks.named("generatePomFileForMavenPublication").get().outputs.files.single() | ||
) | ||
|
||
// PGPの秘密鍵を指定する。 | ||
signingKey = System.getenv("PGP_SIGNING_KEY") | ||
// PGPの秘密鍵のパスフレーズを指定する。 | ||
signingKeyPassphrase = System.getenv("PGP_SIGNING_KEY_PASSPHRASE") | ||
} | ||
|
||
defaultTasks("spotlessApply", "build") |