-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Ktor3 and support Wasm for coil3
- Loading branch information
Showing
12 changed files
with
189 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
build-logic/convention/src/main/kotlin/ComposeMultiplatformWasmLibraryConventionPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Designed and developed by 2020-2022 skydoves (Jaewoong Eum) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import com.skydoves.landscapist.configureAndroidCompose | ||
import com.skydoves.landscapist.configureComposeMultiplatform | ||
import com.skydoves.landscapist.configureKotlinAndroid | ||
import com.skydoves.landscapist.kotlinOptions | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.api.tasks.compile.JavaCompile | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
||
class ComposeMultiplatformWasmLibraryConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
pluginManager.apply("com.android.library") | ||
pluginManager.apply("org.jetbrains.kotlin.multiplatform") | ||
pluginManager.apply("org.jetbrains.compose") | ||
pluginManager.apply("com.vanniktech.maven.publish") | ||
pluginManager.apply("binary-compatibility-validator") | ||
pluginManager.apply("androidx.baselineprofile") | ||
|
||
extensions.configure<LibraryExtension> libraryExtension@{ | ||
extensions.configure<KotlinMultiplatformExtension> kmpExtension@{ | ||
configureComposeMultiplatform(this@libraryExtension, this@kmpExtension) | ||
} | ||
} | ||
|
||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
tasks.withType(JavaCompile::class.java).configureEach { | ||
this.targetCompatibility = libs.findVersion("jvmTarget").get().toString() | ||
this.sourceCompatibility = libs.findVersion("jvmTarget").get().toString() | ||
} | ||
|
||
dependencies { | ||
add("baselineProfile", project(":benchmark-landscapist")) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
build-logic/convention/src/main/kotlin/com/skydoves/landscapist/ComposeMultiplatformWasm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* Designed and developed by 2020-2022 skydoves (Jaewoong Eum) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
@file:Suppress("UnstableApiUsage") | ||
|
||
package com.skydoves.landscapist | ||
|
||
import com.android.build.api.dsl.CommonExtension | ||
import org.gradle.api.Project | ||
import org.gradle.api.Task | ||
import org.gradle.kotlin.dsl.invoke | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl | ||
|
||
/** | ||
* Configure Compose-Multiplatform-specific options | ||
*/ | ||
internal fun Project.configureComposeMultiplatformWasm( | ||
commonExtension: CommonExtension<*, *, *, *, *, *>, | ||
kotlinMultiplatformExtension: KotlinMultiplatformExtension, | ||
) { | ||
pluginManager.apply("org.jetbrains.kotlin.plugin.compose") | ||
|
||
kotlinMultiplatformExtension.apply { | ||
androidTarget { publishLibraryVariants("release") } | ||
jvm("desktop") | ||
|
||
@OptIn(ExperimentalWasmDsl::class) | ||
wasmJs { | ||
browser { | ||
testTask { | ||
enabled = false | ||
} | ||
} | ||
nodejs { | ||
testTask { | ||
enabled = false | ||
} | ||
} | ||
binaries.library() | ||
} | ||
|
||
iosX64() | ||
iosArm64() | ||
iosSimulatorArm64() | ||
|
||
macosX64() | ||
macosArm64() | ||
|
||
@Suppress("OPT_IN_USAGE") | ||
applyHierarchyTemplate { | ||
common { | ||
group("jvm") { | ||
withAndroidTarget() | ||
withJvm() | ||
} | ||
group("skia") { | ||
withJvm() | ||
group("darwin") { | ||
group("apple") { | ||
group("ios") { | ||
withIosX64() | ||
withIosArm64() | ||
withIosSimulatorArm64() | ||
} | ||
group("macos") { | ||
withMacosX64() | ||
withMacosArm64() | ||
} | ||
} | ||
withJs() | ||
withWasmJs() | ||
} | ||
} | ||
} | ||
} | ||
|
||
explicitApi() | ||
} | ||
|
||
commonExtension.apply { | ||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
packaging { | ||
resources { | ||
excludes.add("/META-INF/{AL2.0,LGPL2.1}") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters