Remove forge/liteloader specific repos.

Just put everything in the libraries repo.
This commit is contained in:
Daniel Scalzi
2020-01-19 12:08:53 -05:00
parent 1ff02edc71
commit b5e2b3db1c
6 changed files with 44 additions and 80 deletions

View File

@@ -1,22 +0,0 @@
import { BaseMavenRepo } from './BaseMavenRepo'
export class ForgeRepoStructure extends BaseMavenRepo {
public static readonly FORGE_GROUP = 'net.minecraftforge'
public static readonly FORGE_ARTIFACT = 'forge'
constructor(
absoluteRoot: string,
relativeRoot: string
) {
super(absoluteRoot, relativeRoot, 'forge')
}
public getLocalForge(version: string, classifier?: string) {
return this.getArtifactByComponents(
ForgeRepoStructure.FORGE_GROUP,
ForgeRepoStructure.FORGE_ARTIFACT,
version, classifier, 'jar')
}
}

View File

@@ -5,6 +5,12 @@ export class LibRepoStructure extends BaseMavenRepo {
public static readonly MINECRAFT_GROUP = 'net.minecraft' public static readonly MINECRAFT_GROUP = 'net.minecraft'
public static readonly MINECRAFT_CLIENT_ARTIFACT = 'client' public static readonly MINECRAFT_CLIENT_ARTIFACT = 'client'
public static readonly FORGE_GROUP = 'net.minecraftforge'
public static readonly FORGE_ARTIFACT = 'forge'
public static readonly LITELOADER_GROUP = 'com.mumfrey'
public static readonly LITELOADER_ARTIFACT = 'liteloader'
constructor( constructor(
absoluteRoot: string, absoluteRoot: string,
relativeRoot: string relativeRoot: string
@@ -12,4 +18,18 @@ export class LibRepoStructure extends BaseMavenRepo {
super(absoluteRoot, relativeRoot, 'lib') super(absoluteRoot, relativeRoot, 'lib')
} }
public getLocalForge(version: string, classifier?: string) {
return this.getArtifactByComponents(
LibRepoStructure.FORGE_GROUP,
LibRepoStructure.FORGE_ARTIFACT,
version, classifier, 'jar')
}
public getLocalLiteLoader(version: string, classifier?: string) {
return this.getArtifactByComponents(
LibRepoStructure.LITELOADER_GROUP,
LibRepoStructure.LITELOADER_ARTIFACT,
version, classifier, 'jar')
}
} }

View File

@@ -1,16 +0,0 @@
import { BaseMavenRepo } from './BaseMavenRepo'
export class LiteLoaderRepoStructure extends BaseMavenRepo {
constructor(
absoluteRoot: string,
relativeRoot: string
) {
super(absoluteRoot, relativeRoot, 'liteloader')
}
public getLocalLiteLoader(version: string, classifier?: string) {
return this.getArtifactByComponents('com.mumfrey', 'liteloader', version, classifier, 'jar')
}
}

View File

