-
Notifications
You must be signed in to change notification settings - Fork 91
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
Repro: xccurrentversion file not being picked up in rules_ios #2453
Repro: xccurrentversion file not being picked up in rules_ios #2453
Conversation
I guess one option is to create a (although |
I'll take a look now. I doubt a new provider is the answer. |
Do you have a repro branch in rules_ios or rules_xcodeproj that has the crashing app with your rules_ios changes to the normal |
@mattrobmattrob thx for taking a look too! I don't have a crashing app repro, our internal apps are crashing and the reason is because Xcode selected the wrong model as in the screenshot above. Then code paths relying on the new schema would hit a stale model. Based on my testing the change in Mind clarifying how a crashing app would help with the investigation here given that we know already that the wrong model is being selected (due to |
Mostly just trying to clarify a fix in rules_ios vs. rules_xcodeproj by checking out the fixes you put into rules_ios to see what's actually wrong with them (since I haven't tried to understand that yet). |
…files Signed-off-by: Brentley Jones <github@brentleyjones.com>
@mattrobmattrob this branch, note that I reverted my previous attempts to fix this in bazel run tests/ios/xcodeproj:Foo
open Foo.xcodeproj and note how the wrong current version of the model is selected in Xcode. Then if you let the xccurrentversion files be propagated by undoing this you'll see that the issue is fixed but building arch -arch x86_64 bazel build //tests/ios/unit-test/test-imports-app:TestImports-App --define=apple.experimental.tree_artifact_outputs=1 and inspecting the find bazel-bin/tests/ios/unit-test/test-imports-app/TestImports-App.app/ -name '*.momd'
bazel-bin/tests/ios/unit-test/test-imports-app/TestImports-App.app//CoreDataExample.bundle/Model.momd
bazel-bin/tests/ios/unit-test/test-imports-app/TestImports-App.app//Model.momd (I can link to the code in |
I see there's a new commit, thx @brentleyjones! Let me test this in my original internal repro. If it works do you want me to convert this to a proper PR to be landed? |
With the latest commit here this now works as expected in my internal repro @brentleyjones. Thank you! |
Do we think my change is correct? I would guess that it is, since any way that we get an
If everyone agrees, then yes, let's change this into a PR that talks about the fix (instead of all of the repro stuff) and we can merge it. |
Yes to both There's a lot of info in this PR already so I'll create another one focused on the fix only. |
Pulls @brentleyjones's commit to fix `.xccurrentversion` files not being picked up when using `rules_ios`. Key change is to handle how `rules_ios`'s `precompiled_apple_resource_bundle` rule exposes its resources. This was causing the wrong "current version" to be set in the generated Xcode project. Adds a new `rules_ios` test case to exercise it. Note: for future reference, original discussion happened [here](#2453). --------- Signed-off-by: Thiago Cruz <thiago.hmcruz@gmail.com> Signed-off-by: Brentley Jones <github@brentleyjones.com> Co-authored-by: Brentley Jones <github@brentleyjones.com>
If a versioned data model is set in
resource_bundles
Xcode is not picking up the correct current version (Model 2
in this example). To repro:Then note:
and once you open Xcode (just launch it, no additional action needed) Xcode apparently tries to "fix itself" and update the
.xccurrentversion
file to the wrong one (Model
and notModel 2
), causing a non-emptygit status
and the app to crash on launch since it will use a stale model.Some facts I learned after some digging
rules_ios
's _precompiled_apple_resource_bundle bundles these resources and it's possible there's something missing there an it's not an issue inrules_xcodeproj
but I'm not 100% sure.xccurrentversion
files fromctx.attr.resources
inrules_ios
to datamodels "fixes" the issue above but triggers an undesired behaviour:datamodels
being set triggers arules_apple
code path that places the compiledfoo.app/bar.momd
at the root of the.app/.xctest
bundle duplicating the onerules_ios
puts underfoo.app/some_fmw.bundle/bar.momd
.xccurrentversion
files fromctx.attr.resources
inrules_ios
to unprocessed without a "parent dir" "fixes" the issue above (since it will be processed here) but triggers an undesired behaviour: the.xccurrentversion
files is added to the.app/.xctest
bundle which is undesired and will fail the build if multiple models are bundled in the same framework.Model2
instead ofModel 2
) but I think this could be a false positive and simply "luck" that Xcode picks the right one in this case.