Allow to set custom intermediary url again (#528)

* allow to set custom intermediary url again

* apply suggestions

* add some javadoc
dev/0.11
Cat Core 2021-11-01 16:47:28 +01:00 committed by GitHub
parent 5f379e4f42
commit a91b75c05c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 2 deletions

View File

@ -99,8 +99,7 @@ public interface LoomGradleExtension extends LoomGradleExtensionAPI {
}
default String getIntermediaryUrl(String minecraftVersion) {
// TODO reimplement a way to change this, was never really supported api anyway
return String.format("https://maven.fabricmc.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar", minecraftVersion);
return String.format(this.getIntermediaryUrl().get(), minecraftVersion);
}
@Override

View File

@ -211,4 +211,11 @@ public interface LoomGradleExtensionAPI {
* @return the property controlling the transitive access wideners
*/
Property<Boolean> getEnableTransitiveAccessWideners();
/**
* Use "%1$s" as a placeholder for the minecraft version.
*
* @return the intermediary url template
*/
Property<String> getIntermediaryUrl();
}

View File

@ -61,6 +61,7 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
protected final Property<String> customManifest;
protected final Property<Boolean> setupRemappedVariants;
protected final Property<Boolean> transitiveAccessWideners;
protected final Property<String> intermediary;
private final ModVersionParser versionParser;
@ -85,6 +86,8 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
this.transitiveAccessWideners = project.getObjects().property(Boolean.class)
.convention(true);
this.transitiveAccessWideners.finalizeValueOnRead();
this.intermediary = project.getObjects().property(String.class)
.convention("https://maven.fabricmc.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar");
this.versionParser = new ModVersionParser(project);
@ -173,6 +176,11 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
protected abstract LoomFiles getFiles();
@Override
public Property<String> getIntermediaryUrl() {
return intermediary;
}
@Override
public void disableDeprecatedPomGeneration(MavenPublication publication) {
net.fabricmc.loom.configuration.MavenPublication.excludePublication(publication);

View File

@ -156,4 +156,10 @@ public class MinecraftGradleExtension implements LoomGradleExtensionAPI {
reportDeprecation();
throw new UnsupportedOperationException();
}
@Override
public Property<String> getIntermediaryUrl() {
reportDeprecation();
return parent.getIntermediaryUrl();
}
}