From 6f005157368d1e01a5dd22ead4eb310e608ea6b2 Mon Sep 17 00:00:00 2001 From: Travis Reitter Date: Tue, 19 Apr 2022 23:10:55 -0700 Subject: [PATCH] Apple Silicon build fixes for todoapp (#1999) * upgrade Reaktive to one that has better Apple Silicon support * upgrade SQLDelight for Apple Silicon support * Fix build to support Apple Silicon Some of this code could be better centralized though I've been unable to find a solution. * simplify utils/build.gradle.kts * workaround * fix review comments * sample todoapp: rename Todo.framework -> KotlinCommon.framework Co-authored-by: dima.avdeev --- examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt | 4 ++-- examples/todoapp/buildSrc/gradle.properties | 1 + examples/todoapp/common/main/build.gradle.kts | 4 ---- examples/todoapp/common/root/build.gradle.kts | 2 +- examples/todoapp/gradle.properties | 1 + examples/todoapp/ios/TodoApp.xcodeproj/project.pbxproj | 7 ++++--- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt index 52799d9233..bc5b542f1d 100644 --- a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt +++ b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -69,7 +69,7 @@ object Deps { object Badoo { object Reaktive { - private const val VERSION = "1.1.22" + private const val VERSION = "1.2.1" const val reaktive = "com.badoo.reaktive:reaktive:$VERSION" const val reaktiveTesting = "com.badoo.reaktive:reaktive-testing:$VERSION" const val utils = "com.badoo.reaktive:utils:$VERSION" @@ -79,7 +79,7 @@ object Deps { object Squareup { object SQLDelight { - private const val VERSION = "1.5.0" + private const val VERSION = "1.5.3" const val gradlePlugin = "com.squareup.sqldelight:gradle-plugin:$VERSION" const val androidDriver = "com.squareup.sqldelight:android-driver:$VERSION" diff --git a/examples/todoapp/buildSrc/gradle.properties b/examples/todoapp/buildSrc/gradle.properties index 5aab64a51b..f08da92932 100755 --- a/examples/todoapp/buildSrc/gradle.properties +++ b/examples/todoapp/buildSrc/gradle.properties @@ -1,3 +1,4 @@ # TODO can we get rid of duplication with root gradle.properties? +#todo remove -Pkotlin.version=1.6.20 from Xcode project, when stable version on Compose with Koltin 1.6.20 or later released kotlin.version=1.6.10 compose.version=1.1.0 diff --git a/examples/todoapp/common/main/build.gradle.kts b/examples/todoapp/common/main/build.gradle.kts index 7aaa2ef8ee..3a7f332adb 100755 --- a/examples/todoapp/common/main/build.gradle.kts +++ b/examples/todoapp/common/main/build.gradle.kts @@ -26,8 +26,4 @@ kotlin { } } } - - targets.getByName("iosX64").compilations.forEach { - it.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlite3") - } } diff --git a/examples/todoapp/common/root/build.gradle.kts b/examples/todoapp/common/root/build.gradle.kts index 2e31fa4444..e8670586f4 100755 --- a/examples/todoapp/common/root/build.gradle.kts +++ b/examples/todoapp/common/root/build.gradle.kts @@ -10,7 +10,7 @@ kotlin { ios { binaries { framework { - baseName = "Todo" + baseName = "KotlinCommon" linkerOpts.add("-lsqlite3") export(project(":common:database")) export(project(":common:main")) diff --git a/examples/todoapp/gradle.properties b/examples/todoapp/gradle.properties index c9f33ec9f7..b8b81092a6 100755 --- a/examples/todoapp/gradle.properties +++ b/examples/todoapp/gradle.properties @@ -23,5 +23,6 @@ org.gradle.parallel=true org.gradle.caching=true kotlin.native.disableCompilerDaemon=true +#todo remove -Pkotlin.version=1.6.20 from Xcode project, when stable version on Compose with Koltin 1.6.20 or later released kotlin.version=1.6.10 compose.version=1.1.0 \ No newline at end of file diff --git a/examples/todoapp/ios/TodoApp.xcodeproj/project.pbxproj b/examples/todoapp/ios/TodoApp.xcodeproj/project.pbxproj index 7c61dcdd98..73fcfcfdb4 100644 --- a/examples/todoapp/ios/TodoApp.xcodeproj/project.pbxproj +++ b/examples/todoapp/ios/TodoApp.xcodeproj/project.pbxproj @@ -29,7 +29,7 @@ 1F00F390257599DA00CFAF97 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 1F00F393257599DA00CFAF97 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 1F00F395257599DA00CFAF97 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 1F00F3A325759FEC00CFAF97 /* Todo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Todo.framework; path = "../common/root/build/xcode-frameworks/Todo.framework"; sourceTree = ""; }; + 1F00F3A325759FEC00CFAF97 /* KotlinCommon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KotlinCommon.framework; path = "../common/root/build/xcode-frameworks/KotlinCommon.framework"; sourceTree = ""; }; 1F00F3A72575A16400CFAF97 /* ObservableValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableValue.swift; sourceTree = ""; }; 1F00F3A92575A71000CFAF97 /* MutableStateBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutableStateBuilder.swift; sourceTree = ""; }; 1F00F3AB2575AA4500CFAF97 /* ListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListView.swift; sourceTree = ""; }; @@ -101,7 +101,7 @@ 1F00F3A225759FEC00CFAF97 /* Frameworks */ = { isa = PBXGroup; children = ( - 1F00F3A325759FEC00CFAF97 /* Todo.framework */, + 1F00F3A325759FEC00CFAF97 /* KotlinCommon.framework */, ); name = Frameworks; sourceTree = ""; @@ -171,6 +171,7 @@ }; /* End PBXResourcesBuildPhase section */ +/* TODO Remove workaround -Pkotlin.version=1.6.20, when newer version of Compose released */ /* Begin PBXShellScriptBuildPhase section */ 1F00F39D25759BB300CFAF97 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -187,7 +188,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd $SRCROOT/..\n./gradlew :common:root:embedAndSignAppleFrameworkForXcode\n"; + shellScript = "cd $SRCROOT/..\n./gradlew :common:root:embedAndSignAppleFrameworkForXcode -Pkotlin.version=1.6.20\n"; }; /* End PBXShellScriptBuildPhase section */