diff --git a/build.gradle.kts b/build.gradle.kts index c802f4b..ab20ab6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,8 @@ plugins { `project-report` `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" @@ -73,3 +74,29 @@ val runWebMap by tasks.registering { 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()) +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index cbac159..571733a 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -102,3 +102,10 @@ idea { isDownloadJavadoc = true } } + +// projects must be configuring hack + + +tasks.configureEach { + inputs.property("pRoJeCtS-mUsT-bE-cOnFiGuRiNg", System.currentTimeMillis()) +} diff --git a/gradle.properties b/gradle.properties index ffa83bb..8e74cde 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,3 +9,12 @@ org.gradle.unsafe.configuration-cache=true org.gradle.unsafe.configuration-cache-problems=warn 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 diff --git a/modules/events-schema/build.gradle.kts b/modules/events-schema/build.gradle.kts index 3bbfd52..6a01f12 100644 --- a/modules/events-schema/build.gradle.kts +++ b/modules/events-schema/build.gradle.kts @@ -77,9 +77,13 @@ kotlin { implementation(project.dependencies.platform(libs.kotest.bom)) implementation("io.kotest:kotest-framework-engine") - implementation("io.kotest:kotest-assertions-core") - implementation("io.kotest:kotest-property") - implementation("io.kotest:kotest-assertions-json") +// implementation("io.kotest:kotest-assertions-core") +// implementation("io.kotest:kotest-property") +// 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 = providers.provider { "${rootProject.name}-${project.name}" } +val generateTypescriptOutputFiles: Provider = generateTypescript.map { it.outputs.files.asFileTree } + val schemaTs by distributions.registering { distributionBaseName.set(schemaTsDistributionName) contents { - from(generateTypescript.map { it.outputs.files.asFileTree }) + from(generateTypescriptOutputFiles) } } -val schemaTsZipTask = tasks.named("${schemaTs.name}DistZip") +val schemaTsZipTask: TaskProvider = tasks.named("${schemaTs.name}DistZip") +val schemaTsZipTaskArchiveFile: Provider = schemaTsZipTask.flatMap { it.archiveFile } val typescriptModelGenerated: Configuration by configurations.creating { asProvider() typescriptAttributes(objects) - outgoing.artifact(schemaTsZipTask.flatMap { it.archiveFile }) + outgoing.artifact(schemaTsZipTaskArchiveFile) } -tasks.matching { - it.name == "jsGenerateExternalsIntegrated" -}.configureEach { - @Suppress("UnstableApiUsage") - notCompatibleWithConfigurationCache("try to prevent 'Projects must be configuring' error") -} +//tasks.matching { +// it.name == "jsGenerateExternalsIntegrated" +//}.configureEach { +// @Suppress("UnstableApiUsage") +// notCompatibleWithConfigurationCache("try to prevent 'Projects must be configuring' error") +//// outputs.upToDateWhen { true } +// dependsOn(":kotlinNpmInstall") +//} diff --git a/modules/web-map/build.gradle.kts b/modules/web-map/build.gradle.kts index 5f125d7..5d1ec15 100644 --- a/modules/web-map/build.gradle.kts +++ b/modules/web-map/build.gradle.kts @@ -3,13 +3,29 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig plugins { - dev.adamko.kafkatorio.lang.`kotlin-js` +// dev.adamko.kafkatorio.lang.`kotlin-js` + dev.adamko.kafkatorio.lang.`kotlin-multiplatform` kotlin("plugin.serialization") 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 { js(IR) { + browser() + binaries.executable() + } + + js("frontend", IR) { // nodejs() browser { runTask { @@ -22,7 +38,7 @@ kotlin { "/kv/*" to "http://localhost:8080", "/kvws/*" to mapOf("target" to "ws://localhost:8080", "ws" to true) ), - static = mutableListOf("$buildDir/processedResources/js/main") + static = mutableListOf("$buildDir/processedResources/frontend/main") ) } webpackTask { @@ -37,6 +53,10 @@ kotlin { binaries.executable() } + jvm("backend") { + + } + sourceSets { 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 { implementation(projects.modules.eventsSchema) @@ -77,11 +112,20 @@ kotlin { implementation(dependencies.platform(npm("node-forge", "^1.3.0"))) } - val webDir = file("src/main/web") - resources.srcDir(webDir) +// val webDir = file("src/main/web") + 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 { implementation(kotlin("test-js")) @@ -89,6 +133,8 @@ kotlin { // implementation(npm("karma", "^6.3.16")) } + + kotlin.srcDir("src/test/kotlin") } } } @@ -114,3 +160,30 @@ fun KotlinDependencyHandler.kvision( // 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()) +}