diff --git a/build.gradle.kts b/build.gradle.kts
index 9799cbb..197484e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -18,14 +18,20 @@
* see .
*/
+import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
+
plugins {
alias(libs.plugins.kotlin.jvm) apply false
`maven-publish`
signing
alias(libs.plugins.versions)
alias(libs.plugins.dokka) apply false
+ alias(libs.plugins.publish)
}
+val githubAccount = "xemantic"
+
allprojects {
repositories {
mavenCentral()
@@ -34,7 +40,24 @@ allprojects {
subprojects {
- if (project.name.startsWith("xemantic")) {
+ afterEvaluate {
+ if (project.name != "demo") {
+ configure {
+ toolchain {
+ languageVersion.set(JavaLanguageVersion.of(17))
+ }
+ }
+ if (project.name != "simple-java") {
+ tasks.named>("compileKotlin").configure {
+ compilerOptions {
+ apiVersion.set(KotlinVersion.KOTLIN_2_0)
+ }
+ }
+ }
+ }
+ }
+
+ if (project.name.startsWith(rootProject.name)) {
apply(plugin = "maven-publish")
apply(plugin = "java-library")
@@ -58,7 +81,11 @@ subprojects {
)
)
}
-
+ metaInf {
+ from(rootProject.rootDir) {
+ include("LICENSE")
+ }
+ }
}
named("javadocJar") {
@@ -71,20 +98,12 @@ subprojects {
repositories {
maven {
name = "GitHubPackages"
- setUrl("https://maven.pkg.github.com/xemantic/xemantic-kotlin-swing-dsl")
+ setUrl("https://maven.pkg.github.com/$githubAccount/${rootProject.name}")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
-// maven {
-// name = "OSSRH"
-// setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/")
-// credentials {
-// username = System.getenv("MAVEN_USERNAME")
-// password = System.getenv("MAVEN_PASSWORD")
-// }
-// }
}
publications {
create("maven") {
@@ -92,7 +111,7 @@ subprojects {
artifact(tasks.named("javadocJar"))
pom {
description = "Kotlin goodies for Java Swing"
- url = "https://github.com/xemantic/xemantic-kotlin-swing-dsl"
+ url = "https://github.com/$githubAccount/${rootProject.name}"
inceptionYear = "2020"
organization {
name = "Xemantic"
@@ -106,15 +125,17 @@ subprojects {
}
}
scm {
- url = "https://github.com/xemantic/xemantic-kotlin-swing-dsl"
+ url = "https://github.com/$githubAccount/${rootProject.name}"
+ connection = "scm:git:git:github.com/$githubAccount/${rootProject.name}.git"
+ developerConnection = "scm:git:https://github.com/$githubAccount/${rootProject.name}.git"
}
ciManagement {
system = "GitHub"
- url = "https://github.com/xemantic/xemantic-kotlin-swing-dsl/actions"
+ url = "https://github.com/$githubAccount/${rootProject.name}/actions"
}
issueManagement {
system = "GitHub"
- url = "https://github.com/xemantic/xemantic-kotlin-swing-dsl/issues"
+ url = "https://github.com/$githubAccount/${rootProject.name}/issues"
}
developers {
developer {
@@ -133,12 +154,23 @@ subprojects {
}
-//signing {
-// if (
-// project.hasProperty("signing.keyId")
-// && project.hasProperty("signing.password")
-// && project.hasProperty("signing.secretKeyRingFile")
-// ) {
-// sign(publishing.publications)
-// }
-//}
+signing {
+ if (
+ project.hasProperty("signing.keyId")
+ && project.hasProperty("signing.password")
+ && project.hasProperty("signing.secretKeyRingFile")
+ ) {
+ sign(publishing.publications["maven"])
+ }
+}
+
+nexusPublishing {
+ repositories {
+ sonatype { //only for users registered in Sonatype after 24 Feb 2021
+ nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
+ snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
+ username.set(System.getenv("SONATYPE_USER"))
+ password.set(System.getenv("SONATYPE_PASSWORD"))
+ }
+ }
+}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 4633312..d022974 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -4,7 +4,8 @@ kotlinxCoroutines = "1.8.1"
kotest = "5.9.1"
versionsPlugin = "0.51.0"
-dokka = "1.9.20"
+dokkaPlugin = "1.9.20"
+publishPlugin = "2.0.0"
[libraries]
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
@@ -16,4 +17,5 @@ kotest-assertions-core = { group = "io.kotest", name = "kotest-assertions-core",
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versionsPlugin" }
-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
+dokka = { id = "org.jetbrains.dokka", version.ref = "dokkaPlugin" }
+publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "publishPlugin" }