Skip to content

Commit

Permalink
add setup
Browse files Browse the repository at this point in the history
  • Loading branch information
wreulicke committed May 31, 2024
1 parent 7c5b54b commit 309a771
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -40,6 +43,8 @@ java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
withSourcesJar()
withJavadocJar()
}


Expand Down Expand Up @@ -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")

0 comments on commit 309a771

Please sign in to comment.