-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only update_in_place if arm64 sim slice is not present #769
Only update_in_place if arm64 sim slice is not present #769
Conversation
e624b7b
to
33623ad
Compare
deps += select({ | ||
"@build_bazel_rules_ios//:arm64_simulator_use_device_deps": [name + ".import_middleman"], | ||
"//conditions:default": vendored_deps, | ||
"//conditions:default": vendored_deps_non_arm64_sim, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to have to pull this down and give it an in-depth review - I wonder if this is overlapping with this code:
Line 392 in ac2ceab
alias_slice = arm64_simulator_slice if arm64_simulator_slice else arm64_ios_device_slice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that even if the correct alias is picked up in import_middleman
is_sim_arm64 is still True
making it run update_in_place
It's not clear to me how these two checks are supposed to work together and why I don't see the expected behaviour without the changes in this PR. Some help to clarify that would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let me followup with you later on this - I don't fully understand why we need this either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use case: Framework A
depends on xcframework B
and we want to use SwiftUI Previews in A
.
To achieve that we necessarily need link_dynamic = True
in A
(SwiftUI Previews requires dynamic linking). The issue is what to do with B
.
What I've tried:
- Set
link_dynamic = True
inB
. This will bundleB.framework
but the symbols table forB.framework/B
is empty instead of containing the correctly symbols for the current slice being used (the binary created under theimport_middleman
path is correct but it's not the one used to createB.framework/B
). This makes SwiftUI Previews fail due to missingarm64
symbols. Had I found a fix for this I'm not sure if I'd still hit the issue described in2.
next. - Leave
link_dynamic = False
inB
when I realized1.
might not be necessary sinceA
is the module launching previews in Xcode so as long asA
and it's public symbols are being linked dynamically seems like previews work fine based on my testing. The issue here is that the update_in_place logic changes the signature causing SwiftUI Previews to crash:
Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
This PR only solves this partially as it will use the arm64
+ sim
if it exists, bypassing update_in_place
. If the xcframework contains only a non-simulator arm64
slice then update_in_place
will still run and crash SwiftUI Previews.
The intent is to unblock SwiftUI Previews for scenarios where arm64
+ sim
slices are present and investigate 1.
and 2.
in a follow up.
# TODO(jmarino)Perhaps it uses a import_middleman here | ||
if len(vendored_deps): | ||
import_middleman(name = name + ".import_middleman", deps = vendored_deps, tags = ["manual"]) | ||
vendored_deps_non_arm64_sim = [d for d in vendored_deps if not vendored_deps_contains_arm64_sim_slice.get(d, False)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was able to handle both xcframeworks and non deps at a time - let me see if we can preserve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine for now, we can circle back to it at a later time
The
import_middleman
code path ultimately leads to the update_in_place script that adjusts deps for Apple Silicon. That feature is not necessary if the xcframework already contains aarm64
+sim
slice.