summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildSrc/build.gradle.kts2
-rw-r--r--buildSrc/src/main/kotlin/distribution-conventions.gradle.kts17
-rw-r--r--buildSrc/src/main/kotlin/experiment-conventions.gradle.kts22
3 files changed, 36 insertions, 5 deletions
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 94d6b19d..73c4fdf8 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -39,10 +39,10 @@ repositories {
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")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32")
+ implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0")
}
tasks.withType<KotlinCompile>().configureEach {
diff --git a/buildSrc/src/main/kotlin/distribution-conventions.gradle.kts b/buildSrc/src/main/kotlin/distribution-conventions.gradle.kts
index a0b7593d..57e5b284 100644
--- a/buildSrc/src/main/kotlin/distribution-conventions.gradle.kts
+++ b/buildSrc/src/main/kotlin/distribution-conventions.gradle.kts
@@ -39,12 +39,23 @@ distributions {
from("README.md")
from("LICENSE.txt")
+ from("docs") { into("docs") }
- // Include the distributions of the sub project.
+ // Include distributions of the subprojects
getTasksByName("assembleDist", true)
.filter { it.project != project }
- .map { it.project.the<DistributionContainer>()["main"] }
- .forEach { with(it.contents) }
+ .map { it.project.name to it.project.the<DistributionContainer>() }
+ .forEach { (name, dist) ->
+ dist.findByName("main")?.let { with(it.contents) }
+
+ // Include experiments if they exist
+ val experiment = dist.findByName("experiment")
+ if (experiment != null) {
+ into("experiments/${name.removePrefix("opendc-experiments-")}") {
+ with(experiment.contents)
+ }
+ }
+ }
}
}
}
diff --git a/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts
index ae256a62..580f67cb 100644
--- a/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts
+++ b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts
@@ -1,3 +1,5 @@
+import gradle.kotlin.dsl.accessors._9bf86420fccbde1948375f641de89b70.sourceSets
+
/*
* Copyright (c) 2021 AtLarge Research
*
@@ -22,10 +24,11 @@
plugins {
`java-library`
+ distribution
+ id("com.github.johnrengelman.shadow")
}
dependencies {
- implementation(project(":opendc-harness:opendc-harness-engine"))
runtimeOnly(project(":opendc-harness:opendc-harness-junit5"))
}
@@ -39,3 +42,20 @@ tasks.register<Test>("experiment") {
testClassesDirs = sourceSets["main"].output.classesDirs
classpath = sourceSets["main"].runtimeClasspath
}
+
+distributions {
+ create("experiment") {
+ contents {
+ from("README.md")
+ from(tasks.shadowJar.get())
+ }
+ }
+}
+
+tasks.shadowJar {
+ dependencies {
+ // Do not include the JUnit 5 runner in the final shadow jar, since it is only necessary for development
+ // inside IDE
+ exclude(project(":opendc-harness:opendc-harness-junit5"))
+ }
+}