try fixing gradle config cache errors
This commit is contained in:
parent
24e4cdf329
commit
5656acd350
7 changed files with 128 additions and 56 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import dev.adamko.kafkatorio.gradle.asConsumer
|
||||
import dev.adamko.kafkatorio.gradle.asProvider
|
||||
import dev.adamko.kafkatorio.gradle.dropDirectories
|
||||
import dev.adamko.kafkatorio.gradle.factorioModAttributes
|
||||
import dev.adamko.kafkatorio.gradle.typescriptAttributes
|
||||
import dev.adamko.kafkatorio.task.TypescriptToLuaTask
|
||||
|
|
@ -11,15 +12,15 @@ plugins {
|
|||
distribution
|
||||
}
|
||||
|
||||
description =
|
||||
"Sends in-game information to a server over the internet (requires Kafkatorio Kafka-Pipe)"
|
||||
description = "Sends in-game information to a server over the internet (requires additional setup)"
|
||||
|
||||
|
||||
// Factorio required format is:
|
||||
// - filename: `mod-name_version.zip`
|
||||
// - zip contains one directory, `mod-name`
|
||||
|
||||
val modName: String by extra { "${rootProject.name}-events" }
|
||||
val distributionZipName: String by extra { "${modName}_${project.version}.zip" }
|
||||
val distributionZipName: String by extra { "${modName}_${rootProject.version}.zip" }
|
||||
|
||||
// version of Factorio that the mod is compatible with (must only be "major.minor" - patch causes error)
|
||||
val modFactorioCompatibility: Provider<String> =
|
||||
|
|
@ -27,10 +28,11 @@ val modFactorioCompatibility: Provider<String> =
|
|||
|
||||
val licenseFile: RegularFile by rootProject.extra
|
||||
val projectTokens: MapProperty<String, String> by rootProject.extra
|
||||
val modDescription: String by project.extra { project.description ?: "" }
|
||||
projectTokens.apply {
|
||||
put("mod.name", modName)
|
||||
put("mod.title", "Kafkatorio Events")
|
||||
put("mod.description", provider { project.description }.orElse(""))
|
||||
put("mod.description", modDescription)
|
||||
put("factorio.version", modFactorioCompatibility)
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +43,7 @@ node {
|
|||
nodeProjectDir.set(tsSrcDir)
|
||||
}
|
||||
|
||||
|
||||
val typescriptEventsSchema: Configuration by configurations.creating {
|
||||
description = "Fetch the TypeScript schema from the event-schema subproject"
|
||||
asConsumer()
|
||||
|
|
@ -82,9 +85,7 @@ val installEventsTsSchema by tasks.registering(Sync::class) {
|
|||
}
|
||||
) {
|
||||
// drop the first directory inside the zip
|
||||
eachFile {
|
||||
relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
|
||||
}
|
||||
eachFile { relativePath = dropDirectories() }
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
into(outputDir)
|
||||
|
|
@ -123,7 +124,6 @@ distributions {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -163,8 +163,11 @@ val factorioModProvider by configurations.registering {
|
|||
}
|
||||
|
||||
|
||||
val packageJsonName = providers.provider { "${rootProject.name}-${project.name}" }
|
||||
|
||||
tasks.updatePackageJson {
|
||||
propertiesToCheck.put("name", providers.provider { "${rootProject.name}-${project.name}" })
|
||||
inputs.property("packageJsonName", packageJsonName)
|
||||
propertiesToCheck.put("name", packageJsonName)
|
||||
packageJsonFile.set(layout.projectDirectory.file("src/main/typescript/package.json"))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import dev.adamko.kafkatorio.gradle.asProvider
|
||||
import dev.adamko.kafkatorio.gradle.typescriptAttributes
|
||||
import dev.adamko.kafkatorio.task.GenerateTypescriptTask
|
||||
|
||||
|
||||
plugins {
|
||||
|
|
@ -106,56 +107,78 @@ kotlin {
|
|||
}
|
||||
}
|
||||
|
||||
val jvmJar: TaskProvider<Jar> = tasks.named<Jar>(kotlin.jvm().artifactsTaskName)
|
||||
val mainCompilation: Provider<FileCollection> =
|
||||
kotlin.jvm().compilations.named("main").map { it.runtimeDependencyFiles }
|
||||
|
||||
val generateTypescript by tasks.registering(JavaExec::class) {
|
||||
group = "kt2ts"
|
||||
|
||||
val jvmJar = tasks.named<Jar>(kotlin.jvm().artifactsTaskName)
|
||||
val generateTypescript by tasks.registering(GenerateTypescriptTask::class) {
|
||||
dependsOn(jvmJar)
|
||||
|
||||
val mainCompilation = kotlin.jvm().compilations.named("main").map { it.runtimeDependencyFiles }
|
||||
// dependsOn(mainCompilation)
|
||||
inputs.files(mainCompilation)
|
||||
|
||||
classpath(
|
||||
jvmJar,
|
||||
mainCompilation
|
||||
mainCompilation,
|
||||
)
|
||||
|
||||
// mainClass.set("dev.adamko.kafkatorio.events.schema.Kt2tsKt")
|
||||
output.set(layout.buildDirectory.dir("generated/typescript"))
|
||||
mainClass.set("dev.adamko.kafkatorio.events.schema.Kt2ts2Kt")
|
||||
args(temporaryDir.canonicalPath)
|
||||
}
|
||||
|
||||
val tempOutputDirectory = file("$temporaryDir")
|
||||
args(tempOutputDirectory)
|
||||
//val generateTypescript2 by tasks.registering(JavaExec::class) {
|
||||
// group = "kt2ts"
|
||||
//
|
||||
// dependsOn(jvmJar)
|
||||
//
|
||||
// inputs.files(mainCompilation)
|
||||
//
|
||||
// classpath(
|
||||
// jvmJar,
|
||||
// mainCompilation,
|
||||
// )
|
||||
// mainClass.set("dev.adamko.kafkatorio.events.schema.Kt2ts2Kt")
|
||||
//
|
||||
// args(temporaryDir)
|
||||
//
|
||||
// val buildOutput = layout.buildDirectory.dir("generated/typescript")
|
||||
// outputs.dir(buildOutput)
|
||||
//
|
||||
// doFirst {
|
||||
// delete(temporaryDir)
|
||||
// mkdir(temporaryDir)
|
||||
// }
|
||||
//
|
||||
// doLast {
|
||||
// sync {
|
||||
// from(temporaryDir)
|
||||
// into(buildOutput)
|
||||
// include("**/*.ts")
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
val buildOutput = layout.buildDirectory.dir("generated/typescript")
|
||||
outputs.dir(buildOutput)
|
||||
|
||||
doFirst {
|
||||
delete(temporaryDir)
|
||||
mkdir(temporaryDir)
|
||||
}
|
||||
|
||||
doLast {
|
||||
sync {
|
||||
from(temporaryDir)
|
||||
into(buildOutput)
|
||||
include("**/*.ts")
|
||||
}
|
||||
}
|
||||
val schemaTsDistributionName = providers.provider {
|
||||
"${rootProject.name}-${project.name}"
|
||||
}
|
||||
|
||||
val schemaTs by distributions.registering {
|
||||
distributionBaseName.set("${rootProject.name}-${project.name}")
|
||||
distributionBaseName.set(schemaTsDistributionName)
|
||||
contents {
|
||||
from(generateTypescript.map { it.outputs.files.asFileTree })
|
||||
}
|
||||
}
|
||||
|
||||
val schemaTsZipTask = tasks.named<Zip>("${schemaTs.name}DistZip")
|
||||
|
||||
val typescriptModelGenerated: Configuration by configurations.creating {
|
||||
asProvider()
|
||||
typescriptAttributes(objects)
|
||||
|
||||
val schemaTsZipTask = tasks.named<Zip>("${schemaTs.name}DistZip")
|
||||
outgoing.artifact(schemaTsZipTask.flatMap { it.archiveFile })
|
||||
}
|
||||
|
||||
|
||||
tasks.matching {
|
||||
it.name == "jsGenerateExternalsIntegrated"
|
||||
}.configureEach {
|
||||
@Suppress("UnstableApiUsage")
|
||||
notCompatibleWithConfigurationCache("try to prevent 'Projects must be configuring' error")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue