This is super random, but it would be great to doc...
# multiplatform
c
This is super random, but it would be great to document
assembleAppleFrameworkForXcode
somewhere. I needed to use it to depend on a Kotlin framework from an iOS framework, because
embedAndSignAppleFrameworkForXcode
only works in app targets
s
You probably want an XCFramework in that case. The assembleAppleFrameworkForXcode task just builds a framework that targets the current compilation environment (ios, ios-sim, ios-sim-arm64, etc). Building an XCFramework will allow you to build all of the target environments that you want.
🙌 1
c
This is not an iOS framework distributed on its own as an artifact (for all possible target environments), but rather only in the context of a single build. This is an extremely common pattern:
Copy code
iOS framework -> App, several extensions
If i want the iOS framework to depend on the Kotlin framework in any way, it needs to be compiled before the iOS framework is, and the App won’t start compiling until after the iOS framework is done if that makes sense
(the primary reason XCFrameworks exist is to allow multiple platforms to exist in the same file, and my iOS app is an iOS app and only supports a single platform)
t
@Conrad Kramer do you know of a way to get this working with kotlin 1.6.20-RC? It seems the
assembleAppleFrameworkForXcode
task no longer exists.
c
Correct!
I use this from my framework
Copy code
export FRAMEWORKS_FOLDER_PATH=PutAnythingHere
export EXPANDED_CODE_SIGN_IDENTITY="-"
./gradlew :shared:embedAndSignAppleFrameworkForXcode
t
Nice workaround, thanks for sharing!
s
Thanks a lot for the solution @Conrad Kramer A 2 year old post and I even found it. (I have to build an app with iOS extensions which use some code from the shared module). In case that some finds this in two years: Today Xcode has enabled “User Script Sandboxing” and
PutAnythingHere
is appended to
DerivedData/ios/Build/Products/$(CONFIGURATION)/
(also an absolute path is appended) where the java process has no write-permission I had to disable the sandboxing (make sure to “reboot” aka stop Xcode and kill the gradle daemon).
c
Yes! I also had to disable script sandboxing. Very cool that you were able to find this. Here is the full source code to the project I’m working on, incl GitHub Actions pipelines and everything: https://github.com/conradev/wallet
s
thanks for sharing the repo.
m
kill the gradle daemon
OMG I just spent 2 hours on this 🤦‍♂️ . Thanks!