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

[7.2.0] Fix bazel fetch #21841

Merged
merged 7 commits into from
Mar 28, 2024
Merged

[7.2.0] Fix bazel fetch #21841

merged 7 commits into from
Mar 28, 2024

Conversation

SalmaSamy
Copy link
Contributor

Context:
Fetch uses traditional query which relies on the initial loading phase of the build,
this lacks the context of build configurations (flags, select() logic),
leading to potentially inaccurate or over-inclusive dependency listings.

To address this issue, the logic has been revised to rely on the build command but with --nobuild flag. Then Bazel stops its operations after the analysis phase, during which it resolves configurations and determines how options impact target definitions. This adjustment guarantees that all essential repositories are fetched for offline builds, while avoiding potential over-fetching

Backported commits:

justinhorvitz and others added 6 commits March 28, 2024 13:06
PiperOrigin-RevId: 579840409
Change-Id: I67eeea72f2bb935581f6f7afe71f0b72fb6f4c1a
This annotation is orthogonal to AutoCodec and creates a circular dependency in
a later change.

PiperOrigin-RevId: 579867965
Change-Id: Iff7ab004d7635c32edb9de38231b2d4c93469c6f
Work towards platform-based flags: #19409.

PiperOrigin-RevId: 580452068
Change-Id: If94e0fbd9a815bfe3decca21ef1fd58003b4c366
This CL adds aspect nodes as explicit targets in cquery deps by making
ConfiguredTargetQueryEnvironment generic over a new interface,
CqueryNode, rather than ConfiguredTarget.

CqueryNode is implemented by AspectKey as well as ConfiguredTarget so
that both can be traversed in a deps query.

PiperOrigin-RevId: 595509373
Change-Id: I8a637cd3ed640907d2b1501bcd2b4a4507d183e7
Context:
- Traditional query relies on the initial loading phase of the build, this lacks the context of build configurations (flags, select() logic), leading to potentially inaccurate or over-inclusive dependency listings.

- cquery executes after the analysis phase, where Bazel has resolved configurations and determined how options influence target definitions. This allows cquery to provide the dependencies truly needed for a build under the current settings.

Considering these differences, I'm updating fetch target logic to rely on cquery instead. This ensures that all necessary repositories are fetched for an offline build while avoiding potential over-fetching

PiperOrigin-RevId: 611455579
Change-Id: I2a954476c06182fd9eb78ad86def7bd72f04074a
Using cquery for fetching targets caused some problems #21728 as cquery is not prepared to deal with targets including `...`

Updated the logic to use build command with no-build option, which should operate the same and actually do less work than cquery

PiperOrigin-RevId: 619540572
Change-Id: Id26a61229c13bd12373478fe17e67200f2760be2
@SalmaSamy SalmaSamy requested a review from a team as a code owner March 28, 2024 12:32
@github-actions github-actions bot added awaiting-review PR is awaiting review from an assigned reviewer team-Configurability platforms, toolchains, cquery, select(), config transitions team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Performance Issues for Performance teams team-Rules-CPP Issues for C++ rules team-Rules-Java Issues for Java rules team-Rules-Python Native rules for Python labels Mar 28, 2024
@SalmaSamy SalmaSamy removed the request for review from a team March 28, 2024 12:32
@bazelbuild bazelbuild deleted a comment from google-cla bot Mar 28, 2024
Copy link
Member

@meteorcloudy meteorcloudy left a comment

Choose a reason for hiding this comment

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

Thanks!

@meteorcloudy meteorcloudy enabled auto-merge (squash) March 28, 2024 15:26
@meteorcloudy meteorcloudy merged commit 026ffe4 into release-7.2.0 Mar 28, 2024
33 of 34 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Mar 28, 2024
@iancha1992 iancha1992 deleted the fix-fetch branch September 16, 2024 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Performance Issues for Performance teams team-Rules-CPP Issues for C++ rules team-Rules-Java Issues for Java rules team-Rules-Python Native rules for Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants