diff --git a/.github/workflows/demo-gh-pages.yml b/.github/workflows/demo-gh-pages.yml index dbbaa62b..5d7e2b77 100644 --- a/.github/workflows/demo-gh-pages.yml +++ b/.github/workflows/demo-gh-pages.yml @@ -41,7 +41,7 @@ jobs: uses: gradle/actions/setup-gradle@v4 - name: Build the distribution with Gradle Wrapper - run: ./gradlew :demo:sideBySideBrowserDistribution + run: ./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 0f6debe6..0760e687 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { implementation(kotlin("gradle-plugin", kotlinVersion)) implementation("org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion") implementation("org.jetbrains.compose:compose-gradle-plugin:1.7.1") - implementation("com.huanshankeji.team:gradle-plugins:0.8.0") // don't use a snapshot version in a main branch + implementation("com.huanshankeji.team:gradle-plugins:0.9.0") // don't use a snapshot version in a main branch implementation("com.android.tools.build:gradle:8.5.2") - implementation("com.huanshankeji:common-gradle-dependencies:0.8.0-20241016") // don't use a snapshot version in a main branch + implementation("com.huanshankeji:common-gradle-dependencies:0.9.0-20241203") // don't use a snapshot version in a main branch } diff --git a/buildSrc/src/main/kotlin/common-conventions.gradle.kts b/buildSrc/src/main/kotlin/common-conventions.gradle.kts index 6df6ce05..44843f1f 100644 --- a/buildSrc/src/main/kotlin/common-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/common-conventions.gradle.kts @@ -1,5 +1,5 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl plugins { kotlin("multiplatform") @@ -38,7 +38,21 @@ kotlin { js() + @OptIn(ExperimentalKotlinGradlePluginApi::class) + applyDefaultHierarchyTemplate { + common { + group("composeUi") { + withJvm() + withAndroidTarget() + group("ios") + withWasmJs() + } + } + } + + + compilerOptions { freeCompilerArgs.add("-Xexpect-actual-classes") } diff --git a/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts b/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts index 0dcdddb2..052a2868 100644 --- a/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi - plugins { id("common-conventions") id("com.huanshankeji.kotlin-multiplatform-conventional-targets") @@ -11,20 +9,6 @@ kotlin { publishLibraryVariants("release", "debug") } - // move to `common-conventions` if necessary - - @OptIn(ExperimentalKotlinGradlePluginApi::class) - applyDefaultHierarchyTemplate { - common { - group("composeUi") { - withJvm() - withAndroidTarget() - group("ios") - withWasmJs() - } - } - } - /* sourceSets { val composeUiMain by creating { dependsOn(commonMain.get()) } diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts index f487ac56..b1699b89 100644 --- a/demo/build.gradle.kts +++ b/demo/build.gradle.kts @@ -1,5 +1,5 @@ import com.huanshankeji.cpnProject -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl plugins { `common-conventions` @@ -57,6 +57,11 @@ kotlin { implementation(commonDependencies.kotlinx.coroutines.core()) } } + composeUiMain { + dependencies { + implementation(compose.ui) + } + } jvmMain { dependencies { implementation(compose.desktop.currentOs) @@ -64,23 +69,10 @@ kotlin { } androidMain { dependencies { - // TODO consider putting this in `composeUiMain` - implementation(compose.ui) - implementation(commonDependencies.androidx.activity.compose()) implementation(commonDependencies.androidx.compose.ui.module("tooling-preview")) } } - iosMain { - dependencies { - implementation(compose.ui) - } - } - wasmJsMain { - dependencies { - implementation(compose.ui) - } - } jsMain { dependencies { implementation(compose.html.core) diff --git a/demo/iosApp/iosApp.xcodeproj/project.pbxproj b/demo/iosApp/iosApp.xcodeproj/project.pbxproj index 7a56ed44..6c2151c2 100644 --- a/demo/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/demo/iosApp/iosApp.xcodeproj/project.pbxproj @@ -175,7 +175,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/../..\"\n./gradlew :demo:embedAndSignAppleFrameworkForXcode\n"; + shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/../..\"\n./gradlew :compose-multiplatform-html-unified-demo:embedAndSignAppleFrameworkForXcode\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Common.kt b/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Common.kt index 2cf22ae1..786fa6e9 100644 --- a/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Common.kt +++ b/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Common.kt @@ -7,6 +7,7 @@ import com.huanshankeji.compose.foundation.ext.outerBorder import com.huanshankeji.compose.foundation.ext.roundedCornerBackgroundAndOuterBorder import com.huanshankeji.compose.foundation.ext.roundedCornerOuterBorder import com.huanshankeji.compose.foundation.layout.* +import com.huanshankeji.compose.foundation.layout.ext.outerPadding import com.huanshankeji.compose.foundation.lazy.LazyColumn import com.huanshankeji.compose.foundation.lazy.LazyListScope import com.huanshankeji.compose.foundation.lazy.LazyRow @@ -26,7 +27,7 @@ fun Common(/*modifier: Modifier = Modifier*/) { @Composable fun ColorBox(color: Color) = - Box(Modifier.padding(8.dp).background(color).size(40.dp)) + Box(Modifier.outerPadding(8.dp).background(color).size(40.dp)) val halfGreen = Color(0, 0x80, 0x00) diff --git a/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Material2.kt b/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Material2.kt index b44bcd91..fd0c4097 100644 --- a/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Material2.kt +++ b/demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Material2.kt @@ -5,6 +5,7 @@ import androidx.compose.ui.unit.dp import com.huanshankeji.compose.foundation.VerticalScrollBox import com.huanshankeji.compose.foundation.background import com.huanshankeji.compose.foundation.layout.* +import com.huanshankeji.compose.foundation.layout.ext.outerPadding import com.huanshankeji.compose.foundation.text.KeyboardActions import com.huanshankeji.compose.foundation.text.KeyboardOptions import com.huanshankeji.compose.foundation.text.input.ImeAction @@ -73,7 +74,7 @@ fun Material2(/*modifier: Modifier = Modifier*/) { IconButton(onClick, icon = Icons.Default.Add, contentDescription = "increment count") } - val listModifier = Modifier.padding(16.dp).height(listSize) + val listModifier = Modifier.outerPadding(16.dp).height(listSize) List(listModifier) { item { Text("Ungrouped item")