Closed shahzadmajeed closed 2 years ago
It seems there is no way to include arguments for create-xcframework command but following did the trick for the issue I was facing.
build_args: {
:default => ["SWIFT_SERIALIZE_DEBUGGING_OPTIONS='NO'"]
}
I think the above configuration (using build_args
) seems like an appropriate workaround for the issue. Alternatively, you can update the corresponding setting in post_install hooks.
Yes, build_args
worked for now. Although there is no way to include arguments for xcframeworks command at this point.
Just a clarifying question on post_install hooks.. Doesn't post_install hook phase happen after the binaries are built?
Let me quickly explain how it works in this case.
1/ When prebuilding frameworks, the plugin creates a dedicated installer to build the frameworks.
This installer has the Pods project in _Prebuild/Pods.xcodeproj
(let's call this the prebuild Pods project), not Pods/Pods.xcodeproj
(let's call this the default Pods project).
You can find this prebuild Pods project in the xcodebuild
command printed to the console when prebuilding frameworks.
2/ The prebuild Pods project has (almost) identical build settings with the default Pods project b/c it goes through a full installation like in the default Pods project. The hooks (pe_install & post_install) are triggered during its installation.
3/ Only after the installation of the prebuild Pods project finishes do we prebuild the frameworks.
Following is the order of the steps happening in a prebuild scenario
- validate cache (hit & missed)
- prebuild missed cache
- create prebuild installer (sandbox: _Prebuild)
- run prebuild installer (to generate _Prebuild/Pods.xcodeproj)
- pre_install & post_install hooks are called as usual (but for _Prebuild/Pods.xcodeproj)
- build frameworks (against _Prebuild/Pods.xcodeproj)
- integrate back to Pods/Pods.xcodeproj
In short, the plugin guarantees that what customized settings you have for the project will properly take effect when prebuilding frameworks.
Hope the explanation clears your doubt.
@trinhngocthuyen thank you for explaining pre-building frameworks process. That makes sense and I, now, understand the purpose of _Prebuild/Pods.xcodeproj
.
The reason I got the perception that post_install might happen after building the frameworks is because that was the first thing I tried when I was trying to add SWIFT_SERIALIZE_DEBUGGING_OPTIONS
but I couldn't see it as part of xcodebuild command. I must have done something wrong there.
Again, thank you for such a detailed response on the process.
Checklist
Issue Description
Command executed
What went wrong?
Environment
Plugin version
Installed CocoaPods plugins