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

Implement 'first pass' of index while building V2 #217

Merged
merged 9 commits into from
Mar 4, 2021

Conversation

jerrymarino
Copy link
Contributor

@jerrymarino jerrymarino commented Feb 25, 2021

This concludes the first step of mitigating perf issues and first PR in
the series for index while building - docs/index_while_building.md.

Hinging on the feature, swift.index_while_building_v2, it moves
rules_ios to use a global index and pulls in the swift PR
bazelbuild/rules_swift#567, and index-import PR
MobileNativeFoundation/index-import#53 .

In hopes of mitigating performance problems of processing the global
index in this way it flips the -incremental bit.
Longer term we will not be processing a global index, per
docs/index_while_building.md so this is temporary measure.

This PR implements line items from 'Index while building V2 - first
pass' in the roadmap for this feature defined in
docs/index_while_building.md.

rules/library.bzl Show resolved Hide resolved
index_while_building_objc_copts = select({
"@build_bazel_rules_ios//:index_while_building_v2": [
# Note: this won't work work for remote caching yet. It uses a
# _different_ global index for objc than so that the BEP grep in
Copy link
Member

Choose a reason for hiding this comment

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

than what?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs more work for clang - I've outlined the entire solution to index while building V2 here: https://github.com/bazel-ios/rules_ios/blob/master/docs/index_while_building.md#objc-remote-cache-support

.bazelrc Outdated Show resolved Hide resolved
BUILD.bazel Outdated Show resolved Hide resolved
@@ -53,13 +53,15 @@ def rules_ios_dependencies():
sha256 = "1fff3fa1e565111a8f678b4698792101844f57b2e78c5e374431d0ebe97f6b6c",
)

# Note: this is a branch of the rules_swift PR
# https://github.com/bazelbuild/rules_swift/pull/567
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you plan to merge this PR after merging the rules_swift PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@congt we ended up deciding to to use a short lived fork of these dependencies to let this bake and reap the benefits while upstream refactoring is worked out.

Copy link
Collaborator

@justinseanmartin justinseanmartin Feb 26, 2021

Choose a reason for hiding this comment

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

I'm so sorry, I think there was some miscommunication in that meeting on Wednesday. I talked with @segiddins and @amberdixon and we'd heard different things (Sam closer to me, Amber closer to you), so my apologies for not ensuring we were all on the same page about next steps.

I'm super excited to get this landed and the immediate impact it will have. Is there an impediment to upstreaming the changes, or is it the work to address PR feedback and gathering consensus on the approach? Are we concerned there will be pushback overall?

In general, we've taken the approach of attempting to upstream changes first, and only resorting to forking if we can't get the changes landed. If we hit a wall upstreaming the changes, then we should reevaluate. My perspective is that it is harder to unfork things as time goes on, and there isn't as much incentive to unfork, which is more likely to lead to a fork becoming long lived (which has associated maintenance cost). I'm aware that this means it takes longer to realize the impact of the work. I'm definitely open to other perspectives here, both from you and the rest of the team.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree to getting this upstreamed and want to get it working for all Bazel users. We should try to work with the maintainers of rules_swift to get it landed. That being said, the PR has been open at rules_swift since last Friday which should be upstream able. I also mentioned the short lived fork in our plan to move this forward https://github.com/bazel-ios/rules_ios/pull/212/files#diff-26cd539e3b611f02c1703c8fce4656a533b33dc08a4479ab5bfa7523260fa292R123

@segiddins can you list the required changes to land this? There's been a lot of ideas shared and back and forth on the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinseanmartin Here is what I propose for the next steps:

  1. keep the temp fork of rules_swift/index-import until everyone feels good about landing the PR ( and weeks of testing internally )
  2. land the PR in rules_ios that points at the forks of index-import and rules_swift
  3. point repos at HEAD of rules_ios after the PR lands

Overall we might want to have a larger discussion with the community around landing PRs and features into rules_swift behind feature flags. It's a great way to share ideas. Not everyone has access to work that way ATM.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Overall, we're in agreement with the commitment to actively work to get unforked in the near term (weeks not months), taking an active role in reaching out and collaborating with rules_swift and index-import maintainers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinseanmartin SGTM - I'm fully in support to getting this un-forked in some form 👍

Longer term I hope we can get a flag to handle this in swift / clang: that'd be the ideal state for this specific issue. The main reason we need to the helper binary ( e.g. my PR to index-import ) in rules_swift is that we can't tell the compiler to index only impl files. We'll also need to wait for that release cycle if we go with the swift/clang approach, that is if we could get it landed in there.

@jerrymarino jerrymarino force-pushed the jmarino/index_while_building_v2_first_pass branch from 762ab1d to ec6a67f Compare February 26, 2021 21:49
.bazelrc Outdated Show resolved Hide resolved
rules/library.bzl Show resolved Hide resolved
This concludes the first step if mitigating perf issues and first PR in
the series for index while building - docs/index_while_building.md.

Hinging on the feature, swift.index_while_building_v2, it moves
rules_ios to use a global index and pulls in the swift PR
bazelbuild/rules_swift#567, and index-import PR
MobileNativeFoundation/index-import#53 .

In hopes of mitigating performance problems of processing the global
index in this way it flips the `-incremental` bit in the latest flag.
Longer term we will not be processing a global index, per
docs/index_while_building.md so this is temporary measure.

This PR implements line items from 'Index while building V2 - first
pass' in the roadmap for this feature defined in
docs/index_while_building.md.
@jerrymarino jerrymarino force-pushed the jmarino/index_while_building_v2_first_pass branch from 92e164f to aedaf35 Compare March 3, 2021 23:08
@jerrymarino
Copy link
Contributor Author

Seems good for now, for a followup we might want to consider moving the rules_swift dep into the workspace so that consumers have to opt in to getting our fork of rules_swift as opposed to having it loaded in repositories.bzl

@jerrymarino jerrymarino merged commit a44fba7 into master Mar 4, 2021
@jerrymarino jerrymarino deleted the jmarino/index_while_building_v2_first_pass branch March 4, 2021 01:12
jerrymarino added a commit that referenced this pull request Mar 4, 2021
* Implement 'first pass' of index while building V2

This concludes the first step if mitigating perf issues and first PR in
the series for index while building - docs/index_while_building.md.

Hinging on the feature, swift.index_while_building_v2, it moves
rules_ios to use a global index and pulls in the swift PR
bazelbuild/rules_swift#567, and index-import PR
MobileNativeFoundation/index-import#53 .

In hopes of mitigating performance problems of processing the global
index in this way it flips the `-incremental` bit in the latest flag.
Longer term we will not be processing a global index, per
docs/index_while_building.md so this is temporary measure.

This PR implements line items from 'Index while building V2 - first
pass' in the roadmap for this feature defined in
docs/index_while_building.md.
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.

5 participants