diff options
author | Edoardo La Greca | 2025-08-18 21:09:11 +0200 |
---|---|---|
committer | Edoardo La Greca | 2025-08-18 21:09:11 +0200 |
commit | 7341ead2aade10ea1b833e94275277658741883a (patch) | |
tree | 46495f24c54278d50aa0da5046822fbe502f3f14 /buildSrc | |
parent | 1e50cf9c224d03896f176f3718ff80ef1659e9c2 (diff) |
switch to multi-module project structure
Diffstat (limited to 'buildSrc')
-rw-r--r-- | buildSrc/build.gradle.kts | 15 | ||||
-rw-r--r-- | buildSrc/settings.gradle.kts | 17 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts | 29 |
3 files changed, 61 insertions, 0 deletions
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..6f476b8 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + // The Kotlin DSL plugin provides a convenient way to develop convention plugins. + // Convention plugins are located in `src/main/kotlin`, with the file extension `.gradle.kts`, + // and are applied in the project's `build.gradle.kts` files as required. + `kotlin-dsl` +} + +kotlin { + jvmToolchain(21) +} + +dependencies { + // Add a dependency on the Kotlin Gradle plugin, so that convention plugins can apply it. + implementation(libs.kotlinGradlePlugin) +} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 0000000..705bfb5 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,17 @@ +dependencyResolutionManagement { + + // Use Maven Central and the Gradle Plugin Portal for resolving dependencies in the shared build logic (`buildSrc`) project. + @Suppress("UnstableApiUsage") + repositories { + mavenCentral() + } + + // Reuse the version catalog from the main build. + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} + +rootProject.name = "buildSrc"
\ No newline at end of file diff --git a/buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts b/buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts new file mode 100644 index 0000000..d11bbb9 --- /dev/null +++ b/buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts @@ -0,0 +1,29 @@ +// The code in this file is a convention plugin - a Gradle mechanism for sharing reusable build logic. +// `buildSrc` is a Gradle-recognized directory and every plugin there will be easily available in the rest of the build. +package buildsrc.convention + +import org.gradle.api.tasks.testing.logging.TestLogEvent + +plugins { + // Apply the Kotlin JVM plugin to add support for Kotlin in JVM projects. + kotlin("jvm") +} + +kotlin { + // Use a specific Java version to make it easier to work in different environments. + jvmToolchain(21) +} + +tasks.withType<Test>().configureEach { + // Configure all test Gradle tasks to use JUnitPlatform. + useJUnitPlatform() + + // Log information about all test results, not only the failed ones. + testLogging { + events( + TestLogEvent.FAILED, + TestLogEvent.PASSED, + TestLogEvent.SKIPPED + ) + } +} |