Browse Source

Fix todoapp sample, iOS build (#2024)

pull/2027/head
dima-avdeev-jb 3 years ago committed by GitHub
parent
commit
3585dd3afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      examples/todoapp/buildSrc/buildSrc/build.gradle.kts
  2. 17
      examples/todoapp/buildSrc/buildSrc/src/main/kotlin/IosWorkaroundSupportArm64Simulator.kt
  3. 1
      examples/todoapp/buildSrc/gradle.properties
  4. 2
      examples/todoapp/common/database/build.gradle.kts
  5. 2
      examples/todoapp/common/edit/build.gradle.kts
  6. 4
      examples/todoapp/common/main/build.gradle.kts
  7. 6
      examples/todoapp/common/root/build.gradle.kts
  8. 2
      examples/todoapp/common/utils/build.gradle.kts
  9. 1
      examples/todoapp/gradle.properties
  10. 7
      examples/todoapp/ios/TodoApp.xcodeproj/project.pbxproj

5
examples/todoapp/buildSrc/buildSrc/build.gradle.kts

@ -5,3 +5,8 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
} }
dependencies {
//todo workaround to build iOS Arm64 simulator:
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
}

17
examples/todoapp/buildSrc/buildSrc/src/main/kotlin/IosWorkaroundSupportArm64Simulator.kt

@ -0,0 +1,17 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinTargetContainerWithNativeShortcuts
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
fun KotlinTargetContainerWithNativeShortcuts.iosWorkaroundSupportArm64Simulator(
configure: KotlinNativeTarget.() -> Unit
) {
val isBuildToSimulator = System.getenv("SDK_NAME")?.startsWith("iphonesimulator") ?: false
val isArm64Target = System.getenv("NATIVE_ARCH") == "arm64"
if (isBuildToSimulator && isArm64Target) {
//workaround:
iosSimulatorArm64(name = "ios", configure = configure)
} else {
//default behavior:
ios(configure = configure)
}
}

1
examples/todoapp/buildSrc/gradle.properties

@ -1,4 +1,3 @@
# TODO can we get rid of duplication with root gradle.properties? # 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 kotlin.version=1.6.10
compose.version=1.1.0 compose.version=1.1.0

2
examples/todoapp/common/database/build.gradle.kts

@ -11,6 +11,8 @@ sqldelight {
} }
kotlin { kotlin {
iosWorkaroundSupportArm64Simulator {}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {

2
examples/todoapp/common/edit/build.gradle.kts

@ -4,6 +4,8 @@ plugins {
} }
kotlin { kotlin {
iosWorkaroundSupportArm64Simulator {}
sourceSets { sourceSets {
named("commonMain") { named("commonMain") {
dependencies { dependencies {

4
examples/todoapp/common/main/build.gradle.kts

@ -1,11 +1,11 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins { plugins {
id("multiplatform-setup") id("multiplatform-setup")
id("android-setup") id("android-setup")
} }
kotlin { kotlin {
iosWorkaroundSupportArm64Simulator {}
sourceSets { sourceSets {
named("commonMain") { named("commonMain") {
dependencies { dependencies {

6
examples/todoapp/common/root/build.gradle.kts

@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins { plugins {
id("multiplatform-setup") id("multiplatform-setup")
id("android-setup") id("android-setup")
@ -7,10 +5,10 @@ plugins {
} }
kotlin { kotlin {
ios { iosWorkaroundSupportArm64Simulator {
binaries { binaries {
framework { framework {
baseName = "KotlinCommon" baseName = "Todo"
linkerOpts.add("-lsqlite3") linkerOpts.add("-lsqlite3")
export(project(":common:database")) export(project(":common:database"))
export(project(":common:main")) export(project(":common:main"))

2
examples/todoapp/common/utils/build.gradle.kts

@ -4,6 +4,8 @@ plugins {
} }
kotlin { kotlin {
iosWorkaroundSupportArm64Simulator {}
sourceSets { sourceSets {
named("commonMain") { named("commonMain") {
dependencies { dependencies {

1
examples/todoapp/gradle.properties

@ -23,6 +23,5 @@ org.gradle.parallel=true
org.gradle.caching=true org.gradle.caching=true
kotlin.native.disableCompilerDaemon=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 kotlin.version=1.6.10
compose.version=1.1.0 compose.version=1.1.0

7
examples/todoapp/ios/TodoApp.xcodeproj/project.pbxproj

@ -29,7 +29,7 @@
1F00F390257599DA00CFAF97 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 1F00F390257599DA00CFAF97 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
1F00F393257599DA00CFAF97 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; 1F00F393257599DA00CFAF97 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
1F00F395257599DA00CFAF97 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 1F00F395257599DA00CFAF97 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1F00F3A325759FEC00CFAF97 /* KotlinCommon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KotlinCommon.framework; path = "../common/root/build/xcode-frameworks/KotlinCommon.framework"; sourceTree = "<group>"; }; 1F00F3A325759FEC00CFAF97 /* Todo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Todo.framework; path = "../common/root/build/xcode-frameworks/Todo.framework"; sourceTree = "<group>"; };
1F00F3A72575A16400CFAF97 /* ObservableValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableValue.swift; sourceTree = "<group>"; }; 1F00F3A72575A16400CFAF97 /* ObservableValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableValue.swift; sourceTree = "<group>"; };
1F00F3A92575A71000CFAF97 /* MutableStateBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutableStateBuilder.swift; sourceTree = "<group>"; }; 1F00F3A92575A71000CFAF97 /* MutableStateBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutableStateBuilder.swift; sourceTree = "<group>"; };
1F00F3AB2575AA4500CFAF97 /* ListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListView.swift; sourceTree = "<group>"; }; 1F00F3AB2575AA4500CFAF97 /* ListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListView.swift; sourceTree = "<group>"; };
@ -101,7 +101,7 @@
1F00F3A225759FEC00CFAF97 /* Frameworks */ = { 1F00F3A225759FEC00CFAF97 /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
1F00F3A325759FEC00CFAF97 /* KotlinCommon.framework */, 1F00F3A325759FEC00CFAF97 /* Todo.framework */,
); );
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
@ -171,7 +171,6 @@
}; };
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* TODO Remove workaround -Pkotlin.version=1.6.20, when newer version of Compose released */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
1F00F39D25759BB300CFAF97 /* ShellScript */ = { 1F00F39D25759BB300CFAF97 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@ -188,7 +187,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "cd $SRCROOT/..\n./gradlew :common:root:embedAndSignAppleFrameworkForXcode -Pkotlin.version=1.6.20\n"; shellScript = "cd $SRCROOT/..\n./gradlew :common:root:embedAndSignAppleFrameworkForXcode";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */

Loading…
Cancel
Save