Skip to content

Commit

Permalink
Merge branch 'dev/1.4' into dev/1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Jan 28, 2024
2 parents 35d7ac2 + 4cc608c commit b9bdd93
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,20 @@
import org.jetbrains.annotations.NotNull;

public abstract class LegacyFabricIntermediaryMappingsProvider extends IntermediaryMappingsProvider {
private Project project;
private String name;
private String defaultUrl = "";

@Override
public @NotNull String getName() {
String defaultUrl = this.defaultUrl;
String url = getIntermediaryUrl().get();

if (!defaultUrl.equals(url)) {
// make sure the name is changed when the user defines a
// custom intermediary url, to ensure the default cache
// file does not get corrupted with other intermediaries
return name += "-" + Integer.toHexString(url.hashCode());
}
if (this.name == null)
this.name = LegacyLoomingExtensionAPI.get(project)
.getIntermediaryVersion().map(Constants::getIntermediaryName).get();

return this.name;
}

public void configure(Project project, LegacyLoomingExtensionAPI api, LoomGradleExtensionAPI loom) {
this.name = api.getIntermediaryVersion().map(Constants::getIntermediaryName).get();
this.defaultUrl = loom.getIntermediaryUrl().get();
this.project = project;

this.getIntermediaryUrl()
.convention(api.getIntermediaryVersion().map(Constants::getIntermediaryURL))
Expand Down

0 comments on commit b9bdd93

Please sign in to comment.