Fix rebuild bug

This commit is contained in:
Andrea Cavalli 2024-02-20 16:38:24 +01:00
parent bf2cd90acf
commit 73d24bf13f

View File

@ -202,14 +202,22 @@ public class SourcesGenerator {
new GenUpgraderSuperX(genParams).run();
// Update the hash at the end
var newHashRaw = basePackageName + '\n' + useRecordBuilders + '\n' + deepCheckBeforeCreatingNewEqualInstances + '\n' + curHash + '\n';
String oldHashRaw;
if (Files.exists(hashPath)) {
oldHashRaw = Files.readString(hashPath, StandardCharsets.UTF_8);
} else {
oldHashRaw = null;
}
if (!Objects.equals(newHashRaw, oldHashRaw)) {
Files.writeString(hashPath,
basePackageName + '\n' + useRecordBuilders + '\n' + deepCheckBeforeCreatingNewEqualInstances + '\n' + curHash
+ '\n',
newHashRaw,
StandardCharsets.UTF_8,
TRUNCATE_EXISTING,
WRITE,
CREATE
);
}
generatedFilesToDelete.remove(outPath.relativize(hashPath));
}