Skip to content

Commit

Permalink
Upgrade to Compose 1.6.0-alpha01. Replace stdlib DOM/W3C bindings wit…
Browse files Browse the repository at this point in the history
…h a custom bindings in kilua-dom submodule to make project buildable.
  • Loading branch information
rjaros committed Dec 8, 2023
1 parent e9a9efd commit 05eff6e
Show file tree
Hide file tree
Showing 242 changed files with 12,993 additions and 760 deletions.
52 changes: 24 additions & 28 deletions buildSrc/src/main/kotlin/Shared.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,41 @@ fun KotlinMultiplatformExtension.compilerOptions() {
}
}

fun KotlinMultiplatformExtension.kotlinJsTargets(buildTarget: String, isInIdea: Boolean, withNode: Boolean = true) {
if (buildTarget == "js" || !isInIdea) {
js(IR) {
useEsModules()
browser {
testTask {
useKarma {
useChromeHeadless()
}
fun KotlinMultiplatformExtension.kotlinJsTargets(withNode: Boolean = true) {
js(IR) {
useEsModules()
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
if (withNode) {
nodejs {
testTask {
useMocha()
}
}
if (withNode) {
nodejs {
testTask {
useMocha()
}
}
}
}
}

@OptIn(ExperimentalWasmDsl::class)
fun KotlinMultiplatformExtension.kotlinWasmTargets(buildTarget: String, isInIdea: Boolean, withNode: Boolean = true) {
if (buildTarget == "wasm" || !isInIdea) {
wasmJs {
useEsModules()
browser {
testTask {
useKarma {
useChromeHeadlessWasmGc()
}
fun KotlinMultiplatformExtension.kotlinWasmTargets(withNode: Boolean = true) {
wasmJs {
useEsModules()
browser {
testTask {
useKarma {
useChromeHeadlessWasmGc()
}
}
if (withNode) {
nodejs {
testTask {
useMocha()
}
}
if (withNode) {
nodejs {
testTask {
useMocha()
}
}
}
Expand Down
107 changes: 48 additions & 59 deletions examples/bootstrap-form/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,60 @@ plugins {
id("org.jetbrains.compose")
}

val isInIdea = System.getProperty("idea.vendor.name") != null
val buildTarget: String by project

@OptIn(ExperimentalWasmDsl::class)
kotlin {
if (buildTarget == "js" || !isInIdea) {
js(IR) {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadless()
}
js(IR) {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadless()
}
}
binaries.executable()
}
binaries.executable()
}
if (buildTarget == "wasm" || !isInIdea) {
wasmJs {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadlessWasmGc()
}
}
wasmJs {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
binaries.executable()
if (project.gradle.startParameter.taskNames.find { it.contains("wasmJsBrowserProductionWebpack") } != null) {
applyBinaryen {
binaryenArgs = mutableListOf(
"--enable-nontrapping-float-to-int",
"--enable-gc",
"--enable-reference-types",
"--enable-exception-handling",
"--enable-bulk-memory",
"--inline-functions-with-loops",
"--traps-never-happen",
"--fast-math",
"--closed-world",
"--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
)
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadlessWasmGc()
}
}
}
binaries.executable()
if (project.gradle.startParameter.taskNames.find { it.contains("wasmJsBrowserProductionWebpack") } != null) {
applyBinaryen {
binaryenArgs = mutableListOf(
"--enable-nontrapping-float-to-int",
"--enable-gc",
"--enable-reference-types",
"--enable-exception-handling",
"--enable-bulk-memory",
"--inline-functions-with-loops",
"--traps-never-happen",
"--fast-math",
"--closed-world",
"--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
)
}
}
}
sourceSets {
val commonMain by getting {
Expand All @@ -75,16 +68,12 @@ kotlin {
implementation(project(":modules:kilua-bootstrap"))
}
}
if (buildTarget == "js" || !isInIdea) {
val jsMain by getting {
dependencies {
}
val jsMain by getting {
dependencies {
}
}
if (buildTarget == "wasm" || !isInIdea) {
val wasmJsMain by getting {
dependencies {
}
val wasmJsMain by getting {
dependencies {
}
}
}
Expand Down
107 changes: 48 additions & 59 deletions examples/hello-world/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,84 +6,73 @@ plugins {
id("org.jetbrains.compose")
}

val isInIdea = System.getProperty("idea.vendor.name") != null
val buildTarget: String by project

@OptIn(ExperimentalWasmDsl::class)
kotlin {
if (buildTarget == "js" || !isInIdea) {
js(IR) {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadless()
}
js(IR) {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadless()
}
}
binaries.executable()
}
binaries.executable()
}
if (buildTarget == "wasm" || !isInIdea) {
wasmJs {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadlessWasmGc()
}
}
wasmJs {
useEsModules()
browser {
commonWebpackConfig {
outputFileName = "main.bundle.js"
}
binaries.executable()
if (project.gradle.startParameter.taskNames.find { it.contains("wasmJsBrowserProductionWebpack") } != null) {
applyBinaryen {
binaryenArgs = mutableListOf(
"--enable-nontrapping-float-to-int",
"--enable-gc",
"--enable-reference-types",
"--enable-exception-handling",
"--enable-bulk-memory",
"--inline-functions-with-loops",
"--traps-never-happen",
"--fast-math",
"--closed-world",
"--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
)
runTask {
sourceMaps = false
}
testTask {
useKarma {
useChromeHeadlessWasmGc()
}
}
}
binaries.executable()
if (project.gradle.startParameter.taskNames.find { it.contains("wasmJsBrowserProductionWebpack") } != null) {
applyBinaryen {
binaryenArgs = mutableListOf(
"--enable-nontrapping-float-to-int",
"--enable-gc",
"--enable-reference-types",
"--enable-exception-handling",
"--enable-bulk-memory",
"--inline-functions-with-loops",
"--traps-never-happen",
"--fast-math",
"--closed-world",
"--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
"-O3", "--gufa", "--metrics",
)
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(project(":kilua"))
}
}
if (buildTarget == "js" || !isInIdea) {
val jsMain by getting {
dependencies {
}
val jsMain by getting {
dependencies {
}
}
if (buildTarget == "wasm" || !isInIdea) {
val wasmJsMain by getting {
dependencies {
}
val wasmJsMain by getting {
dependencies {
}
}
}
Expand Down
Loading

0 comments on commit 05eff6e

Please sign in to comment.