add some hacks to try and stop 'Projects must be configuring' bug

This commit is contained in:
Adam 2022-05-14 12:23:58 +02:00
parent ffe9bcb9a8
commit 6618a92a66
5 changed files with 145 additions and 20 deletions

View file

@ -7,7 +7,8 @@ plugins {
`project-report` `project-report`
`build-dashboard` `build-dashboard`
kotlin("multiplatform") apply false // try to stop error 'Projects must be configuring' // kotlin("multiplatform") apply false // try to stop error 'Projects must be configuring'
kotlin("js") apply false // try to stop error 'Projects must be configuring'
} }
group = "dev.adamko.kafkatorio" group = "dev.adamko.kafkatorio"
@ -73,3 +74,29 @@ val runWebMap by tasks.registering {
dependsOn(":modules:web-map:browserDevelopmentRun") dependsOn(":modules:web-map:browserDevelopmentRun")
} }
// projects must be configuring hack
val hackLinePrefix = "// projects must be configuring hack "
gradle.beforeSettings {
val buildGradleKts: File =
// project.buildFile
layout.projectDirectory.file("buildSrc/build.gradle.kts").asFile
val hackedLines = buildGradleKts.readText()
.lines()
.joinToString(System.lineSeparator()) {
println("hacking $it")
when {
it.startsWith(hackLinePrefix) -> "$hackLinePrefix ${System.currentTimeMillis()}"
else -> it
}
}
buildGradleKts.writeText(hackedLines)
}
tasks.configureEach {
inputs.property("pRoJeCtS-mUsT-bE-cOnFiGuRiNg", System.currentTimeMillis())
}

View file

@ -102,3 +102,10 @@ idea {
isDownloadJavadoc = true isDownloadJavadoc = true
} }
} }
// projects must be configuring hack
tasks.configureEach {
inputs.property("pRoJeCtS-mUsT-bE-cOnFiGuRiNg", System.currentTimeMillis())
}

View file

@ -9,3 +9,12 @@ org.gradle.unsafe.configuration-cache=true
org.gradle.unsafe.configuration-cache-problems=warn org.gradle.unsafe.configuration-cache-problems=warn
org.gradle.kotlin.dsl.precompiled.accessors.strict=true org.gradle.kotlin.dsl.precompiled.accessors.strict=true
org.gradle.parallel=true
io.kvision.plugin.enableGradleTasks=true
io.kvision.plugin.enableWorkerTasks=false
io.kvision.plugin.enableWebpackVersions=false
io.kvision.plugin.enableHiddenKotlinJsStore=false
io.kvision.plugin.enableSecureResolutions=false
io.kvision.plugin.enableBackendTasks=false

View file

