From 72b5d610df1c43690a03ff8706e366ecf82fb9e2 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Tue, 4 Jan 2022 14:08:22 +0100 Subject: [PATCH] Introduce setup for copying skiko files --- examples/web-skia/build.gradle.kts | 17 ++++++++++++++ examples/web-skia/gradle.properties | 1 + examples/web-skia/kotlin-js-store/yarn.lock | 23 ------------------- .../src/jsMain/kotlin/com/sample/Main.kt | 8 +++++++ 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/examples/web-skia/build.gradle.kts b/examples/web-skia/build.gradle.kts index 50cdbcf567..821f576fab 100644 --- a/examples/web-skia/build.gradle.kts +++ b/examples/web-skia/build.gradle.kts @@ -12,6 +12,23 @@ repositories { google() } +val SKIKO_VERSION: String by project + +val skikoWasm by configurations.creating + +dependencies { + skikoWasm("org.jetbrains.skiko:skiko-js-wasm-runtime:${SKIKO_VERSION}") +} + +val copySkikoResources = tasks.register("copySkikoResources", Copy::class) { + from(skikoWasm.map { zipTree(it) }) { + include("skiko.wasm") + include("skiko.js") + } + destinationDir = file("${rootProject.buildDir}/skiko") +} + + kotlin { js(IR) { browser() diff --git a/examples/web-skia/gradle.properties b/examples/web-skia/gradle.properties index 843be144b5..85c167c737 100644 --- a/examples/web-skia/gradle.properties +++ b/examples/web-skia/gradle.properties @@ -1,3 +1,4 @@ kotlin.code.style=official kotlin.version=1.6.10 compose.version=10.10.10 +SKIKO_VERSION=0.0.0-SNAPSHOT diff --git a/examples/web-skia/kotlin-js-store/yarn.lock b/examples/web-skia/kotlin-js-store/yarn.lock index 8052d9b26c..b09aa9b014 100644 --- a/examples/web-skia/kotlin-js-store/yarn.lock +++ b/examples/web-skia/kotlin-js-store/yarn.lock @@ -825,14 +825,6 @@ dom-serialize@^2.2.1: extend "^3.0.0" void-elements "^2.0.0" -dukat@0.5.8-rc.4: - version "0.5.8-rc.4" - resolved "https://registry.yarnpkg.com/dukat/-/dukat-0.5.8-rc.4.tgz#90384dcb50b14c26f0e99dae92b2dea44f5fce21" - integrity sha512-ZnMt6DGBjlVgK2uQamXfd7uP/AxH7RqI0BL9GLrrJb2gKdDxvJChWy+M9AQEaL+7/6TmxzJxFOsRiInY9oGWTA== - dependencies: - google-protobuf "3.12.2" - typescript "3.9.5" - ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -1209,11 +1201,6 @@ globby@^11.0.1: merge2 "^1.3.0" slash "^3.0.0" -google-protobuf@3.12.2: - version "3.12.2" - resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.12.2.tgz#50ce9f9b6281235724eb243d6a83e969a2176e53" - integrity sha512-4CZhpuRr1d6HjlyrxoXoocoGFnRYgKULgMtikMddA9ztRyYR59Aondv2FioyxWVamRo0rF2XpYawkTCBEQOSkA== - graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6: version "4.2.8" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" @@ -1258,11 +1245,6 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -highlight.js@10.7.2: - version "10.7.2" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.2.tgz#89319b861edc66c48854ed1e6da21ea89f847360" - integrity sha512-oFLl873u4usRM9K63j4ME9u3etNF0PLiJhSQ8rdfuL51Wn3zkD6drf9ZW0dOzjnZI22YYG24z30JcmfCZjMgYg== - hpack.js@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" @@ -2609,11 +2591,6 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typescript@3.9.5: - version "3.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" - integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== - ua-parser-js@^0.7.28: version "0.7.31" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6" diff --git a/examples/web-skia/src/jsMain/kotlin/com/sample/Main.kt b/examples/web-skia/src/jsMain/kotlin/com/sample/Main.kt index bc7e0400d0..2ade35038e 100644 --- a/examples/web-skia/src/jsMain/kotlin/com/sample/Main.kt +++ b/examples/web-skia/src/jsMain/kotlin/com/sample/Main.kt @@ -1,8 +1,16 @@ package org.jetbrains.compose.sample +import kotlinx.browser.window +import org.jetbrains.compose.web.dom.Canvas import org.jetbrains.compose.web.renderComposable +import org.jetbrains.skiko.wasm.onWasmReady fun main() { renderComposable(rootElementId = "root") { + Canvas { + onWasmReady { + window.alert("HEY!!!!!") + } + } } }