Add a lock file around building the loom cache. Regenerate if the lock file exists.

This helps to ensure that failed or canceled builds do not cause the cache to be left in an undetectable invalid state.
This commit is contained in:
modmuss50
2022-07-30 19:21:56 +01:00
parent c7e10a596e
commit 3913c2e897
17 changed files with 97 additions and 35 deletions

View File

@@ -48,7 +48,6 @@ import net.fabricmc.loom.task.LoomTasks;
import net.fabricmc.loom.util.LibraryLocationLogger;
public class LoomGradlePlugin implements BootstrappedPlugin {
public static boolean refreshDeps;
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
public static final String LOOM_VERSION = Objects.requireNonNullElse(LoomGradlePlugin.class.getPackage().getImplementationVersion(), "0.0.0+unknown");
@@ -66,12 +65,6 @@ public class LoomGradlePlugin implements BootstrappedPlugin {
project.getLogger().lifecycle("Fabric Loom: " + LOOM_VERSION);
LibraryLocationLogger.logLibraryVersions();
refreshDeps = project.getGradle().getStartParameter().isRefreshDependencies() || Boolean.getBoolean("loom.refresh");
if (refreshDeps) {
project.getLogger().lifecycle("Refresh dependencies is in use, loom will be significantly slower.");
}
// Apply default plugins
project.apply(ImmutableMap.of("plugin", "java-library"));
project.apply(ImmutableMap.of("plugin", "eclipse"));