From a62503ac4157d84a7333a5bc914f3639a067289a Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 9 Jun 2023 17:22:36 +0300 Subject: [PATCH] add debelopment mode for fullstack --- CHANGELOG.md | 3 ++- .../kotlin/space/kscience/gradle/KScienceExtension.kt | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30cc377..b41fce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added +- Add development mode for fullstack. ### Changed -- All publishing is enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. +- All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. ### Deprecated diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 9657003..3535991 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -425,7 +425,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro @OptIn(ExperimentalWasmDsl::class) public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) { - if(project.requestPropertyOrNull("kscience.wasm.disabled") == "true"){ + if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") return } @@ -465,6 +465,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro */ public fun fullStack( bundleName: String = "js/bundle.js", + development: Boolean = false, jvmConfig: KotlinJvmTarget.() -> Unit = {}, jsConfig: KotlinJsTargetDsl.() -> Unit = {}, browserConfig: KotlinJsBrowserDsl.() -> Unit = {}, @@ -483,7 +484,10 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro val processResourcesTaskName = compilations[KotlinCompilation.MAIN_COMPILATION_NAME].processResourcesTaskName - val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution") + + val jsBrowserDistribution = project.tasks.getByName( + if (development) "jsBrowserDevelopmentExecutableDistribution" else "jsBrowserDistribution" + ) project.tasks.getByName(processResourcesTaskName) { duplicatesStrategy = DuplicatesStrategy.WARN