- more tidying up
- setting up distribution plugin - using more variables for mod config
This commit is contained in:
parent
afbfeda616
commit
7091f7648d
34 changed files with 293 additions and 169 deletions
|
|
@ -4,6 +4,7 @@ import dev.adamko.kafkatorio.gradle.typescriptAttributes
|
|||
plugins {
|
||||
id("dev.adamko.kafkatorio.lang.kotlin-jvm")
|
||||
kotlin("plugin.serialization")
|
||||
distribution
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -18,26 +19,36 @@ dependencies {
|
|||
val generateTypescript by tasks.registering(JavaExec::class) {
|
||||
group = project.name
|
||||
|
||||
val generatedFileName = "$temporaryDir/data-model.ts"
|
||||
inputs.property("generatedFileName", generatedFileName)
|
||||
outputs.file(generatedFileName)
|
||||
val generatedFile = file("$temporaryDir/${project.name}.ts")
|
||||
|
||||
classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||
mainClass.set("dev.adamko.factorioevents.model.Kt2tsKt")
|
||||
args(generatedFileName)
|
||||
mainClass.set("dev.adamko.kafkatorio.events.schema.Kt2tsKt")
|
||||
args(generatedFile)
|
||||
|
||||
val buildOutput = layout.buildDirectory.dir("generated/typescript")
|
||||
outputs.dir(buildOutput)
|
||||
|
||||
doFirst {
|
||||
delete(temporaryDir)
|
||||
mkdir(temporaryDir)
|
||||
}
|
||||
|
||||
doLast {
|
||||
sync { from(temporaryDir); into(buildOutput) }
|
||||
}
|
||||
}
|
||||
|
||||
distributions {
|
||||
main {
|
||||
distributionBaseName.set("${rootProject.name}-${project.name}")
|
||||
contents {
|
||||
from(generateTypescript.map { it.outputs.files.asFileTree })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val typescriptModelGenerated by configurations.registering {
|
||||
asProvider()
|
||||
typescriptAttributes(objects)
|
||||
outgoing.artifact(
|
||||
generateTypescript.map {
|
||||
it.outputs.files.singleFile
|
||||
}
|
||||
)
|
||||
outgoing.artifact(tasks.distZip.flatMap { it.archiveFile })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const val FactorioObjectDataDiscriminatorKey: String = "object_name"
|
|||
|
||||
@Serializable
|
||||
@JsonClassDiscriminator(FactorioObjectDataDiscriminatorKey)
|
||||
sealed class FactorioObjectData {
|
||||
sealed class FactorioObjectData {
|
||||
@SerialName(FactorioObjectDataDiscriminatorKey)
|
||||
abstract val objectName: String
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue