diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index c7f6cd6..195fd83 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -1,19 +1,6 @@
name: Android CI
on:
- push:
- branches: [ "master" ]
- paths-ignore:
- - '.idea/**'
- - '.gitattributes'
- - '.github/**.json'
- - '.gitignore'
- - '.gitmodules'
- - '**.md'
- - 'LICENSE'
- - 'NOTICE'
- - docs
- - iosApp
pull_request:
branches: [ "master" ]
paths-ignore:
@@ -27,6 +14,7 @@ on:
- 'NOTICE'
- docs
- iosApp
+ workflow_dispatch: { }
concurrency:
group: build-android-${{ github.ref }}
@@ -44,7 +32,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: '17'
- distribution: 'corretto'
+ distribution: 'corretto'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
index 37f4768..d6000e5 100644
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@ -1,19 +1,6 @@
name: iOS CI
on:
- push:
- branches: [ "master" ]
- paths-ignore:
- - '.idea/**'
- - '.gitattributes'
- - '.github/**.json'
- - '.gitignore'
- - '.gitmodules'
- - '**.md'
- - 'LICENSE'
- - 'NOTICE'
- - docs
- - androidApp
pull_request:
branches: [ "master" ]
paths-ignore:
@@ -27,6 +14,7 @@ on:
- 'NOTICE'
- docs
- androidApp
+ workflow_dispatch: { }
concurrency:
group: build-ios-${{ github.ref }}
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 148fdd2..6d0ee1c 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts
index 54c5e5a..0227146 100644
--- a/androidApp/build.gradle.kts
+++ b/androidApp/build.gradle.kts
@@ -3,7 +3,7 @@ import java.util.Properties
plugins {
alias(libs.plugins.android.application)
kotlin("android")
- alias(libs.plugins.cashapp.redwood)
+ alias(libs.plugins.compose.compiler)
id("com.jithub.build.logic")
}
@@ -19,15 +19,11 @@ android {
}
buildFeatures {
- // The Redwood Gradle plugin cannot be applied to an Android project which enables Compose.
+ // If you are using Redwood, you do not need to set this parameter.
// compose = true
buildConfig = true
}
- composeOptions {
- kotlinCompilerExtensionVersion = Versions.composeCompiler
- }
-
packaging {
resources {
excludes += Resources.excludes
@@ -88,6 +84,11 @@ android {
}
}
+composeCompiler {
+ enableStrongSkippingMode = true
+ reportsDestination = layout.buildDirectory.dir("compose_compiler")
+}
+
androidComponents {
onVariants(selector().withBuildType("release")) {
// Only exclude *.version files in release mode as debug mode requires
diff --git a/build-logic/convention/src/main/kotlin/Configuration.kt b/build-logic/convention/src/main/kotlin/Configuration.kt
index 7bd186a..240f09b 100644
--- a/build-logic/convention/src/main/kotlin/Configuration.kt
+++ b/build-logic/convention/src/main/kotlin/Configuration.kt
@@ -14,9 +14,6 @@ object Versions {
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 2401
- // https://developer.android.com/jetpack/androidx/releases/compose-compiler?hl=zh-cn
- const val composeCompiler = "1.5.14"
-
// jvmToolchain
// const val jdkVersion = 17
diff --git a/build.gradle.kts b/build.gradle.kts
index d7f55f0..9b86489 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,7 +1,13 @@
@file:Suppress("UnstableApiUsage")
+import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
+import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
+import org.jetbrains.kotlin.gradle.plugin.mpp.Framework
+import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
+import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
buildscript {
repositories {
@@ -16,6 +22,7 @@ buildscript {
gradlePluginPortal()
}
dependencies {
+ classpath(libs.redwood.gradle.plugin)
classpath(moko.resources.gradle.plugin)
}
}
@@ -26,7 +33,7 @@ plugins {
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.cocoapods) apply false
// alias(libs.plugins.jetbrains.compose) apply false
- alias(libs.plugins.cashapp.redwood) apply false
+ alias(libs.plugins.compose.compiler) apply false
id("com.jithub.build.logic") apply false
}
@@ -60,35 +67,62 @@ tasks.register("clean") {
delete(rootProject.layout.buildDirectory)
}
+// https://github.com/cashapp/redwood/blob/trunk/build-support/src/main/kotlin/app/cash/redwood/buildsupport/RedwoodBuildPlugin.kt
private fun Project.configureCommonKotlin() {
- // Kotlin requires the Java compatibility matches.
- tasks.withType().configureEach {
- sourceCompatibility = Versions.javaVersion.toString()
- targetCompatibility = Versions.javaVersion.toString()
- }
-
- tasks.withType().configureEach {
+ tasks.withType(KotlinCompile::class.java).configureEach {
compilerOptions {
// Treat all Kotlin warnings as errors (disabled by default)
allWarningsAsErrors.set(properties["warningsAsErrors"] as? Boolean ?: false)
freeCompilerArgs.set(
freeCompilerArgs.getOrElse(emptyList()) + listOf(
- // Enable default methods in interfaces
- "-Xjvm-default=all",
- // Enable context receivers
- "-Xcontext-receivers",
- // Enable K2 compiler
- "-language-version=2.0",
- "-Xsuppress-version-warnings",
// https://kotlinlang.org/docs/whatsnew13.html#progressive-mode
"-progressive",
// https://kotlinlang.org/docs/multiplatform-expect-actual.html#expected-and-actual-classes
"-Xexpect-actual-classes"
)
)
+ }
+ }
+
+ tasks.withType(KotlinJvmCompile::class.java).configureEach {
+ compilerOptions {
+ freeCompilerArgs.set(
+ freeCompilerArgs.getOrElse(emptyList()) + listOf(
+ "-Xjvm-default=all"
+ )
+ )
+ jvmTarget = Versions.jvmTarget
+ }
+ }
+
+ // Kotlin requires the Java compatibility matches.
+ tasks.withType(JavaCompile::class.java).configureEach {
+ sourceCompatibility = Versions.javaVersion.toString()
+ targetCompatibility = Versions.javaVersion.toString()
+ }
+
+ plugins.withId("org.jetbrains.kotlin.multiplatform") {
+ val kotlin = extensions.getByName("kotlin") as KotlinMultiplatformExtension
+
+ // We set the JVM target (the bytecode version) above for all Kotlin-based Java bytecode
+ // compilations, but we also need to set the JDK API version for the Kotlin JVM targets to
+ // prevent linking against newer JDK APIs (the Android targets link against the android.jar).
+ @OptIn(ExperimentalKotlinGradlePluginApi::class)
+ kotlin.targets.withType(KotlinJvmTarget::class.java) {
+ compilerOptions {
+ freeCompilerArgs.set(
+ freeCompilerArgs.getOrElse(emptyList()) + listOf(
+ "-Xjdk-release=${Versions.javaVersion}"
+ )
+ )
+ }
+ }
- jvmTarget.set(Versions.jvmTarget)
+ kotlin.targets.withType(KotlinNativeTarget::class.java) {
+ binaries.withType(Framework::class.java) {
+ linkerOpts += "-lsqlite3"
+ }
}
}
}
@@ -99,14 +133,18 @@ private fun Project.configureCommonKotlin() {
*/
private fun Project.configureCommonCompose() {
tasks.withType().configureEach {
- kotlinOptions.freeCompilerArgs += listOf(
- // https://github.com/JetBrains/compose-multiplatform/issues/3421
- "-Xpartial-linkage=disable",
- // https://github.com/JetBrains/compose-multiplatform/issues/3418
- "-Xklib-enable-signature-clash-checks=false",
- // Translate capturing lambdas into anonymous JS functions rather than hoisting parameters
- // and creating a named sibling function. Only affects targets which produce actual JS.
- "-Xir-generate-inline-anonymous-functions"
- )
+ compilerOptions {
+ freeCompilerArgs.set(
+ freeCompilerArgs.getOrElse(emptyList()) + listOf(
+ // https://github.com/JetBrains/compose-multiplatform/issues/3421
+ "-Xpartial-linkage=disable",
+ // https://github.com/JetBrains/compose-multiplatform/issues/3418
+ "-Xklib-enable-signature-clash-checks=false",
+ // Translate capturing lambdas into anonymous JS functions rather than hoisting parameters
+ // and creating a named sibling function. Only affects targets which produce actual JS.
+ "-Xir-generate-inline-anonymous-functions"
+ )
+ )
+ }
}
}
diff --git a/gradle.properties b/gradle.properties
index 434b629..679af8e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -22,6 +22,9 @@ kotlin.mpp.stability.nowarn=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.androidSourceSetLayoutVersion=2
+# https://kotl.in/issue
+kotlin.apple.xcodeCompatibility.nowarn=true
+
# Compose
#org.jetbrains.compose.experimental.wasm.enabled=true
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index b0c4662..3f4184b 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,7 +1,7 @@
[versions]
-kotlin = "1.9.24"
+kotlin = "2.0.0"
agp = "8.2.2"
-redwood = "0.11.0"
+redwood = "0.12.0"
androidx-activityCompose = "1.9.0"
androidx-appcompat = "1.7.0"
@@ -42,6 +42,7 @@ jetbrains-compose-animation = { module = "org.jetbrains.compose.animation:animat
jetbrains-components-resources = { module = "org.jetbrains.compose.components:components-resources", version.ref = "jbr-compose" }
# Redwood: https://github.com/cashapp/redwood
+redwood-gradle-plugin = { module = "app.cash.redwood:redwood-gradle-plugin", version.ref = "redwood" }
redwood-compose = { module = "app.cash.redwood:redwood-compose", version.ref = "redwood" }
redwood-composeui = { module = "app.cash.redwood:redwood-composeui", version.ref = "redwood" }
redwood-widget-compose = { module = "app.cash.redwood:redwood-widget-compose", version.ref = "redwood" }
@@ -65,7 +66,7 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref
kotlin-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "jbr-compose" }
-cashapp-redwood = { id = "app.cash.redwood", version.ref = "redwood" }
+compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
[bundles]
asm = []
diff --git a/iosApp/Podfile.lock b/iosApp/Podfile.lock
index c4bf2dd..e8b2556 100644
--- a/iosApp/Podfile.lock
+++ b/iosApp/Podfile.lock
@@ -15,7 +15,7 @@ EXTERNAL SOURCES:
:path: "../shared"
SPEC CHECKSUMS:
- shared: 322de44d4a2cd8a0315d0b724307402aaa406311
+ shared: b0aff9d3bb868970fd514cb63f47dc4df82d3eb7
SwiftFormat: d30e6e1c9a85f4bce83394af184e2c1d03032605
PODFILE CHECKSUM: c865212f162b25efab1f4c3a7c4b85bdb722c41e
diff --git a/redwood/shared-composeui/build.gradle.kts b/redwood/shared-composeui/build.gradle.kts
index cab686b..ffd9072 100644
--- a/redwood/shared-composeui/build.gradle.kts
+++ b/redwood/shared-composeui/build.gradle.kts
@@ -1,6 +1,6 @@
plugins {
kotlin("jvm")
- alias(libs.plugins.cashapp.redwood)
+ alias(libs.plugins.compose.compiler)
}
dependencies {
diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts
index 5aa4223..cf3d9e3 100644
--- a/shared/build.gradle.kts
+++ b/shared/build.gradle.kts
@@ -1,25 +1,28 @@
-import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
+import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlin.cocoapods)
- alias(libs.plugins.cashapp.redwood)
+ alias(libs.plugins.compose.compiler)
alias(libs.plugins.android.library)
id("dev.icerock.mobile.multiplatform-resources")
}
kotlin {
- @OptIn(ExperimentalKotlinGradlePluginApi::class)
- compilerOptions {
- freeCompilerArgs.add("-Xexpect-actual-classes")
+ // https://youtrack.jetbrains.com/issue/KT-61573
+ targets.configureEach {
+ compilations.configureEach {
+ compileTaskProvider.configure {
+ compilerOptions {
+ freeCompilerArgs.add("-Xexpect-actual-classes")
+ }
+ }
+ }
}
androidTarget {
- compilations.all {
- kotlinOptions {
- jvmTarget = Versions.javaVersion.toString()
- }
- }
+ @Suppress("OPT_IN_USAGE")
+ unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
}
iosX64()
@@ -39,9 +42,18 @@ kotlin {
export(moko.resources)
export(moko.graphics)
}
+ extraSpecAttributes["swift_version"] = "[\'5.0\']" // SKIE Needs this!
}
sourceSets {
+ all {
+ languageSettings.apply {
+ optIn("kotlin.RequiresOptIn")
+ optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
+ optIn("kotlin.time.ExperimentalTime")
+ }
+ }
+
commonMain.dependencies {
// Redwood
implementation(libs.redwood.compose)
@@ -93,10 +105,6 @@ android {
sourceCompatibility = Versions.javaVersion
targetCompatibility = Versions.javaVersion
}
-
- composeOptions {
- kotlinCompilerExtensionVersion = Versions.composeCompiler
- }
}
/* task 'testClasses' not found in project */
diff --git a/shared/shared.podspec b/shared/shared.podspec
index 52a84ba..8b43144 100644
--- a/shared/shared.podspec
+++ b/shared/shared.podspec
@@ -8,7 +8,7 @@ Pod::Spec.new do |spec|
spec.summary = 'Some description for the Shared Module'
spec.vendored_frameworks = 'build/cocoapods/framework/SharedKit.framework'
spec.libraries = 'c++'
- spec.ios.deployment_target = '13.0'
+ spec.ios.deployment_target = '13.0'
if !Dir.exist?('build/cocoapods/framework/SharedKit.framework') || Dir.empty?('build/cocoapods/framework/SharedKit.framework')
@@ -22,6 +22,10 @@ Pod::Spec.new do |spec|
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
end
+ spec.xcconfig = {
+ 'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
+ }
+
spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':shared',
'PRODUCT_MODULE_NAME' => 'SharedKit',
@@ -46,5 +50,5 @@ Pod::Spec.new do |spec|
SCRIPT
}
]
-
+ spec.swift_version = ['5.0']
end
\ No newline at end of file