@ -77,9 +77,13 @@ kotlin {
implementation(project.dependencies.platform(libs.kotest.bom)) implementation(project.dependencies.platform(libs.kotest.bom))
implementation("io.kotest:kotest-framework-engine") implementation("io.kotest:kotest-framework-engine")
implementation("io.kotest:kotest-assertions-core") // implementation("io.kotest:kotest-assertions-core")
implementation("io.kotest:kotest-property") // implementation("io.kotest:kotest-property")
implementation("io.kotest:kotest-assertions-json") // implementation("io.kotest:kotest-assertions-json")
implementation(libs.kotest.core)
implementation(libs.kotest.datatest)
implementation(libs.kotest.prop)
implementation(libs.kotest.json)
} }
} }
@ -155,30 +159,35 @@ val generateTypescript by tasks.registering(GenerateTypescriptTask::class) {
// } // }
//} //}
val schemaTsDistributionName = providers.provider { val schemaTsDistributionName : Provider<String> = providers.provider {
"${rootProject.name}-${project.name}" "${rootProject.name}-${project.name}"
} }
val generateTypescriptOutputFiles: Provider<FileTree> = generateTypescript.map { it.outputs.files.asFileTree }
val schemaTs by distributions.registering { val schemaTs by distributions.registering {
distributionBaseName.set(schemaTsDistributionName) distributionBaseName.set(schemaTsDistributionName)
contents { contents {
from(generateTypescript.map { it.outputs.files.asFileTree }) from(generateTypescriptOutputFiles)
} }
} }
val schemaTsZipTask = tasks.named<Zip>("${schemaTs.name}DistZip") val schemaTsZipTask: TaskProvider<Zip> = tasks.named<Zip>("${schemaTs.name}DistZip")
val schemaTsZipTaskArchiveFile: Provider<RegularFile> = schemaTsZipTask.flatMap { it.archiveFile }
val typescriptModelGenerated: Configuration by configurations.creating { val typescriptModelGenerated: Configuration by configurations.creating {
asProvider() asProvider()
typescriptAttributes(objects) typescriptAttributes(objects)
outgoing.artifact(schemaTsZipTask.flatMap { it.archiveFile }) outgoing.artifact(schemaTsZipTaskArchiveFile)
} }
tasks.matching { //tasks.matching {
it.name == "jsGenerateExternalsIntegrated" // it.name == "jsGenerateExternalsIntegrated"
}.configureEach { //}.configureEach {
@Suppress("UnstableApiUsage") // @Suppress("UnstableApiUsage")
notCompatibleWithConfigurationCache("try to prevent 'Projects must be configuring' error") // notCompatibleWithConfigurationCache("try to prevent 'Projects must be configuring' error")
} //// outputs.upToDateWhen { true }
// dependsOn(":kotlinNpmInstall")
//}

View file

@ -3,13 +3,29 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
plugins { plugins {
dev.adamko.kafkatorio.lang.`kotlin-js` // dev.adamko.kafkatorio.lang.`kotlin-js`
dev.adamko.kafkatorio.lang.`kotlin-multiplatform`
kotlin("plugin.serialization") kotlin("plugin.serialization")
id("io.kvision") id("io.kvision")
} }
project.ext.set("io.kvision.plugin.enableGradleTasks", false)
project.ext.set("io.kvision.plugin.enableWorkerTasks", false)
project.ext.set("io.kvision.plugin.enableWebpackVersions", false)
project.ext.set("io.kvision.plugin.enableHiddenKotlinJsStore", false)
project.ext.set("io.kvision.plugin.enableSecureResolutions", false)
project.ext.set("io.kvision.plugin.enableBackendTasks", false)
kotlin { kotlin {
js(IR) { js(IR) {
browser()
binaries.executable()
}
js("frontend", IR) {
// nodejs() // nodejs()
browser { browser {
runTask { runTask {
@ -22,7 +38,7 @@ kotlin {
"/kv/*" to "http://localhost:8080", "/kv/*" to "http://localhost:8080",
"/kvws/*" to mapOf("target" to "ws://localhost:8080", "ws" to true) "/kvws/*" to mapOf("target" to "ws://localhost:8080", "ws" to true)
), ),
static = mutableListOf("$buildDir/processedResources/js/main") static = mutableListOf("$buildDir/processedResources/frontend/main")
) )
} }
webpackTask { webpackTask {
@ -37,6 +53,10 @@ kotlin {
binaries.executable() binaries.executable()
} }
jvm("backend") {
}
sourceSets { sourceSets {
all { all {
@ -46,7 +66,22 @@ kotlin {
} }
} }
main { val commonMain by getting {
dependencies {
implementation(dependencies.platform(libs.kotlinx.coroutines.bom))
implementation(dependencies.platform(libs.kotlin.jsWrappers.bom))
implementation(libs.kotlinx.coroutines.core)
implementation(projects.modules.eventsSchema)
implementation(libs.kotlinx.html)
}
}
val jsMain by getting {
dependsOn(commonMain)
dependencies { dependencies {
implementation(projects.modules.eventsSchema) implementation(projects.modules.eventsSchema)
@ -77,11 +112,20 @@ kotlin {
implementation(dependencies.platform(npm("node-forge", "^1.3.0"))) implementation(dependencies.platform(npm("node-forge", "^1.3.0")))
} }
val webDir = file("src/main/web") // val webDir = file("src/main/web")
resources.srcDir(webDir) resources.srcDir("src/main/web")
resources.srcDir("src/main/resources")
kotlin.srcDir("src/main/kotlin")
} }
test { val frontendMain by getting {
dependsOn(jsMain)
// resources.srcDir("src/main/web")
// resources.srcDir("src/main/resources")
}
val jsTest by getting {
dependencies { dependencies {
implementation(kotlin("test-js")) implementation(kotlin("test-js"))
@ -89,6 +133,8 @@ kotlin {
// implementation(npm("karma", "^6.3.16")) // implementation(npm("karma", "^6.3.16"))
} }
kotlin.srcDir("src/test/kotlin")
} }
} }
} }
@ -114,3 +160,30 @@ fun KotlinDependencyHandler.kvision(
// resolution("node-forge", "1.3.0") // resolution("node-forge", "1.3.0")
// } // }
//} //}
afterEvaluate {
rootProject.tasks.named("rootPackageJson").configure {
outputs.upToDateWhen { false }
inputs.property("cacheBuster", System.currentTimeMillis())
}
rootProject.tasks.named("kotlinYarnSetup").configure {
outputs.upToDateWhen { false }
inputs.property("cacheBuster", System.currentTimeMillis())
}
rootProject.tasks.named("kotlinNpmCachesSetup").configure {
outputs.upToDateWhen { false }
inputs.property("cacheBuster", System.currentTimeMillis())
}
rootProject.tasks.named("kotlinStoreYarnLock").configure {
outputs.upToDateWhen { false }
inputs.property("cacheBuster", System.currentTimeMillis())
}
}
tasks.configureEach {
inputs.property("pRoJeCtS-mUsT-bE-cOnFiGuRiNg", System.currentTimeMillis())
}
rootProject.tasks.configureEach {
inputs.property("pRoJeCtS-mUsT-bE-cOnFiGuRiNg", System.currentTimeMillis())
}