diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-02-23 12:05:59 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-02-23 12:12:36 +0100 |
| commit | 90de768b8bfb3acc222f508d2e602ef3b7f1ff91 (patch) | |
| tree | 577a96ec45e245d1a1184a5158495c2289ae004c | |
| parent | 0b092b352dc29ce69f6f126eb7857a1243a6ef62 (diff) | |
Move dependency versions to gradle.properties
This change moves the version of the dependencies from buildSrc to
gradle.properties to prevent recompilation when changing dependency
versions.
18 files changed, 119 insertions, 43 deletions
diff --git a/simulator/buildSrc/build.gradle.kts b/simulator/buildSrc/build.gradle.kts index 452c07cd..4cc1958a 100644 --- a/simulator/buildSrc/build.gradle.kts +++ b/simulator/buildSrc/build.gradle.kts @@ -38,6 +38,10 @@ dependencies { implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1") } +kotlinDslPluginOptions { + experimentalWarning.set(false) +} + tasks.withType<KotlinCompile>().configureEach { kotlinOptions { allWarningsAsErrors = true diff --git a/simulator/buildSrc/src/main/kotlin/ProjectExtensions.kt b/simulator/buildSrc/src/main/kotlin/ProjectExtensions.kt new file mode 100644 index 00000000..ddf643f6 --- /dev/null +++ b/simulator/buildSrc/src/main/kotlin/ProjectExtensions.kt @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 AtLarge Research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.extra +import org.gradle.kotlin.dsl.provideDelegate + +/** + * Obtain the [Versions] object for the specified [Project] instance. + */ +val Project.versions: Versions + get() { + var versions: Versions? by rootProject.extra + return versions ?: Versions(rootProject).also { versions = it } + } diff --git a/simulator/buildSrc/src/main/kotlin/Versions.kt b/simulator/buildSrc/src/main/kotlin/Versions.kt index d845c4bd..fcf3c778 100644 --- a/simulator/buildSrc/src/main/kotlin/Versions.kt +++ b/simulator/buildSrc/src/main/kotlin/Versions.kt @@ -22,29 +22,42 @@ * SOFTWARE. */ +import org.gradle.api.JavaVersion +import org.gradle.api.Project +import org.gradle.kotlin.dsl.extra +import kotlin.properties.ReadOnlyProperty +import kotlin.reflect.KProperty + /** * This class contains the versions of the dependencies shared by the different * subprojects. */ -public object Versions { - +public class Versions(private val project: Project) { /** - * The library for testing the projects. + * A delegate for obtaining configuration values from a [Project] instance. */ - val JUNIT_JUPITER = "5.7.1" + private fun version(name: String? = null): ReadOnlyProperty<Versions, String> = + ReadOnlyProperty { _, property -> get(name ?: property.name) } - /** - * The library for hosting the tests. - */ - val JUNIT_PLATFORM = "1.7.1" + val junitJupiter by version(name = "junit-jupiter") + val junitPlatform by version(name = "junit-platform") + + val slf4j by version() + val kotlinLogging by version(name = "kotlin-logging") + val log4j by version() + + val kotlinxCoroutines by version(name = "kotlinx-coroutines") - /** - * Logging facade. - */ - val SLF4J = "1.7.30" /** - * Kotlin coroutines support + * Obtain the version for the specified [dependency][name]. */ - val KOTLINX_COROUTINES = "1.4.2" + operator fun get(name: String) = project.extra.get("$name.version") as String + + companion object { + /** + * The JVM version to target. + */ + val jvmTarget = JavaVersion.VERSION_1_8 + } } diff --git a/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts index b07267d2..8d6420be 100644 --- a/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts +++ b/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts @@ -37,7 +37,7 @@ repositories { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = Versions.jvmTarget } kotlin { @@ -45,6 +45,6 @@ kotlin { } tasks.withType<KotlinCompile>().configureEach { - kotlinOptions.jvmTarget = "1.8" + kotlinOptions.jvmTarget = Versions.jvmTarget.toString() kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" } diff --git a/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts index 5a19bfe0..22ea7905 100644 --- a/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts +++ b/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts @@ -33,6 +33,6 @@ tasks.test { } dependencies { - testImplementation("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT_JUPITER}") + testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junitJupiter}") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junitJupiter}") } diff --git a/simulator/gradle.properties b/simulator/gradle.properties new file mode 100644 index 00000000..eb92399d --- /dev/null +++ b/simulator/gradle.properties @@ -0,0 +1,29 @@ +# +# Copyright (c) 2021 AtLarge Research +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Dependencies +junit-jupiter.version = 5.7.1 +junit-platform.version = 1.7.1 +kotlin-logging.version = 2.0.4 +slf4j.version = 1.7.30 +log4j.version = 2.14.0 +kotlinx-coroutines.version = 1.4.2 diff --git a/simulator/opendc-compute/opendc-compute-core/build.gradle.kts b/simulator/opendc-compute/opendc-compute-core/build.gradle.kts index 39a146ab..c6d254d1 100644 --- a/simulator/opendc-compute/opendc-compute-core/build.gradle.kts +++ b/simulator/opendc-compute/opendc-compute-core/build.gradle.kts @@ -31,5 +31,5 @@ dependencies { api(project(":opendc-core")) api(project(":opendc-trace:opendc-trace-core")) implementation(project(":opendc-utils")) - implementation("io.github.microutils:kotlin-logging:1.7.9") + implementation("io.github.microutils:kotlin-logging:${versions.kotlinLogging}") } diff --git a/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts index 606223c6..00fdd780 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts +++ b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts @@ -33,8 +33,8 @@ dependencies { api(project(":opendc-simulator:opendc-simulator-compute")) api(project(":opendc-simulator:opendc-simulator-failures")) implementation(project(":opendc-utils")) - implementation("io.github.microutils:kotlin-logging:1.7.9") + implementation("io.github.microutils:kotlin-logging:${versions.kotlinLogging}") testImplementation(project(":opendc-simulator:opendc-simulator-core")) - testRuntimeOnly("org.slf4j:slf4j-simple:${Versions.SLF4J}") + testRuntimeOnly("org.slf4j:slf4j-simple:${versions.slf4j}") } diff --git a/simulator/opendc-core/build.gradle.kts b/simulator/opendc-core/build.gradle.kts index 5e189fb5..ce2cae26 100644 --- a/simulator/opendc-core/build.gradle.kts +++ b/simulator/opendc-core/build.gradle.kts @@ -28,5 +28,5 @@ plugins { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinxCoroutines}") } diff --git a/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts b/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts index f02d1e38..9c21a8c6 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts +++ b/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts @@ -39,8 +39,4 @@ dependencies { implementation(project(":opendc-workflows")) implementation(project(":opendc-simulator:opendc-simulator-core")) implementation(project(":opendc-compute:opendc-compute-simulator")) - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8") { - exclude("org.jetbrains.kotlin", module = "kotlin-reflect") - } - implementation(kotlin("reflect")) } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts index 271852b3..6592c86f 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts +++ b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts @@ -43,7 +43,7 @@ dependencies { implementation(project(":opendc-simulator:opendc-simulator-failures")) implementation(project(":opendc-compute:opendc-compute-simulator")) - implementation("io.github.microutils:kotlin-logging:2.0.4") + implementation("io.github.microutils:kotlin-logging:${versions.kotlinLogging}") implementation("me.tongfei:progressbar:0.9.0") implementation("com.github.ajalt.clikt:clikt:3.1.0") diff --git a/simulator/opendc-harness/build.gradle.kts b/simulator/opendc-harness/build.gradle.kts index fd692237..ebede556 100644 --- a/simulator/opendc-harness/build.gradle.kts +++ b/simulator/opendc-harness/build.gradle.kts @@ -29,17 +29,17 @@ plugins { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") - api("org.junit.platform:junit-platform-commons:${Versions.JUNIT_PLATFORM}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinxCoroutines}") + api("org.junit.platform:junit-platform-commons:${versions.junitPlatform}") implementation("io.github.classgraph:classgraph:4.8.98") implementation("me.tongfei:progressbar:0.9.0") - implementation("io.github.microutils:kotlin-logging:2.0.4") + implementation("io.github.microutils:kotlin-logging:${versions.kotlinLogging}") implementation("com.github.ajalt.clikt:clikt:3.1.0") - api("org.junit.platform:junit-platform-engine:${Versions.JUNIT_PLATFORM}") - api("org.junit.platform:junit-platform-suite-api:${Versions.JUNIT_PLATFORM}") - api("org.junit.platform:junit-platform-launcher:${Versions.JUNIT_PLATFORM}") + api("org.junit.platform:junit-platform-engine:${versions.junitPlatform}") + api("org.junit.platform:junit-platform-suite-api:${versions.junitPlatform}") + api("org.junit.platform:junit-platform-launcher:${versions.junitPlatform}") - runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.14.0") + runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}") } diff --git a/simulator/opendc-runner-web/build.gradle.kts b/simulator/opendc-runner-web/build.gradle.kts index de723bd9..0439ca0b 100644 --- a/simulator/opendc-runner-web/build.gradle.kts +++ b/simulator/opendc-runner-web/build.gradle.kts @@ -41,13 +41,13 @@ dependencies { implementation(project(":opendc-simulator:opendc-simulator-compute")) implementation("com.github.ajalt:clikt:2.8.0") - implementation("io.github.microutils:kotlin-logging:1.7.10") + implementation("io.github.microutils:kotlin-logging:${versions.kotlinLogging}") implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8") { exclude("org.jetbrains.kotlin", module = "kotlin-reflect") } implementation("io.sentry:sentry-log4j2:3.1.1") implementation("org.mongodb:mongodb-driver-sync:4.0.5") - runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.13.1") - runtimeOnly("org.apache.logging.log4j:log4j-1.2-api:2.13.1") + runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}") + runtimeOnly("org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}") } diff --git a/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts b/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts index 79d3463f..db681ef0 100644 --- a/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts +++ b/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts @@ -28,5 +28,5 @@ plugins { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.kotlinxCoroutines}") } diff --git a/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts b/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts index d2193c0d..76f77a90 100644 --- a/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts +++ b/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts @@ -27,5 +27,5 @@ plugins { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinxCoroutines}") } diff --git a/simulator/opendc-trace/opendc-trace-core/build.gradle.kts b/simulator/opendc-trace/opendc-trace-core/build.gradle.kts index 96b79284..a5243a63 100644 --- a/simulator/opendc-trace/opendc-trace-core/build.gradle.kts +++ b/simulator/opendc-trace/opendc-trace-core/build.gradle.kts @@ -28,5 +28,5 @@ plugins { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinxCoroutines}") } diff --git a/simulator/opendc-utils/build.gradle.kts b/simulator/opendc-utils/build.gradle.kts index 0885b592..788c2072 100644 --- a/simulator/opendc-utils/build.gradle.kts +++ b/simulator/opendc-utils/build.gradle.kts @@ -29,7 +29,7 @@ plugins { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinxCoroutines}") testImplementation(project(":opendc-simulator:opendc-simulator-core")) } diff --git a/simulator/opendc-workflows/build.gradle.kts b/simulator/opendc-workflows/build.gradle.kts index dbd135a8..74a0fbc3 100644 --- a/simulator/opendc-workflows/build.gradle.kts +++ b/simulator/opendc-workflows/build.gradle.kts @@ -33,7 +33,7 @@ dependencies { api(project(":opendc-compute:opendc-compute-core")) api(project(":opendc-trace:opendc-trace-core")) implementation(project(":opendc-utils")) - implementation("io.github.microutils:kotlin-logging:1.7.9") + implementation("io.github.microutils:kotlin-logging:${versions.kotlinLogging}") testImplementation(project(":opendc-simulator:opendc-simulator-core")) testImplementation(project(":opendc-compute:opendc-compute-simulator")) @@ -42,5 +42,5 @@ dependencies { exclude("org.jetbrains.kotlin", module = "kotlin-reflect") } testImplementation(kotlin("reflect")) - testRuntimeOnly("org.slf4j:slf4j-simple:${Versions.SLF4J}") + testRuntimeOnly("org.slf4j:slf4j-simple:${versions.kotlinxCoroutines}") } |
