mirror of
https://github.com/Anvilcraft/modpacktools
synced 2024-09-30 04:59:05 +02:00
cleanup
This commit is contained in:
parent
b795dc1d79
commit
b3cd41f215
5 changed files with 84 additions and 88 deletions
|
@ -2,7 +2,6 @@ package ley.anvil.modpacktools.commands
|
||||||
|
|
||||||
import j2html.TagCreator.*
|
import j2html.TagCreator.*
|
||||||
import j2html.utils.CSSMin.compressCss
|
import j2html.utils.CSSMin.compressCss
|
||||||
import ley.anvil.addonscript.maven.ArtifactDestination
|
|
||||||
import ley.anvil.addonscript.wrapper.ASWrapper
|
import ley.anvil.addonscript.wrapper.ASWrapper
|
||||||
import ley.anvil.addonscript.wrapper.ArtifactDestination
|
import ley.anvil.addonscript.wrapper.ArtifactDestination
|
||||||
import ley.anvil.addonscript.wrapper.MetaData
|
import ley.anvil.addonscript.wrapper.MetaData
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
package ley.anvil.modpacktools.util
|
|
||||||
|
|
||||||
import ley.anvil.addonscript.curse.ManifestJSON
|
|
||||||
import ley.anvil.addonscript.wrapper.ASWrapper
|
|
||||||
|
|
||||||
fun convertAStoManifest(addonscript: ASWrapper): ManifestLinksPair {
|
|
||||||
var ml = ManifestLinksPair()
|
|
||||||
var ver = addonscript.defaultVersion
|
|
||||||
var manifest = ManifestJSON()
|
|
||||||
|
|
||||||
var mcv = ver.version?.mcversion!![0]
|
|
||||||
manifest.minecraft = ManifestJSON.Minecraft()
|
|
||||||
manifest.minecraft.version = mcv
|
|
||||||
manifest.minecraft.modLoaders = mutableListOf()
|
|
||||||
manifest.files = mutableListOf()
|
|
||||||
|
|
||||||
manifest.manifestType = "minecraftModpack"
|
|
||||||
manifest.manifestVersion = 1
|
|
||||||
manifest.name = addonscript.json.meta!!.name
|
|
||||||
if (manifest.name == null)
|
|
||||||
manifest.name = addonscript.json.id
|
|
||||||
manifest.version = ver.versionName
|
|
||||||
manifest.author = addonscript.json!!.meta!!.contributors[0].name
|
|
||||||
|
|
||||||
|
|
||||||
for (rel in ver.getRelations(arrayOf("client"), null)) {
|
|
||||||
if (rel.isModloader) {
|
|
||||||
if (rel.relation.id == "forge") {
|
|
||||||
var forge = ManifestJSON.Modloader()
|
|
||||||
forge.primary = true
|
|
||||||
forge.id = "forge-" + rel.versions.latestKnown
|
|
||||||
manifest.minecraft.modLoaders.add(forge)
|
|
||||||
} else {
|
|
||||||
println("Curse only allows Forge as a modloader. " + rel.relation.id + " is not allowed!")
|
|
||||||
}
|
|
||||||
} else if (rel.hasFile()) {
|
|
||||||
var file = rel.file
|
|
||||||
if (file.file.installer == "internal.jar") {
|
|
||||||
println("internal.jar is not supportet on Curse")
|
|
||||||
continue
|
|
||||||
} else if (file.isArtifact) {
|
|
||||||
var art = file.artifact
|
|
||||||
if (art.isCurseforge) {
|
|
||||||
var f = ManifestJSON.File()
|
|
||||||
f.fileID = art.fileID
|
|
||||||
f.projectID = art.projectID
|
|
||||||
f.required = rel.options.contains("required")
|
|
||||||
manifest.files.add(f);
|
|
||||||
}
|
|
||||||
} else if (rel.options.contains("required")) {
|
|
||||||
ml.links.put(file.get(), file.file.installer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (file in ver.getFiles(arrayOf("client", "required"), null)) {
|
|
||||||
if (file.file.installer == "internal.jar") {
|
|
||||||
println("internal.jar is not supportet on Curse")
|
|
||||||
continue
|
|
||||||
} else if (file.isArtifact) {
|
|
||||||
var art = file.artifact
|
|
||||||
if (art.isCurseforge) {
|
|
||||||
var f = ManifestJSON.File()
|
|
||||||
f.fileID = art.fileID
|
|
||||||
f.projectID = art.projectID
|
|
||||||
f.required = true
|
|
||||||
manifest.files.add(f);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ml.links.put(file.get(), file.file.installer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ml.manifest = manifest
|
|
||||||
|
|
||||||
return ml
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package ley.anvil.modpacktools.util
|
|
||||||
|
|
||||||
import ley.anvil.addonscript.curse.ManifestJSON
|
|
||||||
import ley.anvil.addonscript.wrapper.FileOrLink
|
|
||||||
|
|
||||||
class ManifestLinksPair {
|
|
||||||
|
|
||||||
var manifest: ManifestJSON? = null
|
|
||||||
var links: MutableMap<FileOrLink, String> = HashMap()
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package ley.anvil.modpacktools.util.manifest
|
||||||
|
|
||||||
|
import ley.anvil.addonscript.curse.ManifestJSON
|
||||||
|
import ley.anvil.addonscript.wrapper.ASWrapper
|
||||||
|
|
||||||
|
fun convertAStoManifest(addonscript: ASWrapper): ManifestLinksPair {
|
||||||
|
val ml = ManifestLinksPair()
|
||||||
|
val ver = addonscript.defaultVersion
|
||||||
|
val manifest = ManifestJSON()
|
||||||
|
|
||||||
|
val mcv = ver.version!!.mcversion[0]
|
||||||
|
manifest.minecraft = ManifestJSON.Minecraft()
|
||||||
|
manifest.minecraft.version = mcv
|
||||||
|
manifest.minecraft.modLoaders = mutableListOf()
|
||||||
|
manifest.files = mutableListOf()
|
||||||
|
|
||||||
|
manifest.manifestType = "minecraftModpack"
|
||||||
|
manifest.manifestVersion = 1
|
||||||
|
manifest.name = addonscript.json.meta!!.name ?: addonscript.json.id
|
||||||
|
manifest.version = ver.versionName
|
||||||
|
manifest.author = addonscript.json!!.meta!!.contributors[0].name
|
||||||
|
|
||||||
|
|
||||||
|
for(rel in ver.getRelations(arrayOf("client"), null)) {
|
||||||
|
if(rel.isModloader) {
|
||||||
|
if(rel.relation.id == "forge") {
|
||||||
|
val forge = ManifestJSON.Modloader()
|
||||||
|
forge.primary = true
|
||||||
|
forge.id = "forge-" + rel.versions.latestKnown
|
||||||
|
manifest.minecraft.modLoaders.add(forge)
|
||||||
|
} else {
|
||||||
|
println("Curse only allows Forge as a modloader. ${rel.relation.id} is not allowed!")
|
||||||
|
}
|
||||||
|
} else if(rel.hasFile()) {
|
||||||
|
val file = rel.file
|
||||||
|
//TODO deduplicate this
|
||||||
|
if(file.file.installer == "internal.jar") {
|
||||||
|
println("internal.jar is not supported on Curse")
|
||||||
|
continue
|
||||||
|
} else if(file.isArtifact) {
|
||||||
|
val art = file.artifact
|
||||||
|
if(art.isCurseforge) {
|
||||||
|
val f = ManifestJSON.File()
|
||||||
|
f.fileID = art.fileID
|
||||||
|
f.projectID = art.projectID
|
||||||
|
f.required = rel.options.contains("required")
|
||||||
|
manifest.files.add(f)
|
||||||
|
}
|
||||||
|
} else if(rel.options.contains("required")) {
|
||||||
|
ml.links[file.get()] = file.file.installer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(file in ver.getFiles(arrayOf("client", "required"), null)) {
|
||||||
|
if(file.file.installer == "internal.jar") {
|
||||||
|
println("internal.jar is not supported on Curse")
|
||||||
|
continue
|
||||||
|
} else if(file.isArtifact) {
|
||||||
|
val art = file.artifact
|
||||||
|
if(art.isCurseforge) {
|
||||||
|
val f = ManifestJSON.File()
|
||||||
|
f.fileID = art.fileID
|
||||||
|
f.projectID = art.projectID
|
||||||
|
f.required = true
|
||||||
|
manifest.files.add(f)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ml.links[file.get()] = file.file.installer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ml.manifest = manifest
|
||||||
|
|
||||||
|
return ml
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package ley.anvil.modpacktools.util.manifest
|
||||||
|
|
||||||
|
import ley.anvil.addonscript.curse.ManifestJSON
|
||||||
|
import ley.anvil.addonscript.wrapper.FileOrLink
|
||||||
|
|
||||||
|
data class ManifestLinksPair (
|
||||||
|
var manifest: ManifestJSON? = null,
|
||||||
|
var links: MutableMap<FileOrLink, String> = mutableMapOf()
|
||||||
|
)
|
Loading…
Reference in a new issue