From 0b092b352dc29ce69f6f126eb7857a1243a6ef62 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 23 Feb 2021 11:46:06 +0100 Subject: Extract testing conventions from Kotlin conventions This change extracts the configuration for test from the Kotlin library conventions. --- .../kotlin/kotlin-library-conventions.gradle.kts | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts (limited to 'simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts') diff --git a/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts new file mode 100644 index 00000000..b07267d2 --- /dev/null +++ b/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2019 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.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `java-library` + kotlin("jvm") + id("org.jlleitschuh.gradle.ktlint") +} + +/* Project configuration */ +repositories { + mavenCentral() + jcenter() +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 +} + +kotlin { + explicitApi() +} + +tasks.withType().configureEach { + kotlinOptions.jvmTarget = "1.8" + kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" +} -- cgit v1.2.3 From 90de768b8bfb3acc222f508d2e602ef3b7f1ff91 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 23 Feb 2021 12:05:59 +0100 Subject: 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. --- .../buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts') 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().configureEach { - kotlinOptions.jvmTarget = "1.8" + kotlinOptions.jvmTarget = Versions.jvmTarget.toString() kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" } -- cgit v1.2.3 From 2119427fe6f7874867c6985cacda28befc53436b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 23 Feb 2021 12:37:31 +0100 Subject: Utilize version constraints for shared versions This change updates the Gradle configuration to utilize version constraints to force the same dependency version across modules. --- .../buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts') 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 8d6420be..e9fee735 100644 --- a/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts +++ b/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts @@ -28,12 +28,7 @@ plugins { `java-library` kotlin("jvm") id("org.jlleitschuh.gradle.ktlint") -} - -/* Project configuration */ -repositories { - mavenCentral() - jcenter() + id("dependency-conventions") } java { -- cgit v1.2.3 From 15fcd1a10018605f59ca7a644b8f3b3960e7b6b0 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 23 Feb 2021 21:40:53 +0100 Subject: Use Java Platform for shared dependency constraints This change uses the Java Platform functionality from Gradle to enable shared dependency constraints across modules. --- .../buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts') 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 e9fee735..8d6420be 100644 --- a/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts +++ b/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts @@ -28,7 +28,12 @@ plugins { `java-library` kotlin("jvm") id("org.jlleitschuh.gradle.ktlint") - id("dependency-conventions") +} + +/* Project configuration */ +repositories { + mavenCentral() + jcenter() } java { -- cgit v1.2.3