Skip to content

Commit dd8cebf

Browse files
smolabric3
authored andcommitted
build: Run instrument plugin with toolchain
# Conflicts: # buildSrc/src/main/groovy/MuzzlePlugin.groovy
1 parent aae4ae4 commit dd8cebf

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

buildSrc/src/main/groovy/InstrumentPlugin.groovy

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,16 @@ abstract class InstrumentTask extends DefaultTask {
152152
}
153153

154154
private workQueue() {
155-
if (this.javaVersion) {
156-
def javaLauncher = this.javaToolchainService.launcherFor { spec ->
157-
spec.languageVersion.set(JavaLanguageVersion.of(this.javaVersion))
158-
}.get()
159-
return this.workerExecutor.processIsolation { spec ->
160-
spec.forkOptions { fork ->
161-
fork.executable = javaLauncher.executablePath
162-
}
155+
if (!this.javaVersion) {
156+
this.javaVersion = "8"
157+
}
158+
def javaLauncher = this.javaToolchainService.launcherFor { spec ->
159+
spec.languageVersion.set(JavaLanguageVersion.of(this.javaVersion))
160+
}.get()
161+
return this.workerExecutor.processIsolation { spec ->
162+
spec.forkOptions { fork ->
163+
fork.executable = javaLauncher.executablePath
163164
}
164-
} else {
165-
return this.workerExecutor.noIsolation()
166165
}
167166
}
168167
}

buildSrc/src/main/kotlin/datadog/gradle/plugin/muzzle/MuzzleTask.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ abstract class MuzzleTask : DefaultTask() {
4040
val javaLauncher = javaToolchainService.launcherFor {
4141
languageVersion.set(JavaLanguageVersion.of(muzzleDirective.javaVersion!!))
4242
}.get()
43+
// Note process isolation leaks gradle dependencies to the child process
44+
// and may need additional code on muzzle plugin to filter those out
45+
// See https://github.com/gradle/gradle/issues/33987
4346
workerExecutor.processIsolation {
4447
forkOptions {
4548
executable(javaLauncher.executablePath)
4649
}
4750
}
4851
} else {
52+
// noIsolation worker is OK for muzzle tasks as their checks will inspect classes outline
53+
// and should not be impacted by the actual running JDK.
4954
workerExecutor.noIsolation()
5055
}
5156
workQueue.submit(MuzzleAction::class.java) {

0 commit comments

Comments
 (0)