Skip to content
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

Pass datamodels to AppleResourceInfo in _precompiled_apple_resource_bundle #746

Closed
wants to merge 1 commit into from

Conversation

thiagohmcruz
Copy link
Contributor

@thiagohmcruz thiagohmcruz commented Jul 27, 2023

When integrating with rules_xcodeproj noticed that after generating an Xcode project the generator wasn't picking up existing .xccurrentversion files under .xcdatamodeld directories due to rules_ios not propagating these in the providers of _precompiled_apple_resource_bundle.

Because of this once you launch Xcode (just launching, no other user action needed) it is generating a non-empty git diff with .xccurrentversion files changed, most likely an Xcode internal logic to try to heal itself and find some .xccurrentversion to load (which could be different than the one you intended to use if you've got multiple version).

This PR passes datamodels to AppleResourceInfo to fix that.

Requires: bazel-ios/rules_apple@8210cec

Without this rules_apple change we would hit the exception in the commit above:

raise Exception(f"failed to clonefile {src} to {full_dest}")

confirmed that the file being copied is exactly the same, so even though there's an overwrite happening when using shutil it's replacing a file for another file that is the same.

@@ -199,6 +199,12 @@ def _precompiled_apple_resource_bundle_impl(ctx):
return [
AppleResourceInfo(
unowned_resources = depset(),
datamodels = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it fair to say this change causes duplicating the data in the action graph or duplicating inputs somehow? Maybe we could move the xcdatamodel to be exclusively fed here or somehow mitigate copying it 2 times - that might cause an issue with upstream rules_apple but better to not have to copy files in general VS clone them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants