mirror of
https://github.com/Anvilcraft/modpacktools
synced 2024-11-18 07:52:15 +01:00
bump version
added --all argument to BuildTwitch
This commit is contained in:
parent
91e3d1360b
commit
d56f926435
3 changed files with 19 additions and 6 deletions
|
@ -11,7 +11,7 @@ val implTitle = "ley.anvil.modpacktools"
|
|||
group = "ley.anvil"
|
||||
application.mainClassName = "ley.anvil.modpacktools.Main"
|
||||
|
||||
version = "1.1-SNAPSHOT"
|
||||
version = "1.2-SNAPSHOT"
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
|
|
|
@ -14,6 +14,7 @@ import ley.anvil.modpacktools.util.manifest.convertAStoManifest
|
|||
import ley.anvil.modpacktools.util.mergeTo
|
||||
import ley.anvil.modpacktools.util.toZip
|
||||
import net.sourceforge.argparse4j.ArgumentParsers
|
||||
import net.sourceforge.argparse4j.impl.Arguments.storeTrue
|
||||
import net.sourceforge.argparse4j.inf.ArgumentParser
|
||||
import net.sourceforge.argparse4j.inf.Namespace
|
||||
import org.apache.commons.io.FileUtils
|
||||
|
@ -31,6 +32,11 @@ object BuildTwitch : ICommand {
|
|||
override val parser: ArgumentParser = ArgumentParsers.newFor("BuildTwitch")
|
||||
.build()
|
||||
.description(helpMessage)
|
||||
.apply {
|
||||
addArgument("-a", "--all")
|
||||
.help("Downloads all relations instead of just required ones")
|
||||
.action(storeTrue())
|
||||
}
|
||||
|
||||
private val tempDir by lazy {File(CONFIG.config.pathOrException<String>("Locations/tempDir"))}
|
||||
private val tmp: File by lazy {File(tempDir, "twitch")}
|
||||
|
@ -38,7 +44,7 @@ object BuildTwitch : ICommand {
|
|||
|
||||
override fun execute(args: Namespace): CommandReturn {
|
||||
val wr = MPJH.asWrapper!!
|
||||
val ml = convertAStoManifest(wr)
|
||||
val ml = convertAStoManifest(wr) {args.getBoolean("all") || "required" in it.options}
|
||||
val archiveName = "${wr.json.id}-${wr.defaultVersion.versionName}-twitch"
|
||||
val dir = File("./build")
|
||||
val toDownload = mutableMapOf<URL, Pair<File, String>>()
|
||||
|
@ -57,7 +63,7 @@ object BuildTwitch : ICommand {
|
|||
if(uf.key.isFile) {
|
||||
if(!uf.key.isASDirSet)
|
||||
uf.key.setASDir(srcDir)
|
||||
val file = uf.key.getFile()
|
||||
val file = uf.key.file
|
||||
if(file.exists()) {
|
||||
installFile(uf.value, file).apply {println(this)}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,14 @@ package ley.anvil.modpacktools.util.manifest
|
|||
import ley.anvil.addonscript.curse.ManifestJSON
|
||||
import ley.anvil.addonscript.wrapper.ASWrapper
|
||||
|
||||
fun convertAStoManifest(addonscript: ASWrapper): ManifestLinksPair {
|
||||
/**
|
||||
* Converts a AS file to a twitch manifest
|
||||
*
|
||||
* @param addonscript the file to convert
|
||||
* @param shouldAddLink if a link for a given relation should be added, does not get called if the relations is a curseforge artifact
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun convertAStoManifest(addonscript: ASWrapper, shouldAddLink: (ASWrapper.RelationWrapper) -> Boolean = {true}): ManifestLinksPair {
|
||||
val ml = ManifestLinksPair()
|
||||
val ver = addonscript.defaultVersion
|
||||
val manifest = ManifestJSON()
|
||||
|
@ -43,10 +50,10 @@ fun convertAStoManifest(addonscript: ASWrapper): ManifestLinksPair {
|
|||
val f = ManifestJSON.File()
|
||||
f.fileID = art.fileID
|
||||
f.projectID = art.projectID
|
||||
f.required = rel.options.contains("required")
|
||||
f.required = "required" in rel.options
|
||||
manifest.files.add(f)
|
||||
}
|
||||
} else if(rel.options.contains("required")) {
|
||||
} else if(shouldAddLink(rel)) {
|
||||
ml.links[file.get()] = file.file.installer
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue