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

Update for rules_swift 2.x #879

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Conversation

luispadron
Copy link
Collaborator

@luispadron luispadron commented Jun 27, 2024

This fixes a missing _swift_vfs.yaml error related to the changes in: bazelbuild/rules_swift#1191

Fixes #875

This fixes a missing `_swift_vfs.yaml` error related to the changes in: bazelbuild/rules_swift#1191
@luispadron luispadron marked this pull request as draft June 27, 2024 16:04
@luispadron luispadron changed the title Use swiftc_inputs instead of deps for Swift VFS target Update for rules_swift 2.x Jun 27, 2024
@luispadron luispadron changed the title Update for rules_swift 2.x Add swift vfs via swiftc_inputs instead of deps Jun 27, 2024
@luispadron luispadron marked this pull request as ready for review June 27, 2024 16:20
@luispadron luispadron marked this pull request as draft June 27, 2024 16:27
@luispadron luispadron changed the title Add swift vfs via swiftc_inputs instead of deps Update for rules_swift 2.x Jun 27, 2024
@luispadron
Copy link
Collaborator Author

When testing this we should ensure bazel clean --expunge is run because the vfs rule is not hermetic.

The current changes help get the missing vfs file added but then leads to:

error: cannot load underlying module <Module>

@luispadron luispadron force-pushed the luis/update-for-rules_swift-2.0 branch 2 times, most recently from da4b65e to 83c7ae4 Compare June 27, 2024 17:04
@luispadron luispadron marked this pull request as ready for review June 27, 2024 17:04
@luispadron
Copy link
Collaborator Author

Should be fixed now! @brentleyjones tested on their project.

@thiagohmcruz mind testing that this works for you as well in rules_swift 1.x and ideally also in 2.x? 🙏🏼

Going to test in cash soon

@brentleyjones
Copy link

Per Slack, this has BwtB issues still.

@luispadron luispadron force-pushed the luis/update-for-rules_swift-2.0 branch 2 times, most recently from b8b4692 to beb8059 Compare July 3, 2024 16:41
@luispadron
Copy link
Collaborator Author

I updated the extended_module_map rule to forward CcInfo with the generated files, hoping that fixes any BwtB issues (we don't use that feature yet so cant really test).

I did verify this builds for us using bazel clean --expunge && bazel build //... --disk_cache= --remote_cache= to ensure no left over build artifacts.

If CI goes green I'm going to merge to unblock using rules_swift 2.0 and we can follow up with any other improvements if we run into them.

@luispadron luispadron enabled auto-merge (squash) July 3, 2024 17:23
@luispadron luispadron merged commit 1ec546a into master Jul 3, 2024
12 checks passed
@luispadron luispadron deleted the luis/update-for-rules_swift-2.0 branch July 3, 2024 17:45
luispadron added a commit that referenced this pull request Jul 5, 2024
This moves resource generation (and being added to `deps`) below the `framework_vfs` creation which uses the `deps`

With the change in #879 to add the vfs to the `swiftc_inputs`  instead of the `deps` of the `swift_library` the `framework_vfs` was now also forwarding the resources (because it gets added to `deps` after generation) to other rules (like `rules_xcodeproj`) which collect extra files from this the `swiftc_inputs` attr.

AFAIK resources aren't needed for the `framework_vfs` rules and so this change should resolve the new `rules_xcodeproj` incompatibility while making the `deps` to the `framework_vfs` more scoped.
luispadron added a commit that referenced this pull request Jul 5, 2024
This moves resource generation (and being added to `deps`) below the `framework_vfs` creation which uses the `deps`

With the change in #879 to add the vfs to the `swiftc_inputs`  instead of the `deps` of the `swift_library` the `framework_vfs` was now also forwarding the resources (because it gets added to `deps` after generation) to other rules (like `rules_xcodeproj`) which collect extra files from this the `swiftc_inputs` attr.

AFAIK resources aren't needed for the `framework_vfs` rules and so this change should resolve the new `rules_xcodeproj` incompatibility while making the `deps` to the `framework_vfs` more scoped.
luispadron added a commit that referenced this pull request Jul 5, 2024
In #879 we added the extended modulemap to the `swiftc_inputs` below this line. This PR removes the non extended modulemap from being added as an input as we only need the extended version.
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.

rules_ios fails to build using rules_swift 2.x
3 participants