From 53fc836b1f64bb1c43bf2817a37be23acd6dc064 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Fri, 17 Jun 2022 14:41:44 +0100 Subject: [PATCH 1/2] Use service injection, reduce getProject() usage Improves configuration cache support --- .../gradle/common/tasks/ApplyBinPatches.java | 8 +++++++- .../gradle/common/tasks/ApplyMappings.java | 7 ++++++- .../gradle/common/tasks/ApplyRangeMap.java | 8 +++++++- .../gradle/common/tasks/ArchiveChecksum.java | 8 +++++++- .../gradle/common/tasks/DownloadAssets.java | 8 ++++---- .../gradle/common/tasks/DownloadMCMeta.java | 10 ++++++++-- .../gradle/common/tasks/DynamicJarExec.java | 8 +++++++- .../gradle/common/tasks/ExtractInheritance.java | 6 +++++- .../gradle/common/tasks/ExtractMCPData.java | 7 ++++++- .../gradle/common/tasks/ExtractRangeMap.java | 8 +++++++- .../gradle/common/tasks/JarExec.java | 8 ++++++-- .../gradle/mcp/tasks/DownloadMCPMappings.java | 7 ++++++- .../gradle/mcp/tasks/GenerateSRG.java | 13 +++++++++++-- .../minecraftforge/gradle/mcp/tasks/SetupMCP.java | 7 ++++++- .../gradle/patcher/tasks/CreateExc.java | 8 +++++++- .../gradle/patcher/tasks/CreateFakeSASPatches.java | 7 ++++++- .../gradle/patcher/tasks/FilterNewJar.java | 7 ++++++- .../gradle/patcher/tasks/GenerateBinPatches.java | 8 +++++++- .../gradle/patcher/tasks/GeneratePatches.java | 4 ++-- .../patcher/tasks/GenerateUserdevConfig.java | 6 +++++- .../gradle/userdev/tasks/ApplyMCPFunction.java | 7 ++++++- .../gradle/userdev/tasks/HackyJavaCompile.java | 11 +++++++++-- .../gradle/userdev/tasks/RenameJarInPlace.java | 14 ++++++++------ 23 files changed, 149 insertions(+), 36 deletions(-) diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyBinPatches.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyBinPatches.java index 85d878339..61b6159bf 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyBinPatches.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyBinPatches.java @@ -22,11 +22,14 @@ import net.minecraftforge.gradle.common.util.Utils; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.OutputFile; import com.google.common.collect.ImmutableMap; + +import javax.inject.Inject; import java.util.List; public abstract class ApplyBinPatches extends JarExec { @@ -34,7 +37,7 @@ public ApplyBinPatches() { getTool().set(Utils.BINPATCHER); getArgs().addAll("--clean", "{clean}", "--output", "{output}", "--apply", "{patch}"); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); } @Override @@ -45,6 +48,9 @@ protected List filterArgs(List args) { "{patch}", getPatch().get().getAsFile()), null); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFile public abstract RegularFileProperty getClean(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyMappings.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyMappings.java index 44bc1f17a..b9cf85e3e 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyMappings.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyMappings.java @@ -25,12 +25,14 @@ import org.apache.commons.io.IOUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.FileOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -42,7 +44,7 @@ public abstract class ApplyMappings extends DefaultTask { private boolean lambdas = true; public ApplyMappings() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(s -> s.file("output.zip"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(s -> s.file("output.zip"))); } @TaskAction @@ -69,6 +71,9 @@ public void apply() throws IOException { } } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFile public abstract RegularFileProperty getInput(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyRangeMap.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyRangeMap.java index c9c7cfb42..76b849219 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyRangeMap.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ApplyRangeMap.java @@ -23,6 +23,7 @@ import net.minecraftforge.gradle.common.util.Utils; import org.gradle.api.file.ConfigurableFileCollection; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFile; @@ -31,6 +32,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; + +import javax.inject.Inject; import java.util.List; public abstract class ApplyRangeMap extends JarExec { @@ -43,7 +46,7 @@ public ApplyRangeMap() { "--output", "{output}", "--keepImports", "{keepImports}"); setMinimumRuntimeJavaVersion(11); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.zip"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.zip"))); } @Override @@ -61,6 +64,9 @@ protected List filterArgs(List args) { ); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFiles public abstract ConfigurableFileCollection getSrgFiles(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ArchiveChecksum.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ArchiveChecksum.java index 0bed14953..c8901d4d1 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ArchiveChecksum.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ArchiveChecksum.java @@ -21,6 +21,7 @@ package net.minecraftforge.gradle.common.tasks; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.OutputFile; @@ -29,6 +30,8 @@ import com.google.common.collect.Maps; import com.google.common.hash.Hashing; import com.google.common.hash.HashingInputStream; + +import javax.inject.Inject; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileWriter; @@ -44,7 +47,7 @@ public abstract class ArchiveChecksum extends DefaultTask { //TODO: Filters of some kind? public ArchiveChecksum() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(s -> s.file("output.sha256"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(s -> s.file("output.sha256"))); } @TaskAction @@ -71,6 +74,9 @@ public void run() throws IOException { } } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFile public abstract RegularFileProperty getInput(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java index c755dda0d..41043d502 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java @@ -73,20 +73,20 @@ public void run() throws IOException, InterruptedException { try { File localFile = FileUtils.getFile(assetsPath + File.separator + asset.getPath()); if (localFile.exists()) { - getProject().getLogger().lifecycle("Copying local object: " + asset.getPath() + " Asset: " + key); + getLogger().lifecycle("Copying local object: " + asset.getPath() + " Asset: " + key); FileUtils.copyFile(localFile, target); } else { - getProject().getLogger().lifecycle("Downloading: " + url + " Asset: " + key); + getLogger().lifecycle("Downloading: " + url + " Asset: " + key); FileUtils.copyURLToFile(url, target, 10_000, 5_000); } if (!HashFunction.SHA1.hash(target).equals(asset.hash)) { failedDownloads.add(key); Utils.delete(target); - getProject().getLogger().error("{} Hash failed.", key); + getLogger().error("{} Hash failed.", key); } } catch (IOException e) { failedDownloads.add(key); - getProject().getLogger().error("{} Failed.", key); + getLogger().error("{} Failed.", key); e.printStackTrace(); } }; diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMCMeta.java b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMCMeta.java index 638130ec9..bb85baae6 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMCMeta.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMCMeta.java @@ -24,6 +24,7 @@ import org.apache.commons.io.FileUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; @@ -33,6 +34,8 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; + +import javax.inject.Inject; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -44,8 +47,8 @@ public abstract class DownloadMCMeta extends DefaultTask { private static final Gson GSON = new GsonBuilder().create(); public DownloadMCMeta() { - getManifest().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(s -> s.file("manifest.json"))); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(s -> s.file("version.json"))); + getManifest().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(s -> s.file("manifest.json"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(s -> s.file("version.json"))); } @TaskAction @@ -60,6 +63,9 @@ public void downloadMCMeta() throws IOException { } } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @Input public abstract Property getMCVersion(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/DynamicJarExec.java b/src/common/java/net/minecraftforge/gradle/common/tasks/DynamicJarExec.java index 4845d03b5..b988b4248 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/DynamicJarExec.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/DynamicJarExec.java @@ -20,6 +20,7 @@ package net.minecraftforge.gradle.common.tasks; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.MapProperty; import org.gradle.api.tasks.InputFile; @@ -28,12 +29,14 @@ import org.gradle.api.tasks.OutputFile; import com.google.common.collect.ImmutableMap; + +import javax.inject.Inject; import java.io.File; import java.util.List; public abstract class DynamicJarExec extends JarExec { public DynamicJarExec() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); } @Override @@ -46,6 +49,9 @@ protected List filterArgs(List args) { return replaceArgs(args, replace.build(), null); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFiles @Optional public abstract MapProperty getData(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractInheritance.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractInheritance.java index 2813c27a9..60f6a8081 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractInheritance.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractInheritance.java @@ -22,6 +22,7 @@ import net.minecraftforge.gradle.common.util.Utils; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.ListProperty; import org.gradle.api.tasks.InputFile; @@ -30,6 +31,7 @@ import com.google.common.collect.ImmutableMap; +import javax.inject.Inject; import java.io.File; import java.util.List; @@ -38,7 +40,7 @@ public ExtractInheritance() { getTool().set(Utils.INSTALLERTOOLS); getArgs().addAll("--task", "extract_inheritance", "--input", "{input}", "--output", "{output}"); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.json"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.json"))); } @Override @@ -53,6 +55,8 @@ protected List filterArgs(List args) { return newArgs; } + @Inject + protected abstract ProjectLayout getProjectLayout(); @InputFile public abstract RegularFileProperty getInput(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractMCPData.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractMCPData.java index 392c40ebf..f119cd02c 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractMCPData.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractMCPData.java @@ -28,6 +28,7 @@ import org.apache.commons.io.IOUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.Property; import org.gradle.api.Project; @@ -36,6 +37,7 @@ import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -47,7 +49,7 @@ public abstract class ExtractMCPData extends DefaultTask { private boolean allowEmpty = false; public ExtractMCPData() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(s -> s.file("output.srg"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(s -> s.file("output.srg"))); getKey().convention("mappings"); } @@ -109,6 +111,9 @@ private void error(String message) throws IOException { outputFile.createNewFile(); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @Input public abstract Property getKey(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractRangeMap.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractRangeMap.java index b02f4fc3f..97b6bbd42 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractRangeMap.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractRangeMap.java @@ -23,6 +23,7 @@ import net.minecraftforge.gradle.common.util.Utils; import org.gradle.api.file.ConfigurableFileCollection; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.provider.Property; @@ -31,6 +32,8 @@ import org.gradle.api.tasks.OutputFile; import com.google.common.collect.ImmutableMap; + +import javax.inject.Inject; import java.util.List; public abstract class ExtractRangeMap extends JarExec { @@ -42,7 +45,7 @@ public ExtractRangeMap() { "{library}", "--input", "{input}", "--batch", "{batched}"); setMinimumRuntimeJavaVersion(11); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.txt"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.txt"))); final JavaPluginExtension extension = getProject().getExtensions().findByType(JavaPluginExtension.class); if (extension != null && extension.getToolchain().getLanguageVersion().isPresent()) { int version = extension.getToolchain().getLanguageVersion().get().asInt(); @@ -65,6 +68,9 @@ protected List filterArgs(List args) { ); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFiles public abstract ConfigurableFileCollection getSources(); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java b/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java index 2cc31b03a..5def23664 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java @@ -27,6 +27,7 @@ import org.gradle.api.DefaultTask; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.Directory; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFile; import org.gradle.api.logging.Logger; import org.gradle.api.plugins.JavaPluginExtension; @@ -80,7 +81,7 @@ public abstract class JarExec extends DefaultTask { private final Provider toolFile; private final Provider resolvedVersion; - protected final Provider workDir = getProject().getLayout().getBuildDirectory().dir(getName()); + protected final Provider workDir = getProjectLayout().getBuildDirectory().dir(getName()); protected final Provider logFile = workDir.map(d -> d.file("log.txt")); public JarExec() { @@ -94,6 +95,9 @@ public JarExec() { } } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @Inject protected JavaToolchainService getJavaToolchainService() { throw new UnsupportedOperationException("Decorated instance, this should never be thrown unless shenanigans"); @@ -110,7 +114,7 @@ public void apply() throws IOException { jarFile.close(); // Create parent directory for log file - Logger logger = getProject().getLogger(); + Logger logger = getLogger(); if (logFile.getParentFile() != null && !logFile.getParentFile().exists() && !logFile.getParentFile().mkdirs()) { logger.warn("Could not create parent directory '{}' for log file", logFile.getParentFile().getAbsolutePath()); } diff --git a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java index 3fc29da40..2aa50ba79 100644 --- a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java +++ b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java @@ -25,18 +25,20 @@ import org.apache.commons.io.FileUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.IOException; public abstract class DownloadMCPMappings extends DefaultTask { public DownloadMCPMappings() { - getOutput().convention(getProject().getLayout().getBuildDirectory().file("mappings.zip")); + getOutput().convention(getProjectLayout().getBuildDirectory().file("mappings.zip")); } @TaskAction @@ -64,6 +66,9 @@ private File getMappingFile() { return ret; } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @Input public abstract Property getMappings(); diff --git a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java index f3211d6ee..f80b5f24a 100644 --- a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java +++ b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java @@ -29,13 +29,16 @@ import net.minecraftforge.srgutils.IRenamer; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; +import org.gradle.api.model.ObjectFactory; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.IOException; @@ -45,9 +48,9 @@ public abstract class GenerateSRG extends DefaultTask { private boolean reverse = false; public GenerateSRG() { - this.format = getProject().getObjects().property(IMappingFile.Format.class) + this.format = getProjectObjects().property(IMappingFile.Format.class) .convention(IMappingFile.Format.TSRG2); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(f -> f.file("output.tsrg"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(f -> f.file("output.tsrg"))); } @TaskAction @@ -85,6 +88,12 @@ private File findNames(String mapping) { return MavenArtifactDownloader.generate(getProject(), desc, false); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + + @Inject + protected abstract ObjectFactory getProjectObjects(); + @InputFile public abstract RegularFileProperty getSrg(); diff --git a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java index c3276f23f..90b8fb143 100644 --- a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java +++ b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java @@ -28,6 +28,7 @@ import org.apache.commons.io.FileUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.MapProperty; import org.gradle.api.provider.Property; @@ -36,12 +37,13 @@ import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.IOException; public abstract class SetupMCP extends DefaultTask { public SetupMCP() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.zip"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.zip"))); this.getOutputs().upToDateWhen(task -> { HashStore cache = new HashStore(getProject()); @@ -58,6 +60,9 @@ public SetupMCP() { }); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFile public abstract RegularFileProperty getConfig(); diff --git a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateExc.java b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateExc.java index 2340d17b7..f2f07569c 100644 --- a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateExc.java +++ b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateExc.java @@ -25,6 +25,7 @@ import net.minecraftforge.srgutils.IMappingFile; import org.apache.commons.io.IOUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.OutputFile; @@ -33,6 +34,8 @@ import com.google.common.base.Strings; import com.google.common.io.Files; import de.siegmar.fastcsv.reader.NamedCsvReader; + +import javax.inject.Inject; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; @@ -52,7 +55,7 @@ public abstract class CreateExc extends DefaultTask { private static final Pattern CLS_ENTRY = Pattern.compile("L([^;]+);"); public CreateExc() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.exc"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.exc"))); } @TaskAction @@ -180,6 +183,9 @@ private Map loadMappings() throws IOException { return names; } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFile public abstract RegularFileProperty getConfig(); diff --git a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateFakeSASPatches.java b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateFakeSASPatches.java index 848eb37ca..ab9f88cc8 100644 --- a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateFakeSASPatches.java +++ b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/CreateFakeSASPatches.java @@ -24,19 +24,24 @@ import org.gradle.api.DefaultTask; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.DirectoryProperty; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.tasks.InputFiles; import org.gradle.api.tasks.OutputDirectory; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; public abstract class CreateFakeSASPatches extends DefaultTask { public CreateFakeSASPatches() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.dir("patches"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.dir("patches"))); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFiles public abstract ConfigurableFileCollection getFiles(); diff --git a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/FilterNewJar.java b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/FilterNewJar.java index 33c1393de..6241f2c07 100644 --- a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/FilterNewJar.java +++ b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/FilterNewJar.java @@ -26,12 +26,14 @@ import org.apache.commons.io.IOUtils; import org.gradle.api.DefaultTask; import org.gradle.api.file.ConfigurableFileCollection; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.InputFiles; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -43,7 +45,7 @@ public abstract class FilterNewJar extends DefaultTask { //TODO: Copy task? public FilterNewJar() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); } @TaskAction @@ -83,6 +85,9 @@ private boolean isVanilla(Set classes, String cls) { return classes.contains(cls); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFile public abstract RegularFileProperty getInput(); diff --git a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateBinPatches.java b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateBinPatches.java index 1b0129519..3a04d34d4 100644 --- a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateBinPatches.java +++ b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateBinPatches.java @@ -24,6 +24,7 @@ import net.minecraftforge.gradle.common.util.Utils; import org.gradle.api.file.ConfigurableFileCollection; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; @@ -33,6 +34,8 @@ import org.gradle.api.tasks.OutputFile; import com.google.common.collect.ImmutableMap; + +import javax.inject.Inject; import java.util.List; public abstract class GenerateBinPatches extends JarExec { @@ -41,7 +44,7 @@ public GenerateBinPatches() { getArgs().addAll("--clean", "{clean}", "--create", "{dirty}", "--output", "{output}", "--patches", "{patches}", "--srg", "{srg}"); - getOutput().convention(getProject().getLayout().getBuildDirectory() + getOutput().convention(getProjectLayout().getBuildDirectory() .dir(getName()).map(d -> d.file(getSide().getOrElse("output") + ".lzma"))); } @@ -59,6 +62,9 @@ protected List filterArgs(List args) { return newArgs; } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @InputFile public abstract RegularFileProperty getCleanJar(); diff --git a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GeneratePatches.java b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GeneratePatches.java index fd4ea1541..934297f8b 100644 --- a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GeneratePatches.java +++ b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GeneratePatches.java @@ -55,8 +55,8 @@ public void doTask() throws Exception { Path base = getBase().get().getAsFile().toPath(); Path modified = getModified().get().getAsFile().toPath(); Path output = getOutput().get().getAsFile().toPath(); - getProject().getLogger().info("Base: {}", base); - getProject().getLogger().info("Modified: {}", modified); + getLogger().info("Base: {}", base); + getLogger().info("Modified: {}", modified); ArchiveFormat outputFormat = getOutputFormat().getOrNull(); if (outputFormat == null) { diff --git a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java index 732627843..0b66d48de 100644 --- a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java +++ b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java @@ -33,6 +33,7 @@ import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.Project; import org.gradle.api.file.ConfigurableFileCollection; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.model.ObjectFactory; import org.gradle.api.provider.ListProperty; @@ -86,7 +87,7 @@ public GenerateUserdevConfig(@Nonnull final Project project) { processorData = objects.mapProperty(String.class, File.class); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.json"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.json"))); } @TaskAction @@ -157,6 +158,9 @@ private boolean isV2() { !"b/".equals(getPatchesModifiedPrefix().get()); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @Input public abstract ListProperty getLibraries(); diff --git a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/ApplyMCPFunction.java b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/ApplyMCPFunction.java index 8fe6d1c21..443bd05a7 100644 --- a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/ApplyMCPFunction.java +++ b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/ApplyMCPFunction.java @@ -25,6 +25,7 @@ import net.minecraftforge.gradle.common.tasks.JarExec; import net.minecraftforge.gradle.common.util.Utils; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; @@ -32,6 +33,7 @@ import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -44,7 +46,7 @@ public abstract class ApplyMCPFunction extends JarExec { private final Map replacements = new HashMap<>(); public ApplyMCPFunction() { - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.jar"))); } @TaskAction @@ -99,6 +101,9 @@ public void apply() throws IOException { super.apply(); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + @Override protected List filterArgs(List args) { return replaceArgs(args, replacements, null); diff --git a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java index 95a23ad37..9dc2daabf 100644 --- a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java +++ b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java @@ -20,6 +20,7 @@ package net.minecraftforge.gradle.userdev.tasks; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.internal.tasks.compile.DefaultJavaCompileSpec; import org.gradle.api.internal.tasks.compile.JavaCompileSpec; import org.gradle.api.provider.Provider; @@ -29,6 +30,8 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion; import org.gradle.jvm.toolchain.JavaToolchainService; import org.gradle.language.base.internal.compile.Compiler; + +import javax.inject.Inject; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -59,8 +62,7 @@ public void doHackyCompile() { } private void setCompiler() { - JavaToolchainService service = getProject().getExtensions().getByType(JavaToolchainService.class); - Provider compiler = service.compilerFor(s -> s.getLanguageVersion().set(JavaLanguageVersion.of(this.getSourceCompatibility()))); + Provider compiler = getJavaToolchainService().compilerFor(s -> s.getLanguageVersion().set(JavaLanguageVersion.of(this.getSourceCompatibility()))); this.getJavaCompiler().set(compiler); } @@ -89,4 +91,9 @@ private Compiler createCompiler(JavaCompileSpec spec) { } } + @Inject + protected JavaToolchainService getJavaToolchainService() { + throw new UnsupportedOperationException("Decorated instance, this should never be thrown unless shenanigans"); + } + } diff --git a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/RenameJarInPlace.java b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/RenameJarInPlace.java index c86dca55a..4d876546b 100644 --- a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/RenameJarInPlace.java +++ b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/RenameJarInPlace.java @@ -24,10 +24,7 @@ import net.minecraftforge.gradle.common.util.Utils; import org.apache.commons.io.FileUtils; -import org.gradle.api.file.ConfigurableFileCollection; -import org.gradle.api.file.Directory; -import org.gradle.api.file.RegularFile; -import org.gradle.api.file.RegularFileProperty; +import org.gradle.api.file.*; import org.gradle.api.provider.Provider; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.InputFiles; @@ -36,12 +33,14 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; + +import javax.inject.Inject; import java.io.File; import java.io.IOException; import java.util.List; public abstract class RenameJarInPlace extends JarExec { - private final Provider workDir = getProject().getLayout().getBuildDirectory().dir(getName()); + private final Provider workDir = getProjectLayout().getBuildDirectory().dir(getName()); private final Provider temp = workDir.map(s -> s.file("output.jar")); public RenameJarInPlace() { @@ -66,7 +65,7 @@ protected List filterArgs(List args) { public void apply() throws IOException { File temp = this.temp.get().getAsFile(); if (temp.getParentFile() != null && !temp.getParentFile().exists() && !temp.getParentFile().mkdirs()) { - getProject().getLogger().warn("Could not create parent directories for temp dir '{}'", temp.getAbsolutePath()); + getLogger().warn("Could not create parent directories for temp dir '{}'", temp.getAbsolutePath()); } super.apply(); @@ -74,6 +73,9 @@ public void apply() throws IOException { FileUtils.copyFile(temp, getInput().get().getAsFile()); } + @Inject + protected abstract ProjectLayout getProjectLayout(); + // TODO: Make this a ConfigurableFileCollection? (then remove getExtraMappings()) @InputFile public abstract RegularFileProperty getMappings(); From 83896977fdd773a996422c73135a9469a9220d6e Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Fri, 17 Jun 2022 15:48:48 +0100 Subject: [PATCH 2/2] Mark config cache incompatible tasks accordingly --- .../gradle/common/tasks/DownloadAssets.java | 3 +++ .../gradle/common/tasks/DownloadMavenArtifact.java | 14 ++++++++++++-- .../gradle/common/tasks/ExtractNatives.java | 5 +++++ .../gradle/common/tasks/JarExec.java | 1 + .../gradle/mcp/tasks/DownloadMCPConfig.java | 1 + .../gradle/mcp/tasks/DownloadMCPMappings.java | 1 + .../gradle/mcp/tasks/GenerateSRG.java | 1 + .../minecraftforge/gradle/mcp/tasks/SetupMCP.java | 1 + .../patcher/tasks/GenerateUserdevConfig.java | 1 + .../gradle/userdev/tasks/HackyJavaCompile.java | 1 + 10 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java index 41043d502..b88204195 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadAssets.java @@ -26,6 +26,7 @@ import org.apache.commons.io.FileUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.InputFile; @@ -33,6 +34,7 @@ import org.gradle.api.tasks.OutputDirectory; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.IOException; import java.net.URL; @@ -49,6 +51,7 @@ public abstract class DownloadAssets extends DefaultTask { public DownloadAssets() { + notCompatibleWithConfigurationCache("MAD"); getAssetRepository().convention("https://resources.download.minecraft.net/"); getConcurrentDownloads().convention(8); } diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMavenArtifact.java b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMavenArtifact.java index e7eab11a1..9e9d4067f 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMavenArtifact.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/DownloadMavenArtifact.java @@ -25,13 +25,16 @@ import org.apache.commons.io.FileUtils; import org.gradle.api.DefaultTask; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; +import org.gradle.api.model.ObjectFactory; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; +import javax.inject.Inject; import java.io.File; import java.io.IOException; @@ -40,11 +43,12 @@ public abstract class DownloadMavenArtifact extends DefaultTask { private boolean changing = false; public DownloadMavenArtifact() { + notCompatibleWithConfigurationCache("MAD"); // We need to always ask, in case the file on the remote maven/local fake repo has changed. getOutputs().upToDateWhen(task -> false); - this.artifact = getProject().getObjects().property(Artifact.class); - getOutput().convention(getProject().getLayout().getBuildDirectory().dir(getName()) + this.artifact = getProjectObjects().property(Artifact.class); + getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()) .zip(getArtifact(), (d, a) -> d.file("output." + a.getExtension()))); } @@ -85,4 +89,10 @@ public void run() throws IOException { if (!output.getParentFile().exists()) output.getParentFile().mkdirs(); FileUtils.copyFile(out, output); } + + @Inject + protected abstract ProjectLayout getProjectLayout(); + + @Inject + protected abstract ObjectFactory getProjectObjects(); } diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractNatives.java b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractNatives.java index b1ed77cd5..403b22824 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractNatives.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/ExtractNatives.java @@ -35,6 +35,11 @@ import java.io.IOException; public abstract class ExtractNatives extends DefaultTask { + + public ExtractNatives() { + notCompatibleWithConfigurationCache("Utils needing getProject()"); + } + @TaskAction public void run() throws IOException { VersionJson json = Utils.loadJson(getMeta().get().getAsFile(), VersionJson.class); diff --git a/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java b/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java index 5def23664..f87eae048 100644 --- a/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java +++ b/src/common/java/net/minecraftforge/gradle/common/tasks/JarExec.java @@ -85,6 +85,7 @@ public abstract class JarExec extends DefaultTask { protected final Provider logFile = workDir.map(d -> d.file("log.txt")); public JarExec() { + notCompatibleWithConfigurationCache("MAD"); toolFile = getTool().map(toolStr -> MavenArtifactDownloader.gradle(getProject(), toolStr, false)); resolvedVersion = getTool().map(toolStr -> MavenArtifactDownloader.getVersion(getProject(), toolStr)); getDebug().convention(false); diff --git a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPConfig.java b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPConfig.java index f6c83aeaf..9eacdafa1 100644 --- a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPConfig.java +++ b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPConfig.java @@ -37,6 +37,7 @@ public abstract class DownloadMCPConfig extends DefaultTask { @TaskAction public void downloadMCPConfig() throws IOException { + notCompatibleWithConfigurationCache("MAD"); File file = getConfigFile(); File output = getOutput().get().getAsFile(); diff --git a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java index 2aa50ba79..1d1a5a9d0 100644 --- a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java +++ b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPMappings.java @@ -38,6 +38,7 @@ public abstract class DownloadMCPMappings extends DefaultTask { public DownloadMCPMappings() { + notCompatibleWithConfigurationCache("MAD"); getOutput().convention(getProjectLayout().getBuildDirectory().file("mappings.zip")); } diff --git a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java index f80b5f24a..67af24cd5 100644 --- a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java +++ b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/GenerateSRG.java @@ -48,6 +48,7 @@ public abstract class GenerateSRG extends DefaultTask { private boolean reverse = false; public GenerateSRG() { + notCompatibleWithConfigurationCache("MAD"); this.format = getProjectObjects().property(IMappingFile.Format.class) .convention(IMappingFile.Format.TSRG2); getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(f -> f.file("output.tsrg"))); diff --git a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java index 90b8fb143..985e5941e 100644 --- a/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java +++ b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java @@ -43,6 +43,7 @@ public abstract class SetupMCP extends DefaultTask { public SetupMCP() { + notCompatibleWithConfigurationCache("MCPRuntime needs getProject()"); getOutput().convention(getProjectLayout().getBuildDirectory().dir(getName()).map(d -> d.file("output.zip"))); this.getOutputs().upToDateWhen(task -> { diff --git a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java index 0b66d48de..654187c48 100644 --- a/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java +++ b/src/patcher/java/net/minecraftforge/gradle/patcher/tasks/GenerateUserdevConfig.java @@ -75,6 +75,7 @@ public abstract class GenerateUserdevConfig extends DefaultTask { @Inject public GenerateUserdevConfig(@Nonnull final Project project) { + notCompatibleWithConfigurationCache(""); this.runs = project.container(RunConfig.class, name -> new RunConfig(project, name)); ObjectFactory objects = project.getObjects(); diff --git a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java index 9dc2daabf..f5771b086 100644 --- a/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java +++ b/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/HackyJavaCompile.java @@ -44,6 +44,7 @@ public class HackyJavaCompile extends JavaCompile { public void doHackyCompile() { + notCompatibleWithConfigurationCache(""); // What follows is a horrible hack to allow us to call JavaCompile // from our dependency resolver.