diff --git a/build.gradle.kts b/build.gradle.kts index 197484e..328c72e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,6 +31,7 @@ plugins { } val githubAccount = "xemantic" +val isSnapshotVersion = project.version.toString().endsWith("-SNAPSHOT") allprojects { repositories { @@ -40,6 +41,12 @@ allprojects { subprojects { + if (project.name == "simple-java") { + apply(plugin = "java") + } else { + apply(plugin = "org.jetbrains.kotlin.jvm") + } + afterEvaluate { if (project.name != "demo") { configure { @@ -62,31 +69,38 @@ subprojects { apply(plugin = "maven-publish") apply(plugin = "java-library") apply(plugin = "org.jetbrains.dokka") + apply(plugin = "signing") configure { withJavadocJar() withSourcesJar() } - afterEvaluate { + tasks { - tasks { - - withType { - manifest { - attributes( - mapOf( - "Implementation-Title" to project.name, - "Implementation-Version" to project.version - ) + withType { + manifest { + attributes( + mapOf( + "Implementation-Title" to project.name, + "Implementation-Version" to project.version ) - } - metaInf { - from(rootProject.rootDir) { - include("LICENSE") - } + ) + } + metaInf { + from(rootProject.rootDir) { + include("LICENSE") } } + } + + } + + afterEvaluate { + + tasks { + + named("javadocJar") { from(named("dokkaJavadoc")) @@ -96,12 +110,14 @@ subprojects { configure { repositories { - maven { - name = "GitHubPackages" - setUrl("https://maven.pkg.github.com/$githubAccount/${rootProject.name}") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") + if (isSnapshotVersion) { + maven { + name = "GitHubPackages" + setUrl("https://maven.pkg.github.com/$githubAccount/${rootProject.name}") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } } } } @@ -148,20 +164,23 @@ subprojects { } } } - } - } + configure { + useInMemoryPgpKeys( + System.getenv("SIGN_KEY"), + System.getenv("SIGN_PASSPHRASE") + ) + sign(publishing.publications["maven"]) + } -} + tasks.withType { + onlyIf { System.getenv("SIGN_KEY") != null } + } + + } -signing { - if ( - project.hasProperty("signing.keyId") - && project.hasProperty("signing.password") - && project.hasProperty("signing.secretKeyRingFile") - ) { - sign(publishing.publications["maven"]) } + } nexusPublishing { diff --git a/demo/mvp-implementation/build.gradle.kts b/demo/mvp-implementation/build.gradle.kts index 884d35f..f7d07e6 100644 --- a/demo/mvp-implementation/build.gradle.kts +++ b/demo/mvp-implementation/build.gradle.kts @@ -18,10 +18,6 @@ * see . */ -plugins { - alias(libs.plugins.kotlin.jvm) -} - dependencies { implementation(project(":xemantic-kotlin-swing-dsl-core")) implementation(project(":demo:mvp-presenter")) diff --git a/demo/mvp-presenter/build.gradle.kts b/demo/mvp-presenter/build.gradle.kts index 0fc7192..92b84e5 100644 --- a/demo/mvp-presenter/build.gradle.kts +++ b/demo/mvp-presenter/build.gradle.kts @@ -18,10 +18,6 @@ * see . */ -plugins { - alias(libs.plugins.kotlin.jvm) -} - dependencies { implementation(project(":xemantic-kotlin-swing-dsl-core")) diff --git a/demo/simple-java/build.gradle.kts b/demo/simple-java/build.gradle.kts index 19e3502..b407ca1 100644 --- a/demo/simple-java/build.gradle.kts +++ b/demo/simple-java/build.gradle.kts @@ -18,10 +18,6 @@ * see . */ -plugins { - java -} - dependencies { implementation(project(":xemantic-kotlin-swing-dsl-core")) } diff --git a/demo/simple-kotlin-dsl/build.gradle.kts b/demo/simple-kotlin-dsl/build.gradle.kts index 0f01736..b407ca1 100644 --- a/demo/simple-kotlin-dsl/build.gradle.kts +++ b/demo/simple-kotlin-dsl/build.gradle.kts @@ -18,10 +18,6 @@ * see . */ -plugins { - alias(libs.plugins.kotlin.jvm) -} - dependencies { implementation(project(":xemantic-kotlin-swing-dsl-core")) } diff --git a/xemantic-kotlin-swing-dsl-core/build.gradle.kts b/xemantic-kotlin-swing-dsl-core/build.gradle.kts index fe0e624..97e2827 100644 --- a/xemantic-kotlin-swing-dsl-core/build.gradle.kts +++ b/xemantic-kotlin-swing-dsl-core/build.gradle.kts @@ -18,10 +18,6 @@ * see . */ -plugins { - alias(libs.plugins.kotlin.jvm) -} - dependencies { api(libs.kotlinx.coroutines.core) runtimeOnly(libs.kotlinx.coroutines.swing) diff --git a/xemantic-kotlin-swing-dsl-test/build.gradle.kts b/xemantic-kotlin-swing-dsl-test/build.gradle.kts index cc63efa..23906e0 100644 --- a/xemantic-kotlin-swing-dsl-test/build.gradle.kts +++ b/xemantic-kotlin-swing-dsl-test/build.gradle.kts @@ -18,10 +18,6 @@ * see . */ -plugins { - alias(libs.plugins.kotlin.jvm) -} - dependencies { api(libs.kotlinx.coroutines.test) }