From a505bb841315cab956a58f01e0b6e603e5c89c5c Mon Sep 17 00:00:00 2001 From: ismail Date: Tue, 5 Mar 2024 19:24:16 +0000 Subject: [PATCH] Merge branch 'main' of https://github.com/ismai117/kottie --- gradle.properties | 2 +- gradle/libs.versions.toml | 3 ++- lib/build.gradle.kts | 17 +++++++++-------- lib/lib.podspec | 2 +- sample/shared/build.gradle.kts | 12 ++++++------ sample/shared/src/commonMain/kotlin/App.kt | 5 ++++- sample/webApp-wasm/build.gradle.kts | 10 ++++++++++ sample/webApp/build.gradle.kts | 11 +++++++++++ settings.gradle.kts | 2 +- 9 files changed, 45 insertions(+), 19 deletions(-) diff --git a/gradle.properties b/gradle.properties index ac7ca5e..056a1e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ kotlin.mpp.applyDefaultHierarchyTemplate=false #Compose org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true -org.jetbrains.compose.experimental.wasm.enabled=true +#org.jetbrains.compose.experimental.wasm.enabled=true #Android android.useAndroidX=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8f20dc1..2c7c63d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,8 @@ compose-plugin = "1.6.0" dokka = "1.9.10" klint = "12.1.0" maven-publish = "0.27.0" -ktor = "3.0.0-wasm2" +#ktor = "3.0.0-wasm2" +ktor = "2.3.9" lottie = "6.2.0" [libraries] diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index a8824f4..3bd05ec 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -22,11 +22,11 @@ kotlin { binaries.executable() } - @OptIn(ExperimentalWasmDsl::class) - wasmJs { - browser() - binaries.executable() - } +// @OptIn(ExperimentalWasmDsl::class) +// wasmJs { +// browser() +// binaries.executable() +// } iosX64() iosArm64() @@ -34,6 +34,7 @@ kotlin { cocoapods { version = "1.0" + ios.deploymentTarget = "17.2" pod("lottie-ios"){ moduleName = "Lottie" extraOpts += listOf("-compiler-option", "-fmodules") @@ -95,9 +96,9 @@ kotlin { } } - val wasmJsMain by getting { - dependsOn(skiaMain) - } +// val wasmJsMain by getting { +// dependsOn(skiaMain) +// } } } diff --git a/lib/lib.podspec b/lib/lib.podspec index 100271f..17aa81d 100644 --- a/lib/lib.podspec +++ b/lib/lib.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |spec| spec.summary = '' spec.vendored_frameworks = 'build/cocoapods/framework/lib.framework' spec.libraries = 'c++' - + spec.ios.deployment_target = '17.2' spec.dependency 'lottie-ios' if !Dir.exist?('build/cocoapods/framework/lib.framework') || Dir.empty?('build/cocoapods/framework/lib.framework') diff --git a/sample/shared/build.gradle.kts b/sample/shared/build.gradle.kts index ae4ac79..82370b7 100644 --- a/sample/shared/build.gradle.kts +++ b/sample/shared/build.gradle.kts @@ -17,11 +17,11 @@ kotlin { binaries.executable() } - @OptIn(ExperimentalWasmDsl::class) - wasmJs { - browser() - binaries.executable() - } +// @OptIn(ExperimentalWasmDsl::class) +// wasmJs { +// browser() +// binaries.executable() +// } iosX64() iosArm64() @@ -31,7 +31,7 @@ kotlin { summary = "Some description for the Shared Module" homepage = "Link to the Shared Module homepage" version = "1.0" - ios.deploymentTarget = "17.0" + ios.deploymentTarget = "17.2" podfile = project.file("../iosApp/Podfile") pod("lottie-ios") { version = "4.4.0" diff --git a/sample/shared/src/commonMain/kotlin/App.kt b/sample/shared/src/commonMain/kotlin/App.kt index 357fc5f..6b7e597 100644 --- a/sample/shared/src/commonMain/kotlin/App.kt +++ b/sample/shared/src/commonMain/kotlin/App.kt @@ -1,9 +1,11 @@ +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.size import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import kottieComposition.KottieCompositionSpec @@ -19,7 +21,7 @@ fun App( val composition = rememberKottieComposition( - spec = KottieCompositionSpec.File("files/Animation.json") + spec = KottieCompositionSpec.File("files/loading.json") ) val animationState by animateKottieCompositionAsState( @@ -30,6 +32,7 @@ fun App( MaterialTheme { Box( modifier = modifier.fillMaxSize(), + contentAlignment = Alignment.Center ) { KottieAnimation( diff --git a/sample/webApp-wasm/build.gradle.kts b/sample/webApp-wasm/build.gradle.kts index 3ef79d6..34384e6 100644 --- a/sample/webApp-wasm/build.gradle.kts +++ b/sample/webApp-wasm/build.gradle.kts @@ -5,6 +5,16 @@ plugins { alias(libs.plugins.jetbrainsCompose) } +val copyWasmResources = tasks.create("copyWasmResourcesWorkaround", Copy::class.java) { + from(project(":shared").file("src/commonMain/composeResources")) + into("build/processedResources/wasmJs/main") +} + +afterEvaluate { + project.tasks.getByName("wasmJsProcessResources").finalizedBy(copyWasmResources) + project.tasks.getByName("wasmJsDevelopmentExecutableCompileSync").mustRunAfter(copyWasmResources)x + project.tasks.getByName("wasmJsProductionExecutableCompileSync").mustRunAfter(copyWasmResources) +} kotlin { @OptIn(ExperimentalWasmDsl::class) diff --git a/sample/webApp/build.gradle.kts b/sample/webApp/build.gradle.kts index c2bfddd..866035f 100644 --- a/sample/webApp/build.gradle.kts +++ b/sample/webApp/build.gradle.kts @@ -5,6 +5,17 @@ plugins { alias(libs.plugins.jetbrainsCompose) } +val copyJsResources = tasks.create("copyJsResourcesWorkaround", Copy::class.java) { + from(project(":sample:shared").file("src/commonMain/composeResources")) + into("build/processedResources/js/main") +} + +afterEvaluate { + project.tasks.getByName("jsProcessResources").finalizedBy(copyJsResources) + project.tasks.getByName("jsBrowserProductionExecutableDistributeResources").mustRunAfter(copyJsResources) + project.tasks.getByName("jsDevelopmentExecutableCompileSync").mustRunAfter(copyJsResources) + project.tasks.getByName("jsProductionExecutableCompileSync").mustRunAfter(copyJsResources) +} kotlin { js { diff --git a/settings.gradle.kts b/settings.gradle.kts index abd4ffa..a5c1f7f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,7 +5,7 @@ include(":lib") include(":sample:desktopApp") include(":sample:shared") include(":sample:webApp") -include(":sample:webApp-wasm") +//include(":sample:webApp-wasm") pluginManagement { repositories {