Allow to set custom intermediary url again (#528)
* allow to set custom intermediary url again * apply suggestions * add some javadoc
This commit is contained in:
		
							parent
							
								
									5f379e4f42
								
							
						
					
					
						commit
						a91b75c05c
					
				
					 4 changed files with 22 additions and 2 deletions
				
			
		|  | @ -99,8 +99,7 @@ public interface LoomGradleExtension extends LoomGradleExtensionAPI { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	default String getIntermediaryUrl(String minecraftVersion) { | 	default String getIntermediaryUrl(String minecraftVersion) { | ||||||
| 		// TODO reimplement a way to change this, was never really supported api anyway | 		return String.format(this.getIntermediaryUrl().get(), minecraftVersion); | ||||||
| 		return String.format("https://maven.fabricmc.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar", minecraftVersion); |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
|  |  | ||||||
|  | @ -211,4 +211,11 @@ public interface LoomGradleExtensionAPI { | ||||||
| 	 * @return the property controlling the transitive access wideners | 	 * @return the property controlling the transitive access wideners | ||||||
| 	 */ | 	 */ | ||||||
| 	Property<Boolean> getEnableTransitiveAccessWideners(); | 	Property<Boolean> getEnableTransitiveAccessWideners(); | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * Use "%1$s" as a placeholder for the minecraft version. | ||||||
|  | 	 * | ||||||
|  | 	 * @return the intermediary url template | ||||||
|  | 	 */ | ||||||
|  | 	Property<String> getIntermediaryUrl(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -61,6 +61,7 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA | ||||||
| 	protected final Property<String> customManifest; | 	protected final Property<String> customManifest; | ||||||
| 	protected final Property<Boolean> setupRemappedVariants; | 	protected final Property<Boolean> setupRemappedVariants; | ||||||
| 	protected final Property<Boolean> transitiveAccessWideners; | 	protected final Property<Boolean> transitiveAccessWideners; | ||||||
|  | 	protected final Property<String> intermediary; | ||||||
| 
 | 
 | ||||||
| 	private final ModVersionParser versionParser; | 	private final ModVersionParser versionParser; | ||||||
| 
 | 
 | ||||||
|  | @ -85,6 +86,8 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA | ||||||
| 		this.transitiveAccessWideners = project.getObjects().property(Boolean.class) | 		this.transitiveAccessWideners = project.getObjects().property(Boolean.class) | ||||||
| 				.convention(true); | 				.convention(true); | ||||||
| 		this.transitiveAccessWideners.finalizeValueOnRead(); | 		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); | 		this.versionParser = new ModVersionParser(project); | ||||||
| 
 | 
 | ||||||
|  | @ -173,6 +176,11 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA | ||||||
| 
 | 
 | ||||||
| 	protected abstract LoomFiles getFiles(); | 	protected abstract LoomFiles getFiles(); | ||||||
| 
 | 
 | ||||||
|  | 	@Override | ||||||
|  | 	public Property<String> getIntermediaryUrl() { | ||||||
|  | 		return intermediary; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public void disableDeprecatedPomGeneration(MavenPublication publication) { | 	public void disableDeprecatedPomGeneration(MavenPublication publication) { | ||||||
| 		net.fabricmc.loom.configuration.MavenPublication.excludePublication(publication); | 		net.fabricmc.loom.configuration.MavenPublication.excludePublication(publication); | ||||||
|  |  | ||||||
|  | @ -156,4 +156,10 @@ public class MinecraftGradleExtension implements LoomGradleExtensionAPI { | ||||||
| 		reportDeprecation(); | 		reportDeprecation(); | ||||||
| 		throw new UnsupportedOperationException(); | 		throw new UnsupportedOperationException(); | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	@Override | ||||||
|  | 	public Property<String> getIntermediaryUrl() { | ||||||
|  | 		reportDeprecation(); | ||||||
|  | 		return parent.getIntermediaryUrl(); | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue