|
|
@ -16,7 +16,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.build.toolchain;
|
|
|
|
package org.springframework.boot.build.toolchain;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
@ -58,8 +57,7 @@ public class ToolchainPlugin implements Plugin<Project> {
|
|
|
|
JavaToolchainSpec toolchainSpec = project.getExtensions().getByType(JavaPluginExtension.class)
|
|
|
|
JavaToolchainSpec toolchainSpec = project.getExtensions().getByType(JavaPluginExtension.class)
|
|
|
|
.getToolchain();
|
|
|
|
.getToolchain();
|
|
|
|
toolchainSpec.getLanguageVersion().set(toolchain.getJavaVersion());
|
|
|
|
toolchainSpec.getLanguageVersion().set(toolchain.getJavaVersion());
|
|
|
|
configureJavaCompileToolchain(project, toolchain);
|
|
|
|
configureTestToolchain(project);
|
|
|
|
configureTestToolchain(project, toolchain);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -75,16 +73,7 @@ public class ToolchainPlugin implements Plugin<Project> {
|
|
|
|
project.getTasks().withType(GradleBuild.class, (task) -> task.setEnabled(false));
|
|
|
|
project.getTasks().withType(GradleBuild.class, (task) -> task.setEnabled(false));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void configureJavaCompileToolchain(Project project, ToolchainExtension toolchain) {
|
|
|
|
private void configureTestToolchain(Project project) {
|
|
|
|
project.getTasks().withType(JavaCompile.class, (compile) -> {
|
|
|
|
|
|
|
|
compile.getOptions().setFork(true);
|
|
|
|
|
|
|
|
// See https://github.com/gradle/gradle/issues/15538
|
|
|
|
|
|
|
|
List<String> forkArgs = Arrays.asList("--add-opens", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED");
|
|
|
|
|
|
|
|
compile.getOptions().getForkOptions().getJvmArgs().addAll(forkArgs);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void configureTestToolchain(Project project, ToolchainExtension toolchain) {
|
|
|
|
|
|
|
|
project.getTasks().withType(Test.class, (test) -> {
|
|
|
|
project.getTasks().withType(Test.class, (test) -> {
|
|
|
|
List<String> arguments = Collections.singletonList("--illegal-access=warn");
|
|
|
|
List<String> arguments = Collections.singletonList("--illegal-access=warn");
|
|
|
|
test.jvmArgs(arguments);
|
|
|
|
test.jvmArgs(arguments);
|
|
|
|