summaryrefslogtreecommitdiff
path: root/buildSrc
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc')
-rw-r--r--buildSrc/build.gradle.kts46
-rw-r--r--buildSrc/settings.gradle.kts25
-rw-r--r--buildSrc/src/main/kotlin/ProjectExtensions.kt34
-rw-r--r--buildSrc/src/main/kotlin/Versions.kt69
-rw-r--r--buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts67
-rw-r--r--buildSrc/src/main/kotlin/dokka-conventions.gradle.kts33
-rw-r--r--buildSrc/src/main/kotlin/experiment-conventions.gradle.kts40
-rw-r--r--buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts56
-rw-r--r--buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts65
-rw-r--r--buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts50
-rw-r--r--buildSrc/src/main/kotlin/testing-conventions.gradle.kts41
11 files changed, 526 insertions, 0 deletions
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
new file mode 100644
index 00000000..dc115999
--- /dev/null
+++ b/buildSrc/build.gradle.kts
@@ -0,0 +1,46 @@
+/*
+ * 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 {
+ `kotlin-dsl`
+}
+
+/* Project configuration */
+repositories {
+ gradlePluginPortal()
+}
+
+dependencies {
+ implementation(kotlin("gradle-plugin", version = "1.4.31"))
+ implementation("org.jlleitschuh.gradle:ktlint-gradle:10.0.0")
+ implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1")
+ implementation("org.jetbrains.kotlin:kotlin-allopen:1.4.31")
+ implementation("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.3.0")
+}
+
+tasks.withType<KotlinCompile>().configureEach {
+ kotlinOptions {
+ allWarningsAsErrors = true
+ }
+}
diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts
new file mode 100644
index 00000000..5337ee96
--- /dev/null
+++ b/buildSrc/settings.gradle.kts
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+/* Intentionally left blank */
diff --git a/buildSrc/src/main/kotlin/ProjectExtensions.kt b/buildSrc/src/main/kotlin/ProjectExtensions.kt
new file mode 100644
index 00000000..ddf643f6
--- /dev/null
+++ b/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/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt
new file mode 100644
index 00000000..6aa9260b
--- /dev/null
+++ b/buildSrc/src/main/kotlin/Versions.kt
@@ -0,0 +1,69 @@
+/*
+ * 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/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts b/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
new file mode 100644
index 00000000..8623e8da
--- /dev/null
+++ b/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
@@ -0,0 +1,67 @@
+/*
+ * 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/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts b/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts
new file mode 100644
index 00000000..91156cbf
--- /dev/null
+++ b/buildSrc/src/main/kotlin/dokka-conventions.gradle.kts
@@ -0,0 +1,33 @@
+/*
+ * 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/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts
new file mode 100644
index 00000000..4745ff1a
--- /dev/null
+++ b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts
@@ -0,0 +1,40 @@
+/*
+ * 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/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
new file mode 100644
index 00000000..3e8aa741
--- /dev/null
+++ b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
@@ -0,0 +1,56 @@
+/*
+ * 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/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts b/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
new file mode 100644
index 00000000..d0534d4f
--- /dev/null
+++ b/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
@@ -0,0 +1,65 @@
+/*
+ * 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/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts
new file mode 100644
index 00000000..cf3f2569
--- /dev/null
+++ b/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()
+}
+
+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/buildSrc/src/main/kotlin/testing-conventions.gradle.kts b/buildSrc/src/main/kotlin/testing-conventions.gradle.kts
new file mode 100644
index 00000000..f129c282
--- /dev/null
+++ b/buildSrc/src/main/kotlin/testing-conventions.gradle.kts
@@ -0,0 +1,41 @@
+/*
+ * 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}")
+}