diff options
Diffstat (limited to 'simulator/buildSrc/src/main/kotlin')
9 files changed, 0 insertions, 455 deletions
diff --git a/simulator/buildSrc/src/main/kotlin/ProjectExtensions.kt b/simulator/buildSrc/src/main/kotlin/ProjectExtensions.kt deleted file mode 100644 index ddf643f6..00000000 --- a/simulator/buildSrc/src/main/kotlin/ProjectExtensions.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 deleted file mode 100644 index 6aa9260b..00000000 --- a/simulator/buildSrc/src/main/kotlin/Versions.kt +++ /dev/null @@ -1,69 +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.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 class Versions(private val project: Project) { - /** - * A delegate for obtaining configuration values from a [Project] instance. - */ - private fun version(name: String? = null): ReadOnlyProperty<Versions, String> = - ReadOnlyProperty { _, property -> get(name ?: property.name) } - - val junitJupiter by version(name = "junit-jupiter") - val junitPlatform by version(name = "junit-platform") - val mockk by version() - - val slf4j by version() - val kotlinLogging by version(name = "kotlin-logging") - val log4j by version() - - val kotlinxCoroutines by version(name = "kotlinx-coroutines") - - val otelApi by version(name = "opentelemetry-api") - val otelApiMetrics by version(name = "opentelemetry-api-metrics") - val otelSdk by version(name = "opentelemetry-sdk") - val otelSdkMetrics by version(name = "opentelemetry-sdk-metrics") - - - /** - * Obtain the version for the specified [dependency][name]. - */ - 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/benchmark-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts deleted file mode 100644 index 8623e8da..00000000 --- a/simulator/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 kotlinx.benchmark.gradle.* -import org.jetbrains.kotlin.allopen.gradle.* - -plugins { - id("org.jetbrains.kotlinx.benchmark") - `java-library` - kotlin("plugin.allopen") -} - -sourceSets { - register("jmh") { - compileClasspath += sourceSets["main"].output - runtimeClasspath += sourceSets["main"].output - } -} - -configurations { - named("jmhImplementation") { - extendsFrom(configurations["implementation"]) - } -} - -configure<AllOpenExtension> { - annotation("org.openjdk.jmh.annotations.State") -} - -benchmark { - targets { - register("jmh") { - this as JvmBenchmarkTarget - jmhVersion = "1.21" - } - } -} - -// Workaround for https://github.com/Kotlin/kotlinx-benchmark/issues/39 -afterEvaluate { - tasks.named<org.gradle.jvm.tasks.Jar>("jmhBenchmarkJar") { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } -} - -dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime-jvm:0.3.0") -} diff --git a/simulator/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts deleted file mode 100644 index 91156cbf..00000000 --- a/simulator/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * MIT License - * - * 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.jetbrains.dokka.gradle.DokkaTask - -plugins { - id("org.jetbrains.dokka") -} - -tasks.getting(DokkaTask::class) { - outputFormat = "html" -} diff --git a/simulator/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts deleted file mode 100644 index 4745ff1a..00000000 --- a/simulator/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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` -} - -dependencies { - implementation(project(":opendc-harness")) -} - -tasks.register<Test>("experiment") { - // Ensure JUnit Platform is used for resolving tests - useJUnitPlatform() - - description = "Runs OpenDC experiments" - group = "application" - - testClassesDirs = sourceSets["main"].output.classesDirs - classpath = sourceSets["main"].runtimeClasspath -} diff --git a/simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts b/simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts deleted file mode 100644 index 3e8aa741..00000000 --- a/simulator/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts +++ /dev/null @@ -1,56 +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. - */ - - -plugins { - jacoco -} - -repositories { - mavenLocal() - mavenCentral() -} - -tasks.register<JacocoReport>("codeCoverageReport") { - group = "Coverage reports" - description = "Generates an aggregate report based on all subprojects" - - reports { - xml.isEnabled = true - xml.destination = file("${buildDir}/reports/jacoco/report.xml") - - html.isEnabled = true - } - - subprojects { - this@subprojects.plugins.withType<JacocoPlugin>().configureEach { - this@subprojects.tasks.matching { - it.extensions.findByType<JacocoTaskExtension>() != null } - .configureEach { - sourceSets(this@subprojects.the<SourceSetContainer>().named("main").get()) - executionData(this) - } - } - } -} diff --git a/simulator/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts deleted file mode 100644 index d0534d4f..00000000 --- a/simulator/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 - } -} - -/* Share sources folder with other projects for aggregated JaCoCo reports */ -configurations.create("transitiveSourcesElements") { - isVisible = false - isCanBeResolved = false - isCanBeConsumed = true - extendsFrom(configurations.implementation.get()) - attributes { - attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION)) - attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("source-folders")) - } - sourceSets.main.get().java.srcDirs.forEach { - outgoing.artifact(it) - } -} - -/* Share the coverage data to be aggregated for the whole product */ -configurations.create("coverageDataElements") { - isVisible = false - isCanBeResolved = false - isCanBeConsumed = true - extendsFrom(configurations.implementation.get()) - attributes { - attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION)) - attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("jacoco-coverage-data")) - } - // This will cause the test task to run if the coverage data is requested by the aggregation task - outgoing.artifact(tasks.test.map { task -> - task.extensions.getByType<JacocoTaskExtension>().destinationFile!! - }) -} diff --git a/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts b/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts deleted file mode 100644 index cf3f2569..00000000 --- a/simulator/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts +++ /dev/null @@ -1,50 +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() -} - -java { - sourceCompatibility = Versions.jvmTarget -} - -kotlin { - explicitApi() -} - -tasks.withType<KotlinCompile>().configureEach { - kotlinOptions.jvmTarget = Versions.jvmTarget.toString() - kotlinOptions.useIR = true - 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 deleted file mode 100644 index f129c282..00000000 --- a/simulator/buildSrc/src/main/kotlin/testing-conventions.gradle.kts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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() - - reports { - html.isEnabled = true - junitXml.isEnabled = true - } -} - -dependencies { - testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junitJupiter}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junitJupiter}") - testImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junitJupiter}") - testImplementation("io.mockk:mockk:${versions.mockk}") -} |
