Skip to content

Commit

Permalink
Extracted Kotlin build stuff into buildlogic.kotlin-library-conventio…
Browse files Browse the repository at this point in the history
…ns.gradle.kts
  • Loading branch information
jlink committed Dec 13, 2024
1 parent 46d3792 commit dce4801
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
apiguardian = "1.1.2"
junit-jupiter = "5.11.3"
assertJ = '3.26.3'
kotlin = '2.0.21'
#opentest4j = '1.3.0'
#archunit = '1.3.0'
#mockito = '5.14.2'

[libraries]
apiguardian = { module = "org.apiguardian:apiguardian-api", version.ref = "apiguardian" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertJ" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertJ" }
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
4 changes: 4 additions & 0 deletions gradle/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ plugins {
repositories {
gradlePluginPortal()
}

dependencies {
implementation(libs.kotlin.gradlePlugin)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
java
`java-library`
id("buildlogic.publish-library")
id("kotlin")
}

repositories {
Expand Down Expand Up @@ -31,3 +35,22 @@ tasks.named<Test>("test") {

testLogging.showStandardStreams = true
}

val javaVersion: String = System.getProperty("matrix.version") ?: "21"

val kotlinCompilerArgs = listOf(
"[email protected]:strict",
"-Xemit-jvm-type-annotations" // Required for annotations on type variables
)

tasks.withType<KotlinCompile> {
compilerOptions {
freeCompilerArgs.set(kotlinCompilerArgs)
javaParameters = true // Required to get correct parameter names in reporting
jvmTarget = JvmTarget.fromTarget(javaVersion)
}
}

kotlin {
jvmToolchain(21)
}
6 changes: 1 addition & 5 deletions kotlin-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id("buildlogic.kotlin-library-conventions")
kotlin("jvm") version "2.0.21"
}

description = "Jqwik2 Kotlin core support"
Expand All @@ -9,16 +8,13 @@ val artifactName = "jqwik2-kotlin-core"

dependencies {
api(libs.apiguardian)
implementation(libs.kotlin.stdlib)
implementation(project(":core"))

testImplementation(libs.junit.jupiter)
testImplementation(libs.assertj.core)
}

kotlin {
jvmToolchain(21)
}

tasks.jar {
archiveBaseName.set(artifactName)
archiveVersion.set("${rootProject.extra.get("jqwik2Version")}")
Expand Down

0 comments on commit dce4801

Please sign in to comment.