Add a basic way to specify custom intermediary URLs, ideally this would use maven.

But thats more work than I can be bothered to do.
dev/0.11
modmuss50 2020-03-26 19:40:00 +00:00
parent 00c65f54ed
commit bb68465a8d
2 changed files with 8 additions and 1 deletions

View File

@ -60,6 +60,7 @@ public class LoomGradleExtension {
public boolean extractJars = false; public boolean extractJars = false;
public String customManifest = null; public String customManifest = null;
public File accessWidener = null; public File accessWidener = null;
public Function<String, Object> intermediaryUrl = mcVer -> "https://maven.fabricmc.net/net/fabricmc/intermediary/" + mcVer + "/intermediary-" + mcVer + "-v2.jar";
private List<Path> unmappedModsBuilt = new ArrayList<>(); private List<Path> unmappedModsBuilt = new ArrayList<>();
@ -317,4 +318,10 @@ public class LoomGradleExtension {
public boolean ideSync() { public boolean ideSync() {
return Boolean.parseBoolean(System.getProperty("idea.sync.active", "false")); return Boolean.parseBoolean(System.getProperty("idea.sync.active", "false"));
} }
// Ideally this should use maven, but this is a lot easier
public Function<String, String> getIntermediaryUrl() {
//Done like this to work around this possibly not being a java string...
return s -> intermediaryUrl.apply(s).toString();
}
} }

View File

@ -151,7 +151,7 @@ public class MappingsProvider extends DependencyProvider {
// Download and extract intermediary // Download and extract intermediary
String encodedMinecraftVersion = UrlEscapers.urlFragmentEscaper().escape(minecraftVersion); String encodedMinecraftVersion = UrlEscapers.urlFragmentEscaper().escape(minecraftVersion);
String intermediaryArtifactUrl = "https://maven.fabricmc.net/net/fabricmc/intermediary/" + encodedMinecraftVersion + "/intermediary-" + encodedMinecraftVersion + "-v2.jar"; String intermediaryArtifactUrl = getExtension().getIntermediaryUrl().apply(encodedMinecraftVersion);
Path intermediaryJar = mappingsStepsDir.resolve("v2-intermediary-" + minecraftVersion + ".jar"); Path intermediaryJar = mappingsStepsDir.resolve("v2-intermediary-" + minecraftVersion + ".jar");
DownloadUtil.downloadIfChanged(new URL(intermediaryArtifactUrl), intermediaryJar.toFile(), project.getLogger()); DownloadUtil.downloadIfChanged(new URL(intermediaryArtifactUrl), intermediaryJar.toFile(), project.getLogger());