From 2e4db0744e7a81edbb5391ab660b4baed76421ed Mon Sep 17 00:00:00 2001 From: Frank Delporte Date: Thu, 25 Jul 2024 15:09:58 +0200 Subject: [PATCH] Move version definition to root level --- build.gradle.kts | 7 +++++-- example/build.gradle.kts | 21 ++++++++++++--------- lib/build.gradle.kts | 28 +++++++++++++++------------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8391e2a..b283bf3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,10 +6,13 @@ plugins { id("io.github.gradle-nexus.publish-plugin") version "1.1.0" } -val libVersion by extra("2.6.0") +// Set a property +extra["pi4jVersion"] = "2.6.0" +extra["slf4jVersion"] = "2.0.12" +extra["kotlinCoroutinesVersion"] = "1.6.4" group = "com.pi4j" -version = libVersion +version = "2.6.0" repositories { mavenCentral() diff --git a/example/build.gradle.kts b/example/build.gradle.kts index 146b926..f2c09e3 100644 --- a/example/build.gradle.kts +++ b/example/build.gradle.kts @@ -16,16 +16,19 @@ repositories { } dependencies { + val pi4jVersion: String by rootProject.extra + val slf4jVersion: String by rootProject.extra + val kotlinCoroutinesVersion: String by rootProject.extra implementation(project(":lib")) - implementation("com.pi4j:pi4j-core:2.6.0") - implementation("com.pi4j:pi4j-plugin-raspberrypi:2.6.0") - implementation("com.pi4j:pi4j-plugin-pigpio:2.6.0") - implementation("com.pi4j:pi4j-plugin-gpiod:2.6.0") - implementation("com.pi4j:pi4j-plugin-linuxfs:2.6.0") - implementation("com.pi4j:pi4j-plugin-mock:2.6.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3") - implementation("org.slf4j:slf4j-api:2.0.12") - implementation("org.slf4j:slf4j-simple:2.0.12") + implementation("com.pi4j:pi4j-core:$pi4jVersion") + implementation("com.pi4j:pi4j-plugin-raspberrypi:$pi4jVersion") + implementation("com.pi4j:pi4j-plugin-pigpio:$pi4jVersion") + implementation("com.pi4j:pi4j-plugin-gpiod:$pi4jVersion") + implementation("com.pi4j:pi4j-plugin-linuxfs:$pi4jVersion") + implementation("com.pi4j:pi4j-plugin-mock:$pi4jVersion") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion") + implementation("org.slf4j:slf4j-api:$slf4jVersion") + implementation("org.slf4j:slf4j-simple:$slf4jVersion") testImplementation(kotlin("test")) } diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 8284977..9d19e8f 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -5,25 +5,26 @@ plugins { signing } val libName = "pi4j-ktx" -val libVersion: String by rootProject.extra group = "com.pi4j" -version = libVersion repositories { mavenCentral() } dependencies { - compileOnly("com.pi4j:pi4j-core:2.6.0") - testImplementation("com.pi4j:pi4j-core:2.6.0") - compileOnly("com.pi4j:pi4j-plugin-mock:2.6.0") - testImplementation("com.pi4j:pi4j-plugin-mock:2.6.0") - compileOnly("org.slf4j:slf4j-api:2.0.12") - testImplementation("org.slf4j:slf4j-api:2.0.12") - compileOnly("org.slf4j:slf4j-simple:2.0.12") - testImplementation("org.slf4j:slf4j-simple:2.0.12") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + val pi4jVersion: String by rootProject.extra + val slf4jVersion: String by rootProject.extra + val kotlinCoroutinesVersion: String by rootProject.extra + compileOnly("com.pi4j:pi4j-core:$pi4jVersion") + testImplementation("com.pi4j:pi4j-core:$pi4jVersion") + compileOnly("com.pi4j:pi4j-plugin-mock:$pi4jVersion") + testImplementation("com.pi4j:pi4j-plugin-mock:$pi4jVersion") + compileOnly("org.slf4j:slf4j-api:$slf4jVersion") + testImplementation("org.slf4j:slf4j-api:$slf4jVersion") + compileOnly("org.slf4j:slf4j-simple:$slf4jVersion") + testImplementation("org.slf4j:slf4j-simple:$slf4jVersion") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion") testImplementation(kotlin("test")) } @@ -51,13 +52,14 @@ publishing { } } publications { + val pi4jVersion: String by rootProject.extra create(libName) { groupId = "com.pi4j" artifactId = libName - version = libVersion + version = pi4jVersion from(components["java"]) pom { - version = libVersion + version = pi4jVersion artifactId = libName name.set("pi4j-ktx") description.set("Kotlin DSL for Pi4J V2")