bartekpacia / garden

https://garden.pacia.tech
2 stars 1 forks source link

Compose Multiplatform / KMM build system #37

Open bartekpacia opened 5 months ago

bartekpacia commented 5 months ago

The task :composeApp:embedAndSignAppleFrameworksForXcode cannot be called directly with Gradle.

Its source is a bit hard to find. This is beacuse its name is concatenated:

https://github.com/JetBrains/kotlin/blob/e3542ec7d0ffb0a27b189cadc323e88e4cb8ba4f/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/apple/AppleXcodeTasks.kt#L285-L289

and here's the function that actually registers it:

https://github.com/JetBrains/kotlin/blob/e84e83568cde569ee54980542e37c87507e914bc/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/apple/AppleXcodeTasks.kt#L213

So, that Gradle task expects to find some env vars that Xcode implicitly provides to it.

I managed to run it like this:

PLATFORM_NAME=iphoneos ARCHS=arm64 ./gradlew :composeApp:embedAndSignAppleFrameworkForXcode

but it still fails with outputDir property is required and not set and it doesn't seem to be a way to set that outside of Gradle.


This looks interesting though:

xcodebuild archive \
  -scheme iosApp \
  -project iosApp.xcodeproj \
  -destination 'generic/platform=iOS' \
  -archivePath build/iosAppBuild | xcbeautify