Skip to content

Commit

Permalink
subproject build system simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Aug 17, 2024
1 parent 7ee2885 commit 421eed3
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 55 deletions.
81 changes: 50 additions & 31 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ plugins {
}

val githubAccount = "xemantic"
val isSnapshotVersion = project.version.toString().endsWith("-SNAPSHOT")

allprojects {
repositories {
Expand All @@ -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<JavaPluginExtension> {
Expand All @@ -62,31 +69,38 @@ subprojects {
apply(plugin = "maven-publish")
apply(plugin = "java-library")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "signing")

configure<JavaPluginExtension> {
withJavadocJar()
withSourcesJar()
}

afterEvaluate {
tasks {

tasks {

withType<Jar> {
manifest {
attributes(
mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
)
withType<Jar> {
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<Jar>("javadocJar") {
from(named("dokkaJavadoc"))
Expand All @@ -96,12 +110,14 @@ subprojects {

configure<PublishingExtension> {
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")
}
}
}
}
Expand Down Expand Up @@ -148,20 +164,23 @@ subprojects {
}
}
}
}

}
configure<SigningExtension> {
useInMemoryPgpKeys(
System.getenv("SIGN_KEY"),
System.getenv("SIGN_PASSPHRASE")
)
sign(publishing.publications["maven"])
}

}
tasks.withType<Sign> {
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 {
Expand Down
4 changes: 0 additions & 4 deletions demo/mvp-implementation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
* see <https://www.gnu.org/licenses/>.
*/

plugins {
alias(libs.plugins.kotlin.jvm)
}

dependencies {
implementation(project(":xemantic-kotlin-swing-dsl-core"))
implementation(project(":demo:mvp-presenter"))
Expand Down
4 changes: 0 additions & 4 deletions demo/mvp-presenter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
* see <https://www.gnu.org/licenses/>.
*/

plugins {
alias(libs.plugins.kotlin.jvm)
}

dependencies {
implementation(project(":xemantic-kotlin-swing-dsl-core"))

Expand Down
4 changes: 0 additions & 4 deletions demo/simple-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
* see <https://www.gnu.org/licenses/>.
*/

plugins {
java
}

dependencies {
implementation(project(":xemantic-kotlin-swing-dsl-core"))
}
4 changes: 0 additions & 4 deletions demo/simple-kotlin-dsl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
* see <https://www.gnu.org/licenses/>.
*/

plugins {
alias(libs.plugins.kotlin.jvm)
}

dependencies {
implementation(project(":xemantic-kotlin-swing-dsl-core"))
}
4 changes: 0 additions & 4 deletions xemantic-kotlin-swing-dsl-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
* see <https://www.gnu.org/licenses/>.
*/

plugins {
alias(libs.plugins.kotlin.jvm)
}

dependencies {
api(libs.kotlinx.coroutines.core)
runtimeOnly(libs.kotlinx.coroutines.swing)
Expand Down
4 changes: 0 additions & 4 deletions xemantic-kotlin-swing-dsl-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
* see <https://www.gnu.org/licenses/>.
*/

plugins {
alias(libs.plugins.kotlin.jvm)
}

dependencies {
api(libs.kotlinx.coroutines.test)
}

0 comments on commit 421eed3

Please sign in to comment.