-
Notifications
You must be signed in to change notification settings - Fork 312
Use JDK 8 explicitly as toolchain #8883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
081c771
7e0aa11
53fa92b
fc1a41c
5e7ffc4
b2e8d4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -715,18 +715,14 @@ abstract class MuzzleTask extends DefaultTask { | |
Project instrumentationProject, | ||
MuzzleDirective muzzleDirective = null) { | ||
def workQueue | ||
String javaVersion = muzzleDirective?.javaVersion | ||
if (javaVersion) { | ||
def javaLauncher = javaToolchainService.launcherFor { spec -> | ||
spec.languageVersion.set(JavaLanguageVersion.of(javaVersion)) | ||
}.get() | ||
workQueue = workerExecutor.processIsolation { spec -> | ||
spec.forkOptions { fork -> | ||
fork.executable = javaLauncher.executablePath | ||
} | ||
String javaVersion = muzzleDirective?.javaVersion ?: "8" | ||
def javaLauncher = javaToolchainService.launcherFor { spec -> | ||
spec.languageVersion.set(JavaLanguageVersion.of(javaVersion)) | ||
}.get() | ||
workQueue = workerExecutor.processIsolation { spec -> | ||
spec.forkOptions { fork -> | ||
fork.executable = javaLauncher.executablePath | ||
} | ||
} else { | ||
workQueue = workerExecutor.noIsolation() | ||
Comment on lines
+722
to
-729
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: After some diving, the Among them httpclient 4.5.13, which may explains why some muzzle tests (like This does not happen when the work queue executor We may want to improve the situation there, as it renders the tests brittle even if they appear to rightfully pass. For this PR, which is about decoupling the JDK running gradle from the target JDK (8 at this time), we may possibly run this in the JVM that runs gradle because muzzle is about detecting whether a dependency is still covered by an instrumentation and as such tries to detect types / "outlines". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, here's how to debug,
|
||
} | ||
workQueue.submit(MuzzleAction.class, parameters -> { | ||
parameters.buildStartedTime.set(invocationDetails.buildStartedTime) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,7 @@ tasks.register('extractLatestMuleServices', Sync) { | |
// build the mule application via maven | ||
tasks.register('mvnPackage', Exec) { | ||
workingDir "$appDir" | ||
environment.JAVA_HOME = System.getenv("JAVA_8_HOME") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Wouldn't be better to derive this env var from the toolchain API ? Same for the other similar changes. |
||
commandLine "$rootDir/mvnw", "-Ddatadog.builddir=$buildDir", "-Ddatadog.name=mule-test-application", "-Ddatadog.version=$version", 'package' | ||
outputs.dir("$buildDir/target") | ||
inputs.dir("$appDir/src") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,15 @@ import org.gradle.jvm.toolchain.internal.SpecificInstallationToolchainSpec | |
|
||
apply plugin: 'java-library' | ||
|
||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(8) | ||
} | ||
} | ||
|
||
apply from: "$rootDir/gradle/codenarc.gradle" | ||
apply from: "$rootDir/gradle/forbiddenapis.gradle" | ||
apply from: "$rootDir/gradle/spotless.gradle" | ||
|
@@ -34,17 +43,6 @@ if (applyCodeCoverage) { | |
apply from: "$rootDir/gradle/jacoco.gradle" | ||
} | ||
|
||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
// when building with Java 9+, lazily set compiler --release flag to match target | ||
def skipSettingCompilerRelease = project.findProperty('skipSettingCompilerRelease') | ||
if (!skipSettingCompilerRelease && JavaVersion.current().isJava9Compatible()) { | ||
compileJava.options.release = project.provider { | ||
JavaVersion.toVersion(targetCompatibility).majorVersion as Integer | ||
} | ||
} | ||
Comment on lines
-41
to
-46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: I'd suggest to keep this behavior via Possible the |
||
|
||
if (project.hasProperty('minJavaVersionForTests') && project.getProperty('minJavaVersionForTests') != JavaVersion.VERSION_1_7) { | ||
def version = JavaVersion.toVersion(project.getProperty('minJavaVersionForTests')) | ||
def name = "java$version.majorVersion" | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,22 +2,11 @@ plugins { | |||||
id 'me.champeau.jmh' | ||||||
} | ||||||
|
||||||
ext { | ||||||
// need access to sun.misc.SharedSecrets | ||||||
skipSettingCompilerRelease = true | ||||||
} | ||||||
|
||||||
// sun.misc.SharedSecrets is gone in later versions | ||||||
compileJava { | ||||||
javaCompiler = javaToolchains.compilerFor { | ||||||
languageVersion = JavaLanguageVersion.of(8) | ||||||
} | ||||||
} | ||||||
|
||||||
apply from: "$rootDir/gradle/java.gradle" | ||||||
apply from: "$rootDir/gradle/tries.gradle" | ||||||
|
||||||
tasks.compileTestJava.configure { | ||||||
tasks.withType(JavaCompile).configureEach { | ||||||
// need access to sun.misc.SharedSecrets | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion:
Suggested change
|
||||||
setJavaVersion(it, 8) | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Maybe extract
"8"
to some variable indicating the agent version.Another suggestion: wouldn't be better to set 8 as a default value in
MuzzleDirective.javaVersion
?