From 4a8b32d288ba3ee986ecef7933fa77554d34e762 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 4 May 2021 19:19:47 +0200 Subject: harness: Split harness into separate modules This change splits the OpenDC Experiment Harness into separate modules. This prevents users from pulling in unnecessary dependencies when depending on the harness API. --- buildSrc/src/main/kotlin/experiment-conventions.gradle.kts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'buildSrc/src/main') diff --git a/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts index 4745ff1a..ae256a62 100644 --- a/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts @@ -25,7 +25,8 @@ plugins { } dependencies { - implementation(project(":opendc-harness")) + implementation(project(":opendc-harness:opendc-harness-engine")) + runtimeOnly(project(":opendc-harness:opendc-harness-junit5")) } tasks.register("experiment") { -- cgit v1.2.3 From ad65a05e3f41850807f95f7d643496a4d39a6197 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 4 May 2021 21:43:46 +0200 Subject: exp: Add support for experiment configuration This change adds support for configuring the experiments via configuration files using the TypeSafe config library. In the future, we will also integrate support for configuration into the harness. --- buildSrc/src/main/kotlin/Versions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'buildSrc/src/main') 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") -- cgit v1.2.3 From 54edc2d5e92d8c117e116a8c507442e49d17e24e Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 5 May 2021 11:55:30 +0200 Subject: exp: Include experiments in main distribution This change updates the Gradle configuration to include experiments in the main distribution of OpenDC. Users can directly execute the experiments from the command-line without having to recompile the entire code-base. --- .../kotlin/distribution-conventions.gradle.kts | 17 ++++++++++++++--- .../main/kotlin/experiment-conventions.gradle.kts | 22 +++++++++++++++++++++- 2 files changed, 35 insertions(+), 4 deletions(-) (limited to 'buildSrc/src/main') 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()["main"] } - .forEach { with(it.contents) } + .map { it.project.name to it.project.the() } + .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("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")) + } +} -- cgit v1.2.3