mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 21:47:42 -05:00
Fix #755
This commit is contained in:
@@ -272,7 +272,7 @@ public final class CompileConfiguration {
|
||||
private static Path getLockFile(Project project) {
|
||||
final LoomGradleExtension extension = LoomGradleExtension.get(project);
|
||||
final Path cacheDirectory = extension.getFiles().getUserCache().toPath();
|
||||
final String pathHash = Checksum.toHex(project.getProjectDir().getAbsolutePath().getBytes(StandardCharsets.UTF_8)).substring(0, 16);
|
||||
final String pathHash = Checksum.projectHash(project);
|
||||
return cacheDirectory.resolve("." + pathHash + ".lock");
|
||||
}
|
||||
|
||||
|
||||
@@ -27,12 +27,14 @@ package net.fabricmc.loom.util;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import com.google.common.hash.HashCode;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.google.common.io.Files;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.logging.Logger;
|
||||
import org.gradle.api.logging.Logging;
|
||||
|
||||
@@ -81,4 +83,9 @@ public class Checksum {
|
||||
public static String toHex(byte[] bytes) {
|
||||
return BaseEncoding.base16().lowerCase().encode(bytes);
|
||||
}
|
||||
|
||||
public static String projectHash(Project project) {
|
||||
String str = project.getProjectDir().getAbsolutePath() + ":" + project.getPath();
|
||||
return toHex(str.getBytes(StandardCharsets.UTF_8)).substring(0, 16);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user