Skip to content

Commit

Permalink
skip zipMod if no mod meta instead of not registered
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Dec 21, 2023
1 parent ed1fe9e commit 0ddbbf7
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions main/src/plugin/Json.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,27 @@ class MindustryJsonPlugin : Plugin<Project> {
val x = extensions.getOrCreate<MindustryExtension>(R.x.mindustry)
val assets = extensions.getOrCreate<MindustryAssetsExtension>(R.x.mindustryAssets)
val deployX = extensions.getOrCreate<DeployModExtension>(R.x.deployMod)
val zipMod = tasks.register<Zip>(R.task.zipMod) {
this.group = R.taskGroup.mindustry
archiveBaseName.set(deployX._baseName)
archiveVersion.set(deployX._version)
archiveClassifier.set(deployX._classifier)
destinationDirectory.set(layout.buildDirectory.dir("libs"))
}
target.afterEvaluateThis {
if (x._modMeta.isPresent) {
tasks.register<Zip>(R.task.zipMod) {
this.group = R.taskGroup.mindustry
from(assets.assets)
from(assets._icon)
from(tasks.getByPath(R.task.genModHjson))
archiveBaseName.set(deployX._baseName)
archiveVersion.set(deployX._version)
archiveClassifier.set(deployX._classifier)
destinationDirectory.set(layout.buildDirectory.dir("libs"))
}
x._modMeta.get().apply {
// json or js mod doesn't have a main class
main = null
java = false
zipMod.configure {
it.enabled = x._modMeta.isPresent
if (x._modMeta.isPresent) {
it.from(assets.assets)
it.from(assets._icon)
it.from(tasks.getByPath(R.task.genModHjson))
}
}
x._modMeta.orNull?.apply {
// json or js mod doesn't have a main class
main = null
java = false
}
}
}
}
Expand Down

0 comments on commit 0ddbbf7

Please sign in to comment.