From d25d413415b2c429febe14fd2c34d06fd02615b5 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 7 Mar 2022 11:55:08 +0100 Subject: build: Move build dependencies into version catalog This change moves build dependencies used by Gradle into the version catalog to ensure a single location for all dependency versions. --- buildSrc/build.gradle.kts | 13 +++++++------ buildSrc/settings.gradle.kts | 10 +++++++++- buildSrc/src/main/kotlin/Libs.kt | 10 +--------- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'buildSrc') diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 760f0cab..1b24b44b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -31,10 +31,11 @@ repositories { } dependencies { - implementation(kotlin("gradle-plugin", version = "1.6.10")) - implementation("org.jlleitschuh.gradle:ktlint-gradle:10.2.1") - implementation("org.jetbrains.kotlin:kotlin-allopen:1.6.10") - implementation("me.champeau.jmh:jmh-gradle-plugin:0.6.6") - implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.6.10") - implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") + implementation(libs.kotlin.gradle) + implementation(libs.kotlin.allopen) + implementation(libs.kotlin.noarg) + implementation(libs.ktlint.gradle) + implementation(libs.jmh.gradle) + implementation(libs.dokka.gradle) + implementation(libs.shadow) } diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index c9f9ab38..746d38f1 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -20,4 +20,12 @@ * SOFTWARE. */ -/* Intentionally left blank */ +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index f538b1ad..6a73e1b9 100644 --- a/buildSrc/src/main/kotlin/Libs.kt +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -26,31 +26,23 @@ import org.gradle.api.JavaVersion import org.gradle.api.Project import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.kotlin.dsl.getByType -import kotlin.properties.ReadOnlyProperty /** * This class makes the version catalog accessible for the build scripts until Gradle adds support for it. * * See https://github.com/gradle/gradle/issues/15383 */ -@Suppress("UnstableApiUsage") public class Libs(project: Project) { /** * The version catalog of the project. */ private val versionCatalog = project.extensions.getByType(VersionCatalogsExtension::class).named("libs") - /** - * A delegate for obtaining configuration values from a [Project] instance. - */ - private fun lib(name: String? = null): ReadOnlyProperty = - ReadOnlyProperty { _, property -> get(name ?: property.name) } - /** * Obtain the version for the specified [dependency][name]. */ operator fun get(name: String): String { - val dep = versionCatalog.findDependency(name).get().get() + val dep = versionCatalog.findLibrary(name).get().get() return "${dep.module.group}:${dep.module.name}:${dep.versionConstraint.displayName}" } -- cgit v1.2.3 From 8f958c5a578dc11b890c96c0dc48e3e3f92a4d07 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 7 Mar 2022 22:21:25 +0100 Subject: feat(web/proto): Design unified communication protocol This change adds a unified communication protocol in form of the module opendc-web-proto which contains the classes that form the communication protocol of OpenDC's API v2. By having the protocol in a separate module, we can utilize the classes in both server and client. --- buildSrc/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'buildSrc') diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 1b24b44b..c2144d00 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -38,4 +38,6 @@ dependencies { implementation(libs.jmh.gradle) implementation(libs.dokka.gradle) implementation(libs.shadow) + + implementation(libs.jandex.gradle) } -- cgit v1.2.3 From f0c472b1792779e63fdeb97a470b46300de00050 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 26 Oct 2021 16:19:55 +0200 Subject: feat(web/api): Initial API implementation in Kotlin This change adds the initial implementation of the new API server in Kotlin, replacing the old API written in Python. The implementation uses Quarkus, RESTEasy, and Hibernate to implement the new API endpoints. The reason for replacing the old API server is unifying the build and deployment toolchains, reducing the number of technologies necessary to work with OpenDC. Furthermore, we envision bundling the entire OpenDC project into a single distributions, allowing users to launch their own deployment trivially. --- buildSrc/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) (limited to 'buildSrc') diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index c2144d00..d62ade8c 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -40,4 +40,5 @@ dependencies { implementation(libs.shadow) implementation(libs.jandex.gradle) + implementation(libs.quarkus.gradle) } -- cgit v1.2.3 From 527ae2230f5c2dd22f496f45d5d8e3bd4acdb854 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 4 Apr 2022 16:10:32 +0200 Subject: ci: Fix JaCoCo report aggregation This change updates the build script to fix the aggregation step for the JaCoCo coverage reports that are submitted to Codecov. Previously, not all modules were properly included in the report. --- .../src/main/kotlin/jacoco-aggregation.gradle.kts | 34 ++++++++++------------ 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'buildSrc') diff --git a/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts index 5afd3e0d..7ae42cd2 100644 --- a/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts +++ b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts @@ -22,7 +22,8 @@ plugins { - jacoco + base + id("jacoco-report-aggregation") } repositories { @@ -30,25 +31,20 @@ repositories { mavenCentral() } -tasks.register("codeCoverageReport") { - group = "Coverage reports" - description = "Generates an aggregate report based on all subprojects" - - reports { - xml.required.set(true) - xml.outputLocation.set(file("${buildDir}/reports/jacoco/report.xml")) - - html.required.set(true) - } - +dependencies { subprojects { - this@subprojects.plugins.withType().configureEach { - this@subprojects.tasks.matching { - it.extensions.findByType() != null } - .configureEach { - sourceSets(this@subprojects.the().named("main").get()) - executionData(this) - } + plugins.withType().configureEach { + jacocoAggregation(this@subprojects) } + } } + +@Suppress("UnstableApiUsage") +val codeCoverageReport by reporting.reports.creating(JacocoCoverageReport::class) { + testType.set(TestSuiteType.UNIT_TEST) +} + +tasks.check { + dependsOn(codeCoverageReport.reportTask) +} -- cgit v1.2.3