Marc Reichelt
12/29/2023, 12:54 PMproject.yml
to generate the xcodeproj file. Did anyone manage to do this? I’m following the blog post https://blog.jetbrains.com/kotlin/2021/07/multiplatform-gradle-plugin-improved-for-connecting-kmm-modules/ to use the embedAndSignAppleFrameworkForXcode
task, but I can’t even get it working by manually adjusting the Xcode settings - it won’t find the module.
Did anyone achieve this using project.yml
? Thank you!Marc Reichelt
12/29/2023, 12:55 PMembedAndSignAppleFrameworkForXcode
task. Is somebody working on that? This seems like an important gap in the docs right now.Marc Reichelt
12/29/2023, 1:01 PMhfhbd
12/29/2023, 1:09 PMMarc Reichelt
12/29/2023, 1:10 PMMarc Reichelt
12/29/2023, 3:34 PMproject.yml
so the embedAndSignAppleFrameworkForXcode
task is run ✅ and the framework gets generated! That’s at least half the thing.
For anyone trying this, I’ve had some luck using this:
preBuildScripts:
- script: |
env # prints env variables for debugging
cd "$SRCROOT/../shared"
./gradlew :embedAndSignAppleFrameworkForXcode
name: "Compile shared.framework"
showEnvVars: true
basedOnDependencyAnalysis: false
Marc Reichelt
12/29/2023, 3:35 PMld: Undefined symbols:
_OBJC_CLASS_$_ClassA, referenced from:
in SomeModule.o
_OBJC_CLASS_$_ClassB, referenced from:
in SomeModule.o
_OBJC_CLASS_$_ClassC, referenced from:
in SomeModule.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(real class names have been removed).
Any idea how to pull in that fresh framework into other targets?Marc Reichelt
12/29/2023, 4:13 PMshared
, which will then create a second shared.framework
, which of course does not contain the symbols I need - leading to the linker to fail.
But I still don’t know how to use the compiled KMM shared.framework across all our projects modules.Marc Reichelt
12/29/2023, 5:03 PMclang
command. I put that into a test.sh
so I could execute it again and again in a quick way. There are a lot of -F
options in there, which specify the framework search paths. The one for the shared.framework
was at the end - once I pulled that before all other -F
options, the clang command succeeded and created a binary ✅Marc Reichelt
12/29/2023, 5:06 PM-F
option that defines something with EagerLinkingTBDs
- does anybody know more about that? This seems to contain a .tbd
file with some JSON data about the shared framework, so that gets picked up by clang instead of picking up the real shared.framework
. Any ideas would be welcome!Marc Reichelt
12/29/2023, 5:07 PM-F/Users/mreichelt/Library/Developer/Xcode/DerivedData/MyProject-fprqwlsbahdjfhwbvkfnwnxjixzpn/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator
Marc Reichelt
12/29/2023, 5:18 PMMarc Reichelt
01/04/2024, 12:15 PMshared
target in project.yml, which xcodegen would then put into the Xcode .pbxproj file.
2. The issue with that is: this would create a (Swift) shared.framework
, with the actual KMM shared.framework
living inside it (under the Frameworks
folder) ⚠️
3. Xcode seems to generate an empty EagerLinkingTBDs
directory, with a .tbd file - for the Swift shared.framework
!
4. Now every module trying to use shared.framework
will fail to link, because it will try to link against the TBD version, and definitely not the KMM module.
So in the end, after I cleaned the DerivedData folder, I could successfully import the KMM shared.framework
by directly linking it in my desired module SomeModule
. ✅
CC @hfhbd
What I didn’t manage to get done yet is: how can I include the shared.framework
in multiple Xcode targets, without calling Gradle for each target? Still investigating.