summaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/kotlin')
-rw-r--r--buildSrc/src/main/kotlin/dokka-convention.gradle.kts33
-rw-r--r--buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts50
-rw-r--r--buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts57
-rw-r--r--buildSrc/src/main/kotlin/library.kt44
4 files changed, 184 insertions, 0 deletions
diff --git a/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts
new file mode 100644
index 00000000..95183df2
--- /dev/null
+++ b/buildSrc/src/main/kotlin/dokka-convention.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/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
new file mode 100644
index 00000000..8c07fdea
--- /dev/null
+++ b/buildSrc/src/main/kotlin/jacoco-aggregation.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.
+ */
+
+
+plugins {
+ jacoco
+}
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+
+task<JacocoReport>("jacocoTestReport") {
+ group = "Coverage reports"
+ description = "Generates an aggregate report from all subprojects"
+
+ val jacocoReportTasks = subprojects.map { it.tasks.withType<JacocoReport>() }
+ dependsOn(jacocoReportTasks)
+ executionData(jacocoReportTasks)
+
+ subprojects.forEach { testedProject ->
+ val sourceSets = testedProject.convention.findPlugin(JavaPluginConvention::class)?.sourceSets ?: return@forEach
+
+ this@task.additionalSourceDirs.from(sourceSets["main"].allSource.srcDirs)
+ this@task.sourceDirectories.from(sourceSets["main"].allSource.srcDirs)
+ this@task.classDirectories.from(sourceSets["main"].output)
+ }
+}
diff --git a/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts b/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts
new file mode 100644
index 00000000..b27b12f5
--- /dev/null
+++ b/buildSrc/src/main/kotlin/kotlin-library-convention.gradle.kts
@@ -0,0 +1,57 @@
+/*
+ * 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")
+ jacoco
+}
+
+/* Project configuration */
+repositories {
+ jcenter()
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+}
+
+tasks.withType<KotlinCompile>().configureEach {
+ kotlinOptions.jvmTarget = "1.8"
+}
+
+tasks.test {
+ useJUnitPlatform()
+ reports.html.isEnabled = true
+}
+
+
+tasks.jacocoTestReport {
+ reports {
+ html.isEnabled = true
+ }
+}
diff --git a/buildSrc/src/main/kotlin/library.kt b/buildSrc/src/main/kotlin/library.kt
new file mode 100644
index 00000000..44355614
--- /dev/null
+++ b/buildSrc/src/main/kotlin/library.kt
@@ -0,0 +1,44 @@
+/*
+ * 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.5.2"
+
+ /**
+ * The library for hosting the tests.
+ */
+ val JUNIT_PLATFORM = "1.5.2"
+
+ /**
+ * Logging facade.
+ */
+ val SLF4J = "1.7.29"
+}