Skip to content

Commit

Permalink
renamed property in ModHjsonGenerate task
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Dec 18, 2023
1 parent cce12ff commit 8789c97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main/src/plugin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MindustryPlugin : Plugin<Project> {
tasks.register<ModHjsonGenerate>(R.task.genModHjson) {
group = R.taskGroup.mindustry
modMeta.set(ex._modMeta)
outputHjson.set(temporaryDir.resolve("mod.hjson"))
output.set(temporaryDir.resolve("mod.hjson"))
}
if (plugins.hasPlugin<JavaPlugin>()) {
plugins.apply<MindustryJavaPlugin>()
Expand Down
13 changes: 8 additions & 5 deletions main/src/task/ModHjsonGenerate.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.liplum.mindustry

import io.github.liplum.dsl.ensureParentDir
import io.github.liplum.dsl.fileProp
import io.github.liplum.dsl.prop
import io.github.liplum.mindustry.ModMeta.Companion.toHjson
Expand All @@ -11,13 +12,15 @@ import org.gradle.api.tasks.TaskAction
open class ModHjsonGenerate : DefaultTask() {
val modMeta = project.prop<ModMeta>()
@Input get
val outputHjson = project.fileProp()
val output = project.fileProp()
@OutputFile get

@TaskAction
fun generate() {
val modHjson = outputHjson.get()
modHjson.parentFile.mkdirs()
modHjson.writeText(modMeta.get().toHjson())
logger.info("ModHjson is generated at ${modHjson.absolutePath} .")
val output = output.get()
output.ensureParentDir()
val modMetaText = modMeta.get().toHjson()
output.writeText(modMetaText)
logger.info("mod.hjson was generated at ${output.absolutePath} .")
}
}

0 comments on commit 8789c97

Please sign in to comment.