Skip to content

Commit

Permalink
Use javaTargetVersion in (hopefully) all relevant places
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed Nov 12, 2023
1 parent 5864532 commit 2b35f5d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ matrix.addAxis({
'8',
'11',
'17',
'21 ',
'21',
]
});

Expand Down Expand Up @@ -112,7 +112,7 @@ include.forEach(v => {
let gradleArgs = [
`-Duser.country=${v.locale.country}`,
`-Duser.language=${v.locale.language}`,
`-DjavaVersion=${v.java_version}`,
`-DjavaTargetVersion=${v.java_version}`,
];
v.extraGradleArgs = gradleArgs.join(' ');
});
Expand All @@ -122,7 +122,6 @@ include.forEach(v => {
// Pass locale via _JAVA_OPTIONS so all the forked processes inherit it
jvmArgs.push(`-Duser.country=${v.locale.country}`);
jvmArgs.push(`-Duser.language=${v.locale.language}`);
//jvmArgs.push(`-DjavaVersion=${v.java_version}`); // Is that necessary?
if (v.jit === 'hotspot' && Math.random() > 0.5) {
// The following options randomize instruction selection in JIT compiler
// so it might reveal missing synchronization in TestNG code
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/groovy/jqwik.common-configuration.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ publishing {
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.toVersion("${javaVersion}")
targetCompatibility = JavaVersion.toVersion("${javaVersion}")
sourceCompatibility = JavaVersion.toVersion("${javaTargetVersion}")
targetCompatibility = JavaVersion.toVersion("${javaTargetVersion}")
}

tasks.withType(JavaCompile) {
Expand Down
7 changes: 4 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ static def showStandardStreams() {
propSSS == null ? false : propSSS == "true"
}

static def javaVersion() {
def propJV = System.getProperty("javaVersion")
static def javaTargetVersion() {
// 1.8 is default, because that's currently jqwik's minimum supported version
def propJV = System.getProperty("javaTargetVersion")
propJV = propJV == '8' ? '1.8' : propJV
propJV = propJV == null ? '1.8' : propJV
propJV
Expand All @@ -48,5 +49,5 @@ ext {
jqwikVersion = '1.8.2-SNAPSHOT'
isSnapshotRelease = isSnapshotRelease(jqwikVersion)
showStandardStreams = showStandardStreams()
javaVersion = javaVersion()
javaTargetVersion = javaTargetVersion()
}
2 changes: 1 addition & 1 deletion documentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
"-Xjsr305=under-migration:strict",
"-Xemit-jvm-type-annotations" // Required for annotations on type variables
]
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "${javaTargetVersion}"
kotlinOptions.javaParameters = true
}

Expand Down
2 changes: 1 addition & 1 deletion documentation/src/docs/include/kotlin-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ tasks.withType<Test>().configureEach {
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xjsr305=strict", // Required for strict interpretation of
"-Xjsr305=strict", // For strict type warnings
"-Xemit-jvm-type-annotations" // Required for annotations on type variables
)
jvmTarget = "11" // 1.8 or above
Expand Down
2 changes: 1 addition & 1 deletion kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
// "-Xjsr305=under-migration:strict", // @UnderMigration not used in jqwik
"-Xemit-jvm-type-annotations" // Required for annotations on type variables
]
kotlinOptions.jvmTarget = "${javaVersion}"
kotlinOptions.jvmTarget = "${javaTargetVersion}"
kotlinOptions.javaParameters = true // Required to get correct parameter names in reporting
}

Expand Down
7 changes: 5 additions & 2 deletions test-modular-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

def localJavaTarget = "${javaTargetVersion}" == "1.8" ? JavaVersion.VERSION_1_9
: JavaVersion.toVersion("${javaTargetVersion}")

java {
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
sourceCompatibility = localJavaTarget
targetCompatibility = localJavaTarget

modularity.inferModulePath = true
}
Expand Down

0 comments on commit 2b35f5d

Please sign in to comment.