diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-05 12:23:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-05 12:23:25 +0200 |
| commit | e1d892bcbaa7e8361c150f684ca6a0dc5e036a87 (patch) | |
| tree | 99742afbc3cd762ec527f5a6c7e31ee245ee0385 /buildSrc/src/main/kotlin | |
| parent | e021d46ab1601d0c3a00724358164483608f6297 (diff) | |
| parent | 7fdfe48439f33abec8aa63fc4ab36fd687d59a43 (diff) | |
harness: Improve OpenDC Experiment Harness (v1)
This pull request contains several improvements to the OpenDC Experiment Harness,
which aims to improve user-experience of users when re-running experiments in the repository.
* Split the harness into separate modules
* Add support for adding additional classpath entries when running experiments via the console
* Initial support for configuration of experiments using HOCON.
Diffstat (limited to 'buildSrc/src/main/kotlin')
| -rw-r--r-- | buildSrc/src/main/kotlin/Versions.kt | 2 | ||||
| -rw-r--r-- | buildSrc/src/main/kotlin/distribution-conventions.gradle.kts | 17 | ||||
| -rw-r--r-- | buildSrc/src/main/kotlin/experiment-conventions.gradle.kts | 23 |
3 files changed, 37 insertions, 5 deletions
diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 6aa9260b..bb187a40 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -26,7 +26,6 @@ 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 @@ -46,6 +45,7 @@ public class Versions(private val project: Project) { val slf4j by version() val kotlinLogging by version(name = "kotlin-logging") val log4j by version() + val config by version() val kotlinxCoroutines by version(name = "kotlinx-coroutines") 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 4745ff1a..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,12 @@ plugins { `java-library` + distribution + id("com.github.johnrengelman.shadow") } dependencies { - implementation(project(":opendc-harness")) + runtimeOnly(project(":opendc-harness:opendc-harness-junit5")) } tasks.register<Test>("experiment") { @@ -38,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")) + } +} |
