File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff 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)
You can’t perform that action at this time.
0 commit comments