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:
@@ -16,7 +16,7 @@ export abstract class BaseForgeModStructure extends ModuleStructure implements V
|
||||
super(absoluteRoot, relativeRoot, 'forgemods', baseUrl, Type.ForgeMod)
|
||||
}
|
||||
|
||||
public abstract isForVersion(version: MinecraftVersion): boolean
|
||||
public abstract isForVersion(version: MinecraftVersion, libraryVersion: string): boolean
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
||||
|
||||
@@ -11,7 +11,8 @@ export class ForgeModStructure113 extends BaseForgeModStructure {
|
||||
|
||||
public static readonly IMPLEMENTATION_VERSION_REGEX = /^Implementation-Version: (.+)[\r\n]/
|
||||
|
||||
public static isForVersion(version: MinecraftVersion): boolean {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public static isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
|
||||
return VersionUtil.isVersionAcceptable(version, [13, 14, 15])
|
||||
}
|
||||
|
||||
@@ -25,8 +26,8 @@ export class ForgeModStructure113 extends BaseForgeModStructure {
|
||||
super(absoluteRoot, relativeRoot, baseUrl)
|
||||
}
|
||||
|
||||
public isForVersion(version: MinecraftVersion): boolean {
|
||||
return ForgeModStructure113.isForVersion(version)
|
||||
public isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
|
||||
return ForgeModStructure113.isForVersion(version, libraryVersion)
|
||||
}
|
||||
|
||||
protected async getModuleId(name: string, path: string, stats: Stats, buf: Buffer): Promise<string> {
|
||||
|
||||
@@ -9,7 +9,8 @@ import { MinecraftVersion } from '../../../../../util/MinecraftVersion'
|
||||
|
||||
export class ForgeModStructure17 extends BaseForgeModStructure {
|
||||
|
||||
public static isForVersion(version: MinecraftVersion): boolean {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public static isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
|
||||
return VersionUtil.isVersionAcceptable(version, [7, 8, 9, 10, 11, 12])
|
||||
}
|
||||
|
||||
@@ -23,8 +24,8 @@ export class ForgeModStructure17 extends BaseForgeModStructure {
|
||||
super(absoluteRoot, relativeRoot, baseUrl)
|
||||
}
|
||||
|
||||
public isForVersion(version: MinecraftVersion): boolean {
|
||||
return ForgeModStructure17.isForVersion(version)
|
||||
public isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
|
||||
return ForgeModStructure17.isForVersion(version, libraryVersion)
|
||||
}
|
||||
|
||||
protected async getModuleId(name: string, path: string, stats: Stats, buf: Buffer): Promise<string> {
|
||||
|
||||
@@ -50,6 +50,7 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
||||
if (options.forgeVersion != null) {
|
||||
const fms = VersionSegmentedRegistry.getForgeModStruct(
|
||||
minecraftVersion,
|
||||
options.forgeVersion,
|
||||
absoluteServerRoot,
|
||||
relativeServerRoot,
|
||||
this.baseUrl
|
||||
@@ -123,6 +124,7 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
||||
|
||||
const forgeModStruct = VersionSegmentedRegistry.getForgeModStruct(
|
||||
minecraftVersion,
|
||||
serverMeta.forgeVersion,
|
||||
absoluteServerRoot,
|
||||
relativeServerRoot,
|
||||
this.baseUrl
|
||||
|
||||
@@ -50,20 +50,24 @@ export abstract class BaseMavenRepo extends BaseFileStructure {
|
||||
|
||||
private async downloadArtifactBase(url: string, relative: string): Promise<void> {
|
||||
const resolvedURL = resolveURL(url, relative).toString()
|
||||
console.debug(`Downloading ${resolvedURL}..`)
|
||||
return this.downloadArtifactDirect(resolvedURL, relative)
|
||||
}
|
||||
|
||||
public async downloadArtifactDirect(url: string, path: string): Promise<void> {
|
||||
console.debug(`Downloading ${url}..`)
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: resolvedURL,
|
||||
url,
|
||||
responseType: 'stream'
|
||||
})
|
||||
const localPath = resolve(this.containerDirectory, relative)
|
||||
const localPath = resolve(this.containerDirectory, path)
|
||||
await mkdirs(dirname(localPath))
|
||||
const writer = createWriteStream(localPath)
|
||||
response.data.pipe(writer)
|
||||
// tslint:disable-next-line: no-shadowed-variable
|
||||
return new Promise((resolve, reject) => {
|
||||
writer.on('finish', () => {
|
||||
console.debug(`Completed download of ${resolvedURL}.`)
|
||||
console.debug(`Completed download of ${url}.`)
|
||||
resolve()
|
||||
})
|
||||
writer.on('error', reject)
|
||||
|
||||
Reference in New Issue
Block a user