Always fork the java compiler

dev/0.11
modmuss50 2021-06-13 11:23:46 +01:00
parent 8d2e8c5948
commit 0cfa88f73b
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.bundling.AbstractArchiveTask; import org.gradle.api.tasks.bundling.AbstractArchiveTask;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc; import org.gradle.api.tasks.javadoc.Javadoc;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
@ -104,6 +105,11 @@ public final class CompileConfiguration {
Javadoc javadoc = (Javadoc) p.getTasks().getByName(JavaPlugin.JAVADOC_TASK_NAME); Javadoc javadoc = (Javadoc) p.getTasks().getByName(JavaPlugin.JAVADOC_TASK_NAME);
javadoc.setClasspath(main.getOutput().plus(main.getCompileClasspath())); javadoc.setClasspath(main.getOutput().plus(main.getCompileClasspath()));
p.getTasks().withType(JavaCompile.class).configureEach(compile -> {
// Fork the java compiler to ensure that it does not keep any files open.
compile.getOptions().setFork(true);
});
p.afterEvaluate(project -> { p.afterEvaluate(project -> {
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);