diff --git a/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts b/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts index eedd2d7..987f376 100644 --- a/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts +++ b/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts @@ -1,28 +1,18 @@ plugins { java -} - -repositories { - mavenCentral() - maven { - url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") - } -} - -dependencies { - testRuntimeOnly("org.junit.platform:junit-platform-launcher") + id("buildlogic.repositories") + id("buildlogic.use-junit-platform") } val javaVersion: String = System.getProperty("matrix.version") ?: "21" val javaVendor: String = System.getProperty("matrix.vendor") ?: "" -// println("Using Java version: $javaVersion - $javaVendor") - java { toolchain { languageVersion = JavaLanguageVersion.of(javaVersion) vendor = JvmVendorSpec.matching(javaVendor) } + // jqwik2 has Java 21 as its base version sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } @@ -34,21 +24,4 @@ tasks.withType { tasks.compileTestJava { // Enable source parameter names through reflection options.compilerArgs.add("-parameters") -} - -tasks.named("test") { - useJUnitPlatform { - includeEngines("junit-jupiter") - } - - include("**/*Example.class") - include("**/*Examples.class") - include("**/*Test.class") - include("**/*Tests.class") - - reports { - junitXml.required = true - } - - testLogging.showStandardStreams = true -} +} \ No newline at end of file diff --git a/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts b/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts index c07f92a..17e836d 100644 --- a/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts +++ b/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts @@ -2,50 +2,20 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -fun alias(alias: String): Provider { - return versionCatalogs.named("libs").findLibrary(alias).orElseThrow() -} - plugins { `java-library` id("buildlogic.publish-library") + id("buildlogic.repositories") + id("buildlogic.use-junit-platform") kotlin("jvm") kotlin("plugin.power-assert") } -repositories { - mavenCentral() - maven { - url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") - } -} - @OptIn(ExperimentalKotlinGradlePluginApi::class) powerAssert { functions = listOf("kotlin.assert", "kotlin.test.assertTrue", "kotlin.test.assertEquals", "kotlin.test.assertNull") } -dependencies { - testRuntimeOnly(alias("junit.platform.launcher")) -} - -tasks.named("test") { - useJUnitPlatform { - includeEngines("junit-jupiter") - } - - include("**/*Example.class") - include("**/*Examples.class") - include("**/*Test.class") - include("**/*Tests.class") - - reports { - junitXml.required = true - } - - testLogging.showStandardStreams = true -} - val kotlinCompilerArgs = listOf( "-Xnullability-annotations=@org.jspecify.annotations:strict", "-Xemit-jvm-type-annotations" // Required for annotations on type variables diff --git a/gradle/plugins/src/main/kotlin/buildlogic.repositories.gradle.kts b/gradle/plugins/src/main/kotlin/buildlogic.repositories.gradle.kts new file mode 100644 index 0000000..d57293e --- /dev/null +++ b/gradle/plugins/src/main/kotlin/buildlogic.repositories.gradle.kts @@ -0,0 +1,7 @@ +repositories { + mavenCentral() + maven { + url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") + } +} + diff --git a/gradle/plugins/src/main/kotlin/buildlogic.use-junit-platform.gradle.kts b/gradle/plugins/src/main/kotlin/buildlogic.use-junit-platform.gradle.kts new file mode 100644 index 0000000..13e6cb2 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/buildlogic.use-junit-platform.gradle.kts @@ -0,0 +1,28 @@ +plugins { + java +} + +fun alias(alias: String): Provider { + return versionCatalogs.named("libs").findLibrary(alias).orElseThrow() +} + +dependencies { + testRuntimeOnly(alias("junit.platform.launcher")) +} + +tasks.named("test") { + useJUnitPlatform { + includeEngines("junit-jupiter") + } + + include("**/*Example.class") + include("**/*Examples.class") + include("**/*Test.class") + include("**/*Tests.class") + + reports { + junitXml.required = true + } + + testLogging.showStandardStreams = true +}