@@ -1,14 +1,10 @@
import { join } from 'path' import { join } from 'path'
import { BaseFileStructure } from '../BaseFileStructure' import { BaseFileStructure } from '../BaseFileStructure'
import { ForgeRepoStructure } from './forgerepo.struct'
import { LibRepoStructure } from './librepo.struct' import { LibRepoStructure } from './librepo.struct'
import { LiteLoaderRepoStructure } from './liteloaderrepo.struct'
import { VersionRepoStructure } from './versionrepo.struct' import { VersionRepoStructure } from './versionrepo.struct'
export class RepoStructure extends BaseFileStructure { export class RepoStructure extends BaseFileStructure {
private forgeRepoStruct: ForgeRepoStructure
private liteloaderRepoStruct: LiteLoaderRepoStructure
private libRepoStruct: LibRepoStructure private libRepoStruct: LibRepoStructure
private versionRepoStruct: VersionRepoStructure private versionRepoStruct: VersionRepoStructure
@@ -17,28 +13,16 @@ export class RepoStructure extends BaseFileStructure {
relativeRoot: string relativeRoot: string
) { ) {
super(absoluteRoot, relativeRoot, 'repo') super(absoluteRoot, relativeRoot, 'repo')
this.forgeRepoStruct = new ForgeRepoStructure(this.containerDirectory, this.relativeRoot)
this.liteloaderRepoStruct = new LiteLoaderRepoStructure(this.containerDirectory, this.relativeRoot)
this.libRepoStruct = new LibRepoStructure(this.containerDirectory, this.relativeRoot) this.libRepoStruct = new LibRepoStructure(this.containerDirectory, this.relativeRoot)
this.versionRepoStruct = new VersionRepoStructure(this.containerDirectory, this.relativeRoot) this.versionRepoStruct = new VersionRepoStructure(this.containerDirectory, this.relativeRoot)
} }
public async init() { public async init() {
super.init() super.init()
await this.forgeRepoStruct.init()
await this.liteloaderRepoStruct.init()
await this.libRepoStruct.init() await this.libRepoStruct.init()
await this.versionRepoStruct.init() await this.versionRepoStruct.init()
} }
public getForgeRepoStruct() {
return this.forgeRepoStruct
}
public getLiteLoaderRepoStruct() {
return this.liteloaderRepoStruct
}
public getLibRepoStruct() { public getLibRepoStruct() {
return this.libRepoStruct return this.libRepoStruct
} }

View File

@@ -4,7 +4,6 @@ import { basename, dirname, join } from 'path'
import { VersionManifest113 } from '../../../model/forge/versionmanifest113' import { VersionManifest113 } from '../../../model/forge/versionmanifest113'
import { Module } from '../../../model/spec/module' import { Module } from '../../../model/spec/module'
import { Type } from '../../../model/spec/type' import { Type } from '../../../model/spec/type'
import { ForgeRepoStructure } from '../../../model/struct/repo/forgerepo.struct'
import { LibRepoStructure } from '../../../model/struct/repo/librepo.struct' import { LibRepoStructure } from '../../../model/struct/repo/librepo.struct'
import { JavaUtil } from '../../../util/javautil' import { JavaUtil } from '../../../util/javautil'
import { MavenUtil } from '../../../util/maven' import { MavenUtil } from '../../../util/maven'
@@ -36,15 +35,15 @@ export class Forge113Adapter extends ForgeResolver {
} }
private async process() { private async process() {
const forgeRepo = this.repoStructure.getForgeRepoStruct() const libRepo = this.repoStructure.getLibRepoStruct()
const installerPath = forgeRepo.getLocalForge(this.artifactVersion, 'installer') const installerPath = libRepo.getLocalForge(this.artifactVersion, 'installer')
console.debug(`Checking for forge installer at ${installerPath}..`) console.debug(`Checking for forge installer at ${installerPath}..`)
if (!await forgeRepo.artifactExists(installerPath)) { if (!await libRepo.artifactExists(installerPath)) {
console.debug(`Forge installer not found locally, initializing download..`) console.debug(`Forge installer not found locally, initializing download..`)
await forgeRepo.downloadArtifactByComponents( await libRepo.downloadArtifactByComponents(
this.REMOTE_REPOSITORY, this.REMOTE_REPOSITORY,
ForgeRepoStructure.FORGE_GROUP, LibRepoStructure.FORGE_GROUP,
ForgeRepoStructure.FORGE_ARTIFACT, LibRepoStructure.FORGE_ARTIFACT,
this.artifactVersion, 'installer', 'jar' this.artifactVersion, 'installer', 'jar'
) )
} else { } else {
@@ -158,22 +157,22 @@ export class Forge113Adapter extends ForgeResolver {
const generatedFiles = [ const generatedFiles = [
{ {
name: 'base jar', name: 'base jar',
group: ForgeRepoStructure.FORGE_GROUP, group: LibRepoStructure.FORGE_GROUP,
artifact: ForgeRepoStructure.FORGE_ARTIFACT, artifact: LibRepoStructure.FORGE_ARTIFACT,
version: this.artifactVersion, version: this.artifactVersion,
classifier: undefined classifier: undefined
}, },
{ {
name: 'universal jar', name: 'universal jar',
group: ForgeRepoStructure.FORGE_GROUP, group: LibRepoStructure.FORGE_GROUP,
artifact: ForgeRepoStructure.FORGE_ARTIFACT, artifact: LibRepoStructure.FORGE_ARTIFACT,
version: this.artifactVersion, version: this.artifactVersion,
classifier: 'universal' classifier: 'universal'
}, },
{ {
name: 'client jar', name: 'client jar',
group: ForgeRepoStructure.FORGE_GROUP, group: LibRepoStructure.FORGE_GROUP,
artifact: ForgeRepoStructure.FORGE_ARTIFACT, artifact: LibRepoStructure.FORGE_ARTIFACT,
version: this.artifactVersion, version: this.artifactVersion,
classifier: 'client' classifier: 'client'
}, },

View File

@@ -5,7 +5,7 @@ import { basename, join } from 'path'
import { VersionManifest17 } from '../../../model/forge/versionmanifest17' import { VersionManifest17 } from '../../../model/forge/versionmanifest17'
import { Module } from '../../../model/spec/module' import { Module } from '../../../model/spec/module'
import { Type } from '../../../model/spec/type' import { Type } from '../../../model/spec/type'
import { ForgeRepoStructure } from '../../../model/struct/repo/forgerepo.struct' import { LibRepoStructure } from '../../../model/struct/repo/librepo.struct'
import { MavenUtil } from '../../../util/maven' import { MavenUtil } from '../../../util/maven'
import { PackXZExtractWrapper } from '../../../util/PackXZExtractWrapper' import { PackXZExtractWrapper } from '../../../util/PackXZExtractWrapper'
import { VersionUtil } from '../../../util/versionutil' import { VersionUtil } from '../../../util/versionutil'
@@ -36,15 +36,15 @@ export class Forge17Adapter extends ForgeResolver {
} }
public async getForgeByVersion() { public async getForgeByVersion() {
const forgeRepo = this.repoStructure.getForgeRepoStruct() const libRepo = this.repoStructure.getLibRepoStruct()
const targetLocalPath = forgeRepo.getLocalForge(this.artifactVersion, 'universal') const targetLocalPath = libRepo.getLocalForge(this.artifactVersion, 'universal')
console.debug(`Checking for forge version at ${targetLocalPath}..`) console.debug(`Checking for forge version at ${targetLocalPath}..`)
if (!await forgeRepo.artifactExists(targetLocalPath)) { if (!await libRepo.artifactExists(targetLocalPath)) {
console.debug(`Forge not found locally, initializing download..`) console.debug(`Forge not found locally, initializing download..`)
await forgeRepo.downloadArtifactByComponents( await libRepo.downloadArtifactByComponents(
this.REMOTE_REPOSITORY, this.REMOTE_REPOSITORY,
ForgeRepoStructure.FORGE_GROUP, LibRepoStructure.FORGE_GROUP,
ForgeRepoStructure.FORGE_ARTIFACT, LibRepoStructure.FORGE_ARTIFACT,
this.artifactVersion, 'universal', 'jar') this.artifactVersion, 'universal', 'jar')
} else { } else {
console.debug('Using locally discovered forge.') console.debug('Using locally discovered forge.')
@@ -72,8 +72,8 @@ export class Forge17Adapter extends ForgeResolver {
const forgeModule: Module = { const forgeModule: Module = {
id: MavenUtil.mavenComponentsToIdentifier( id: MavenUtil.mavenComponentsToIdentifier(
ForgeRepoStructure.FORGE_GROUP, LibRepoStructure.FORGE_GROUP,
ForgeRepoStructure.FORGE_ARTIFACT, LibRepoStructure.FORGE_ARTIFACT,
this.artifactVersion, 'universal' this.artifactVersion, 'universal'
), ),
name: 'Minecraft Forge', name: 'Minecraft Forge',
@@ -81,10 +81,10 @@ export class Forge17Adapter extends ForgeResolver {
artifact: this.generateArtifact( artifact: this.generateArtifact(
forgeUniversalBuffer, forgeUniversalBuffer,
await lstat(targetLocalPath), await lstat(targetLocalPath),
forgeRepo.getArtifactUrlByComponents( libRepo.getArtifactUrlByComponents(
this.baseUrl, this.baseUrl,
ForgeRepoStructure.FORGE_GROUP, LibRepoStructure.FORGE_GROUP,
ForgeRepoStructure.FORGE_ARTIFACT, LibRepoStructure.FORGE_ARTIFACT,
this.artifactVersion, 'universal' this.artifactVersion, 'universal'
) )
), ),
@@ -100,7 +100,6 @@ export class Forge17Adapter extends ForgeResolver {
} }
console.debug(`Processing ${lib.name}..`) console.debug(`Processing ${lib.name}..`)
const libRepo = this.repoStructure.getLibRepoStruct()
const extension = this.determineExtension(lib.checksums) const extension = this.determineExtension(lib.checksums)
const localPath = libRepo.getArtifactById(lib.name, extension) as string const localPath = libRepo.getArtifactById(lib.name, extension) as string