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. --- simulator/build.gradle.kts | 2 +- simulator/buildSrc/build.gradle.kts | 21 ++++---- simulator/buildSrc/settings.gradle.kts | 4 +- simulator/buildSrc/src/main/kotlin/Versions.kt | 50 +++++++++++++++++++ .../src/main/kotlin/dokka-convention.gradle.kts | 33 ------------ .../src/main/kotlin/dokka-conventions.gradle.kts | 33 ++++++++++++ .../src/main/kotlin/jacoco-convention.gradle.kts | 58 ---------------------- .../src/main/kotlin/jacoco-conventions.gradle.kts | 58 ++++++++++++++++++++++ .../kotlin/kotlin-library-convention.gradle.kts | 55 -------------------- .../kotlin/kotlin-library-conventions.gradle.kts | 50 +++++++++++++++++++ simulator/buildSrc/src/main/kotlin/library.kt | 49 ------------------ .../src/main/kotlin/testing-conventions.gradle.kts | 38 ++++++++++++++ .../opendc-compute-core/build.gradle.kts | 8 +-- .../opendc-compute-simulator/build.gradle.kts | 7 ++- simulator/opendc-core/build.gradle.kts | 7 +-- .../opendc-experiments-sc18/build.gradle.kts | 5 +- .../opendc-experiments-sc20/build.gradle.kts | 6 +-- simulator/opendc-format/build.gradle.kts | 6 +-- simulator/opendc-harness/build.gradle.kts | 16 +++--- simulator/opendc-runner-web/build.gradle.kts | 2 +- .../opendc-simulator-compute/build.gradle.kts | 6 +-- .../opendc-simulator-core/build.gradle.kts | 4 +- .../opendc-simulator-failures/build.gradle.kts | 4 +- .../opendc-trace-core/build.gradle.kts | 4 +- simulator/opendc-utils/build.gradle.kts | 7 ++- simulator/opendc-workflows/build.gradle.kts | 7 ++- 26 files changed, 276 insertions(+), 264 deletions(-) create mode 100644 simulator/buildSrc/src/main/kotlin/Versions.kt delete mode 100644 simulator/buildSrc/src/main/kotlin/dokka-convention.gradle.kts create mode 100644 simulator/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts delete mode 100644 simulator/buildSrc/src/main/kotlin/jacoco-convention.gradle.kts create mode 100644 simulator/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts delete mode 100644 simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts create mode 100644 simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts delete mode 100644 simulator/buildSrc/src/main/kotlin/library.kt create mode 100644 simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts (limited to 'simulator') diff --git a/simulator/build.gradle.kts b/simulator/build.gradle.kts index b104654b..6b0a9bf1 100644 --- a/simulator/build.gradle.kts +++ b/simulator/build.gradle.kts @@ -21,7 +21,7 @@ */ plugins { - `dokka-convention` + `dokka-conventions` } allprojects { diff --git a/simulator/buildSrc/build.gradle.kts b/simulator/buildSrc/build.gradle.kts index e1f538fe..452c07cd 100644 --- a/simulator/buildSrc/build.gradle.kts +++ b/simulator/buildSrc/build.gradle.kts @@ -1,7 +1,5 @@ /* - * MIT License - * - * Copyright (c) 2019 atlarge-research + * 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 @@ -22,21 +20,16 @@ * SOFTWARE. */ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { `kotlin-dsl` } -kotlinDslPluginOptions { - experimentalWarning.set(false) -} - - /* Project configuration */ repositories { jcenter() - maven { - url = uri("https://plugins.gradle.org/m2/") - } + gradlePluginPortal() } dependencies { @@ -44,3 +37,9 @@ dependencies { implementation("org.jlleitschuh.gradle:ktlint-gradle:10.0.0") implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1") } + +tasks.withType().configureEach { + kotlinOptions { + allWarningsAsErrors = true + } +} diff --git a/simulator/buildSrc/settings.gradle.kts b/simulator/buildSrc/settings.gradle.kts index cc3f3add..5337ee96 100644 --- a/simulator/buildSrc/settings.gradle.kts +++ b/simulator/buildSrc/settings.gradle.kts @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2019 atlarge-research + * 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 @@ -21,3 +21,5 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ + +/* Intentionally left blank */ diff --git a/simulator/buildSrc/src/main/kotlin/Versions.kt b/simulator/buildSrc/src/main/kotlin/Versions.kt new file mode 100644 index 00000000..d845c4bd --- /dev/null +++ b/simulator/buildSrc/src/main/kotlin/Versions.kt @@ -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. + */ + +/** + * This class contains the versions of the dependencies shared by the different + * subprojects. + */ +public object Versions { + + /** + * The library for testing the projects. + */ + val JUNIT_JUPITER = "5.7.1" + + /** + * The library for hosting the tests. + */ + val JUNIT_PLATFORM = "1.7.1" + + /** + * Logging facade. + */ + val SLF4J = "1.7.30" + + /** + * Kotlin coroutines support + */ + val KOTLINX_COROUTINES = "1.4.2" +} diff --git a/simulator/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/simulator/buildSrc/src/main/kotlin/dokka-convention.gradle.kts deleted file mode 100644 index 95183df2..00000000 --- a/simulator/buildSrc/src/main/kotlin/dokka-convention.gradle.kts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.dokka.gradle.DokkaTask - -plugins { - id("org.jetbrains.dokka") -} - -tasks.getting(DokkaTask::class) { - outputFormat = "html" -} diff --git a/simulator/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts new file mode 100644 index 00000000..95183df2 --- /dev/null +++ b/simulator/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts @@ -0,0 +1,33 @@ +/* + * 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.dokka.gradle.DokkaTask + +plugins { + id("org.jetbrains.dokka") +} + +tasks.getting(DokkaTask::class) { + outputFormat = "html" +} diff --git a/simulator/buildSrc/src/main/kotlin/jacoco-convention.gradle.kts b/simulator/buildSrc/src/main/kotlin/jacoco-convention.gradle.kts deleted file mode 100644 index 544e34bf..00000000 --- a/simulator/buildSrc/src/main/kotlin/jacoco-convention.gradle.kts +++ /dev/null @@ -1,58 +0,0 @@ -import org.gradle.kotlin.dsl.`java-library` -import org.gradle.kotlin.dsl.jacoco -import org.gradle.kotlin.dsl.kotlin - -/* - * 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. - */ - -/* - * 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. - */ - -plugins { - `java-library` - jacoco -} - -tasks.jacocoTestReport { - reports { - html.isEnabled = true - } -} diff --git a/simulator/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts new file mode 100644 index 00000000..544e34bf --- /dev/null +++ b/simulator/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts @@ -0,0 +1,58 @@ +import org.gradle.kotlin.dsl.`java-library` +import org.gradle.kotlin.dsl.jacoco +import org.gradle.kotlin.dsl.kotlin + +/* + * 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. + */ + +/* + * 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. + */ + +plugins { + `java-library` + jacoco +} + +tasks.jacocoTestReport { + reports { + html.isEnabled = true + } +} diff --git a/simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts b/simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts deleted file mode 100644 index 405235f0..00000000 --- a/simulator/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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" -} - -tasks.test { - useJUnitPlatform() - reports.html.isEnabled = true -} 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" +} diff --git a/simulator/buildSrc/src/main/kotlin/library.kt b/simulator/buildSrc/src/main/kotlin/library.kt deleted file mode 100644 index a66e5f46..00000000 --- a/simulator/buildSrc/src/main/kotlin/library.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -/** - * This object contains the versions of the dependencies shared by the different - * subprojects. - */ -object Library { - /** - * The library for testing the projects. - */ - val JUNIT_JUPITER = "5.7.1" - - /** - * The library for hosting the tests. - */ - val JUNIT_PLATFORM = "1.7.1" - - /** - * Logging facade. - */ - val SLF4J = "1.7.30" - - /** - * Kotlin coroutines support - */ - val KOTLINX_COROUTINES = "1.4.2" -} diff --git a/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts new file mode 100644 index 00000000..5a19bfe0 --- /dev/null +++ b/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts @@ -0,0 +1,38 @@ +import org.gradle.kotlin.dsl.`java-library` +import org.gradle.kotlin.dsl.kotlin +import org.gradle.platform.base.Library + +/* + * 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. + */ + +plugins { + `java-library` +} + +tasks.test { + useJUnitPlatform() +} + +dependencies { + testImplementation("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT_JUPITER}") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT_JUPITER}") +} diff --git a/simulator/opendc-compute/opendc-compute-core/build.gradle.kts b/simulator/opendc-compute/opendc-compute-core/build.gradle.kts index 35a737f0..39a146ab 100644 --- a/simulator/opendc-compute/opendc-compute-core/build.gradle.kts +++ b/simulator/opendc-compute/opendc-compute-core/build.gradle.kts @@ -24,7 +24,7 @@ description = "Core implementation of the OpenDC Compute service" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` } dependencies { @@ -32,10 +32,4 @@ dependencies { api(project(":opendc-trace:opendc-trace-core")) implementation(project(":opendc-utils")) implementation("io.github.microutils:kotlin-logging:1.7.9") - - testImplementation(project(":opendc-simulator:opendc-simulator-core")) - testImplementation(project(":opendc-compute:opendc-compute-simulator")) - testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}") - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") } diff --git a/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts index 0e0fba60..606223c6 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts +++ b/simulator/opendc-compute/opendc-compute-simulator/build.gradle.kts @@ -24,7 +24,8 @@ description = "Simulator for OpenDC Compute" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` + `testing-conventions` } dependencies { @@ -35,7 +36,5 @@ dependencies { implementation("io.github.microutils:kotlin-logging:1.7.9") testImplementation(project(":opendc-simulator:opendc-simulator-core")) - testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}") - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") + testRuntimeOnly("org.slf4j:slf4j-simple:${Versions.SLF4J}") } diff --git a/simulator/opendc-core/build.gradle.kts b/simulator/opendc-core/build.gradle.kts index 81592831..5e189fb5 100644 --- a/simulator/opendc-core/build.gradle.kts +++ b/simulator/opendc-core/build.gradle.kts @@ -24,12 +24,9 @@ description = "Base model for datacenter simulation" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}") - - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") } diff --git a/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts b/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts index 2d5e018b..f02d1e38 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts +++ b/simulator/opendc-experiments/opendc-experiments-sc18/build.gradle.kts @@ -24,7 +24,7 @@ description = "Experiments for the TPDS paper" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` application } @@ -43,7 +43,4 @@ dependencies { exclude("org.jetbrains.kotlin", module = "kotlin-reflect") } implementation(kotlin("reflect")) - - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") } diff --git a/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts index 8fac6524..271852b3 100644 --- a/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts +++ b/simulator/opendc-experiments/opendc-experiments-sc20/build.gradle.kts @@ -24,7 +24,8 @@ description = "Experiments for the SC20 paper" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` + `testing-conventions` application } @@ -51,7 +52,4 @@ dependencies { exclude(group = "org.slf4j", module = "slf4j-log4j12") exclude(group = "log4j") } - - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") } diff --git a/simulator/opendc-format/build.gradle.kts b/simulator/opendc-format/build.gradle.kts index dccc4374..6902425a 100644 --- a/simulator/opendc-format/build.gradle.kts +++ b/simulator/opendc-format/build.gradle.kts @@ -24,7 +24,8 @@ description = "Library for reading common data formats for topology simulation" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` + `testing-conventions` } dependencies { @@ -43,7 +44,4 @@ dependencies { exclude(group = "org.slf4j", module = "slf4j-log4j12") exclude(group = "log4j") } - - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") } diff --git a/simulator/opendc-harness/build.gradle.kts b/simulator/opendc-harness/build.gradle.kts index 359d2384..fd692237 100644 --- a/simulator/opendc-harness/build.gradle.kts +++ b/simulator/opendc-harness/build.gradle.kts @@ -24,24 +24,22 @@ description = "Harness for defining repeatable experiments using OpenDC" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` + `testing-conventions` } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}") - api("org.junit.platform:junit-platform-commons:${Library.JUNIT_PLATFORM}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") + api("org.junit.platform:junit-platform-commons:${Versions.JUNIT_PLATFORM}") 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("com.github.ajalt.clikt:clikt:3.1.0") - api("org.junit.platform:junit-platform-engine:${Library.JUNIT_PLATFORM}") - api("org.junit.platform:junit-platform-suite-api:${Library.JUNIT_PLATFORM}") - api("org.junit.platform:junit-platform-launcher:${Library.JUNIT_PLATFORM}") + 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}") runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.14.0") - - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") } diff --git a/simulator/opendc-runner-web/build.gradle.kts b/simulator/opendc-runner-web/build.gradle.kts index 7ae3c641..de723bd9 100644 --- a/simulator/opendc-runner-web/build.gradle.kts +++ b/simulator/opendc-runner-web/build.gradle.kts @@ -24,7 +24,7 @@ description = "Experiment runner for OpenDC" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` application } diff --git a/simulator/opendc-simulator/opendc-simulator-compute/build.gradle.kts b/simulator/opendc-simulator/opendc-simulator-compute/build.gradle.kts index 1c50ed8d..7354cad6 100644 --- a/simulator/opendc-simulator/opendc-simulator-compute/build.gradle.kts +++ b/simulator/opendc-simulator/opendc-simulator-compute/build.gradle.kts @@ -23,13 +23,11 @@ description = "Library for simulation of cloud computing components" plugins { - `kotlin-library-convention` + `kotlin-library-conventions` + `testing-conventions` } dependencies { api(project(":opendc-simulator:opendc-simulator-core")) implementation(project(":opendc-utils")) - - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") } diff --git a/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts b/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts index a740dcf3..79d3463f 100644 --- a/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts +++ b/simulator/opendc-simulator/opendc-simulator-core/build.gradle.kts @@ -24,9 +24,9 @@ description = "Simulation-specific code for use in OpenDC" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Library.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.KOTLINX_COROUTINES}") } diff --git a/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts b/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts index 1c30506f..d2193c0d 100644 --- a/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts +++ b/simulator/opendc-simulator/opendc-simulator-failures/build.gradle.kts @@ -23,9 +23,9 @@ description = "Failure models for OpenDC" plugins { - `kotlin-library-convention` + `kotlin-library-conventions` } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") } diff --git a/simulator/opendc-trace/opendc-trace-core/build.gradle.kts b/simulator/opendc-trace/opendc-trace-core/build.gradle.kts index 3db6669a..96b79284 100644 --- a/simulator/opendc-trace/opendc-trace-core/build.gradle.kts +++ b/simulator/opendc-trace/opendc-trace-core/build.gradle.kts @@ -24,9 +24,9 @@ description = "Event tracing library for OpenDC" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") } diff --git a/simulator/opendc-utils/build.gradle.kts b/simulator/opendc-utils/build.gradle.kts index 14bf8ca7..0885b592 100644 --- a/simulator/opendc-utils/build.gradle.kts +++ b/simulator/opendc-utils/build.gradle.kts @@ -24,13 +24,12 @@ description = "Utilities used across OpenDC modules" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` + `testing-conventions` } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.KOTLINX_COROUTINES}") testImplementation(project(":opendc-simulator:opendc-simulator-core")) - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") } diff --git a/simulator/opendc-workflows/build.gradle.kts b/simulator/opendc-workflows/build.gradle.kts index f1ed7e62..dbd135a8 100644 --- a/simulator/opendc-workflows/build.gradle.kts +++ b/simulator/opendc-workflows/build.gradle.kts @@ -24,7 +24,8 @@ description = "Workflow service for OpenDC" /* Build configuration */ plugins { - `kotlin-library-convention` + `kotlin-library-conventions` + `testing-conventions` } dependencies { @@ -41,7 +42,5 @@ dependencies { exclude("org.jetbrains.kotlin", module = "kotlin-reflect") } testImplementation(kotlin("reflect")) - testRuntimeOnly("org.slf4j:slf4j-simple:${Library.SLF4J}") - testImplementation("org.junit.jupiter:junit-jupiter-api:${Library.JUNIT_JUPITER}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Library.JUNIT_JUPITER}") + testRuntimeOnly("org.slf4j:slf4j-simple:${Versions.SLF4J}") } -- cgit v1.2.3