Skip to content

Commit

Permalink
Replace old intermediary format in gradle cache if found and warn abo…
Browse files Browse the repository at this point in the history
…ut it
  • Loading branch information
thecatcore committed Apr 13, 2024
1 parent 1b60876 commit 667d777
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/babric/mappings/BabricIntermediaryProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.gradle.api.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -18,13 +20,26 @@
import java.util.Map;

public abstract class BabricIntermediaryProvider extends IntermediaryMappingsProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(BabricIntermediaryProvider.class);

@Override
public @NotNull String getName() {
return "babric-" + super.getName();
}

@Override
public void provide(Path tinyMappings, @Nullable Project project) throws IOException {
if (Files.exists(tinyMappings)) {
MemoryMappingTree mappingTree = new MemoryMappingTree();

MappingReader.read(tinyMappings, mappingTree);

if (mappingTree.getDstNamespaces().contains("glue")) {
LOGGER.warn("Found old intermediary format, it will be replaced.\nYou might need to run gradle with --refresh-dependencies to make sure mappings and jars are updated too.");
Files.delete(tinyMappings);
}
}

if (!Files.exists(tinyMappings) || this.getRefreshDeps().get()) {
Path intermediaryTempPath = tinyMappings.getParent().resolve(this.getName() + "-temp.tiny");
super.provide(intermediaryTempPath, project);
Expand Down

0 comments on commit 667d777

Please sign in to comment.