Skip to content

Commit 5f62bea

Browse files
committed
Update buildscript
1 parent 3b44fc6 commit 5f62bea

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ plugins {
66

77
repositories {
88
mavenLocal()
9-
maven {
10-
url = uri("https://repo.maven.apache.org/maven2/")
11-
}
9+
mavenCentral()
1210
}
1311

1412
dependencies {

buildSrc/src/main/kotlin/publish-conventions.gradle.kts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,36 @@ tasks.withType<JavaCompile>().configureEach {
8181
options.compilerArgs = mutableListOf("-Xlint:-deprecation,-unchecked")
8282
}
8383

84+
fun read(str: String?): String? {
85+
if (str == null) {
86+
return null
87+
}
88+
try {
89+
val file = File(str).let {
90+
if (!it.exists()) {
91+
return@let File(uri(str))
92+
}
93+
it
94+
}
95+
if (file.exists()) {
96+
return file.readText(Charsets.UTF_8)
97+
}
98+
} catch (_: Exception) {
99+
}
100+
return str
101+
}
102+
84103
val cleanUpload by tasks.creating(Delete::class) {
85104
setDelete(project.files(project.layout.buildDirectory.dir("sonatype-central-upload")))
86105
}
87106

88107
tasks.sonatypeCentralUpload {
89108
// gradle sonatypeCentralUpload -PCENTRAL_USERNAME=<username> -PCENTRAL_PASSWORD=<password> -PCENTRAL_PRIVATE_KEY=<privateKey> -PCENTRAL_PRIVATE_KEY_PWD=<privateKeyPwd> -PCENTRAL_PUBLIC_KEY=<publicKey>
90-
val centralUsername = System.getenv("CENTRAL_USERNAME") ?: findProperty("CENTRAL_USERNAME")?.toString()
91-
val centralPassword = System.getenv("CENTRAL_PASSWORD") ?: findProperty("CENTRAL_PASSWORD")?.toString()
92-
val privateKey = System.getenv("CENTRAL_PRIVATE_KEY") ?: findProperty("CENTRAL_PRIVATE_KEY")?.toString()
93-
val privateKeyPwd = System.getenv("CENTRAL_PRIVATE_KEY_PWD") ?: findProperty("CENTRAL_PRIVATE_KEY_PWD")?.toString()
94-
val publicKey = System.getenv("CENTRAL_PUBLIC_KEY") ?: findProperty("CENTRAL_PUBLIC_KEY")?.toString()
109+
val centralUsername = read(System.getenv("MAVEN_USERNAME") ?: findProperty("CENTRAL_USERNAME")?.toString())
110+
val centralPassword = read(System.getenv("MAVEN_PASSWORD") ?: findProperty("CENTRAL_PASSWORD")?.toString())
111+
val privateKey = read(System.getenv("MAVEN_PRIVATE_KEY") ?: findProperty("CENTRAL_PRIVATE_KEY")?.toString())
112+
val privateKeyPwd = read(System.getenv("MAVEN_PRIVATE_KEY_PWD") ?: findProperty("CENTRAL_PRIVATE_KEY_PWD")?.toString())
113+
val publicKey = read(System.getenv("MAVEN_PUBLIC_KEY") ?: findProperty("CENTRAL_PUBLIC_KEY")?.toString())
95114
dependsOn(tasks.build, tasks.generatePomFileForMavenPublication, cleanUpload)
96115
this.username = centralUsername
97116
this.password = centralPassword

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "JKook"
1+
rootProject.name = "jkook"

0 commit comments

Comments
 (0)