Skip to content

Commit c709cb4

Browse files
committed
fix: Revert muzzle plugin checks
1 parent ebca4dd commit c709cb4

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

buildSrc/src/main/groovy/MuzzlePlugin.groovy

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -722,14 +722,23 @@ abstract class MuzzleTask extends DefaultTask {
722722
MuzzleDirective muzzleDirective = null
723723
) {
724724
def workQueue
725-
String javaVersion = muzzleDirective?.javaVersion ?: "8"
726-
def javaLauncher = javaToolchainService.launcherFor { spec ->
727-
spec.languageVersion.set(JavaLanguageVersion.of(javaVersion))
728-
}.get()
729-
workQueue = workerExecutor.processIsolation { spec ->
730-
spec.forkOptions { fork ->
731-
fork.executable = javaLauncher.executablePath
725+
String javaVersion = muzzleDirective?.javaVersion
726+
if (javaVersion) {
727+
def javaLauncher = javaToolchainService.launcherFor { spec ->
728+
spec.languageVersion.set(JavaLanguageVersion.of(javaVersion))
729+
}.get()
730+
// Note process isolation leaks gradle dependencies to the child process
731+
// and may need additional code on muzzle plugin to filter those out
732+
// See https://github.com/gradle/gradle/issues/33987
733+
workQueue = workerExecutor.processIsolation { spec ->
734+
spec.forkOptions { fork ->
735+
fork.executable = javaLauncher.executablePath
736+
}
732737
}
738+
} else {
739+
// noIsolation worker is OK for muzzle tasks as their checks will inspect classes outline
740+
// and should not be impacted by the actual running JDK.
741+
workQueue = workerExecutor.noIsolation()
733742
}
734743
workQueue.submit(MuzzleAction.class, parameters -> {
735744
parameters.buildStartedTime.set(invocationDetails.buildStartedTime)

0 commit comments

Comments
 (0)