From b8146932196720083125d927c404c8a7a21a0b64 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Thu, 23 Dec 2021 00:51:41 +0100 Subject: [PATCH] VERY kludgy config for wasmReady --- web/core/build.gradle.kts | 8 +++-- web/gradle.properties | 1 + .../conf/karma.config.common.d/wasm.js | 32 +++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 web/test-utils/conf/karma.config.common.d/wasm.js diff --git a/web/core/build.gradle.kts b/web/core/build.gradle.kts index 8d1b6c96fc..8e7a822f4a 100644 --- a/web/core/build.gradle.kts +++ b/web/core/build.gradle.kts @@ -5,10 +5,12 @@ plugins { id("org.jetbrains.compose") } +val SKIKO_VERSION: String by project + val skikoWasm by configurations.creating dependencies { - skikoWasm("org.jetbrains.skiko:skiko-js-wasm-runtime:0.0.0-SNAPSHOT") + skikoWasm("org.jetbrains.skiko:skiko-js-wasm-runtime:${SKIKO_VERSION}") } val copySkikoResources = tasks.register("copySkikoResources", Copy::class) { @@ -16,7 +18,7 @@ val copySkikoResources = tasks.register("copySkikoResources", Copy::class) { include("skiko.wasm") include("skiko.js") } - destinationDir = file("${project.buildDir}/skiko") + destinationDir = file("${rootProject.buildDir}/skiko") } tasks.withType().configureEach { @@ -42,7 +44,7 @@ kotlin { implementation(compose.runtime) implementation(kotlin("stdlib-common")) - implementation("org.jetbrains.skiko:skiko:0.0.0-SNAPSHOT") + implementation("org.jetbrains.skiko:skiko:${SKIKO_VERSION}") } } diff --git a/web/gradle.properties b/web/gradle.properties index b4f4bac93b..dcc85d8919 100644 --- a/web/gradle.properties +++ b/web/gradle.properties @@ -1,6 +1,7 @@ #COMPOSE_CORE_VERSION=1.0.1-rc2 COMPOSE_CORE_VERSION=10.10.10 COMPOSE_WEB_VERSION=1.0.1-rc2 +SKIKO_VERSION=0.0.0-SNAPSHOT compose.web.buildSamples=false compose.web.tests.integration.withFirefox compose.web.tests.skip.benchmarks=false diff --git a/web/test-utils/conf/karma.config.common.d/wasm.js b/web/test-utils/conf/karma.config.common.d/wasm.js new file mode 100644 index 0000000000..963d00259d --- /dev/null +++ b/web/test-utils/conf/karma.config.common.d/wasm.js @@ -0,0 +1,32 @@ +// see https://kotlinlang.org/docs/js-project-setup.html#webpack-configuration-file + +const path = require("path"); +const fs = require("fs"); + + +config.browserConsoleLogOptions.level = "debug"; + +const basePath = config.basePath; +const projectPath = path.resolve(basePath, "..", "..", "..", "..", ".."); +const wasmPath = path.resolve(projectPath, "build", "out", "link", "Release-wasm-wasm") + +//const debug = message => console.log(`[karma-config] ${message}`); +const debug = message => fs.appendFileSync('/Users/shagen/tmp/log.log', message + "\r\n"); + +const a = path.resolve("."); + +const projectName = path.basename(path.dirname(basePath)).replace(/-test$/, '').replace(/^web-/,''); + +if (projectName == "web-core") { + const rootBuildDir = path.resolve(__dirname, "..", "..", ".."); + const wasmPath = path.resolve(rootBuildDir, "skiko"); + + config.proxies = { + "/wasm/": wasmPath + } + + config.files = [ + path.resolve(wasmPath, "skiko.js"), + {pattern: path.resolve(wasmPath, "skiko.wasm"), included: false, served: true, watched: false}, + ].concat(config.files); +}