Add support for processing 1.12.2 Forge compiled with Forge Gradle 3 (#8).

Changed the resolver names to match the Forge Gradle versions, since that software version
determines the structure of the jar file and how it needs to be parsed.
Refactored the ForgeGradle3 resolver to conditionally execute the installer only when we
need artifacts generated by the installer. This allows the new 1.12.2 builds to be processed
without running the installer.
Changed the VersionSegemented interface to accept a libraryVersion, so we can segment within
a minecraft version.

This change is pending verification with Helios.
This commit is contained in:
Daniel Scalzi
2020-06-02 17:16:15 -04:00
parent 6e94883f23
commit 672424b973
14 changed files with 444 additions and 185 deletions

View File

@@ -15,12 +15,13 @@ type ArrayElement<A> = A extends readonly (infer T)[] ? T : never
export class ForgeGradle2Adapter extends ForgeResolver {
public static isForVersion(version: MinecraftVersion): boolean {
public static isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
if(version.getMinor() === 12 && !VersionUtil.isOneDotTwelveFG2(libraryVersion)) {
return false
}
return VersionUtil.isVersionAcceptable(version, [7, 8, 9, 10, 11, 12])
}
protected readonly MOJANG_REMOTE_REPOSITORY = 'https://libraries.minecraft.net/'
constructor(
absoluteRoot: string,
relativeRoot: string,
@@ -35,8 +36,8 @@ export class ForgeGradle2Adapter extends ForgeResolver {
return this.getForgeByVersion()
}
public isForVersion(version: MinecraftVersion): boolean {
return ForgeGradle2Adapter.isForVersion(version)
public isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
return ForgeGradle2Adapter.isForVersion(version, libraryVersion)
}
public async getForgeByVersion(): Promise<Module> {