-
Notifications
You must be signed in to change notification settings - Fork 369
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
Fix partial execution with mapped kinds #1680
Conversation
d18f3c5
to
52153b0
Compare
Do you see a way to add a test case for this behavior? I agree that a refactoring would be very difficult, but a test would probably be even more valuable and potentially easier to realize. |
Unfortunately I didn't see an easy place to add a test, although you're probably more familiar with the codebase if you have suggestions. The problem is that the primary testing harnesses (generationtest, etc) don't exercise the partial-execution case, and it didn't look easy to hack in. For what it's worth, we've been running this on our (large) repo for a couple weeks now and it seems to work. |
Previously, if mapped kinds were in use (i.e. `go_library` -> `go_custom_library`), and `gazelle update` was being run on just one directory, Gazelle's indexing system would fail to correctly index build rules of the mapped-to kind in directories that were not being re-built. This is because the logic to handle mapped kinds was triggered only when Generate() was run, not for Imports(). This PR solves the issue with the smallest fix. The whole kind-mapping system is honestly kinda messy, and I didn't want to propose a major refactor.
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) | http_archive | minor | `v0.34.0` -> `v0.35.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary> ### [`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0) [Compare Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0) #### What's Changed - Don't run on centos7 in BCR presubmit and add maintainers by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1663 - update readme for v0.34.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1662 - nit: doc `gazelle_generation_test` use of `arguments.txt` by [@​vpanta](https://togithub.com/vpanta) in [bazelbuild/bazel-gazelle#1660 - feat(bzlmod): allow patches in `archive_override`s by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1665 - fix(bzlmod): fail on unused overrides by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1669 - Annotate more globs with `allow_empty = True` by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1674 - Generate BUILD files for grpc compiler by [@​mering](https://togithub.com/mering) in [bazelbuild/bazel-gazelle#1672 - Disable lockfile check for BCR test module by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1673 - Make isolated extensions usable for Go tools by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1678 - bzlmod: support go.mod replace directives with a version qualifier on the left by [@​andyscott](https://togithub.com/andyscott) in [bazelbuild/bazel-gazelle#1679 - fix CI by running both WORKSPACE and Bzlmod on select packages by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1690 - disable lockfile by default by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1692 - feat(resolve): optimize applying overrides to be efficient by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1687 - feat(fix-update): allow user to profile commands with `pprof` by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1685 - Fix partial execution with mapped kinds by [@​HALtheWise](https://togithub.com/HALtheWise) in [bazelbuild/bazel-gazelle#1680 - prepare release 0.35.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1693 #### New Contributors - [@​mering](https://togithub.com/mering) made their first contribution in [bazelbuild/bazel-gazelle#1672 **Full Changelog**: bazelbuild/bazel-gazelle@v0.34.0...v0.35.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/kreempuff/rules_unreal_engine). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) | http_archive | minor | `v0.34.0` -> `v0.35.0` | --- ### Release Notes <details> <summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary> ### [`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0) [Compare Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0) #### What's Changed - Don't run on centos7 in BCR presubmit and add maintainers by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1663 - update readme for v0.34.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1662 - nit: doc `gazelle_generation_test` use of `arguments.txt` by [@​vpanta](https://togithub.com/vpanta) in [bazelbuild/bazel-gazelle#1660 - feat(bzlmod): allow patches in `archive_override`s by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1665 - fix(bzlmod): fail on unused overrides by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1669 - Annotate more globs with `allow_empty = True` by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1674 - Generate BUILD files for grpc compiler by [@​mering](https://togithub.com/mering) in [bazelbuild/bazel-gazelle#1672 - Disable lockfile check for BCR test module by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1673 - Make isolated extensions usable for Go tools by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1678 - bzlmod: support go.mod replace directives with a version qualifier on the left by [@​andyscott](https://togithub.com/andyscott) in [bazelbuild/bazel-gazelle#1679 - fix CI by running both WORKSPACE and Bzlmod on select packages by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1690 - disable lockfile by default by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1692 - feat(resolve): optimize applying overrides to be efficient by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1687 - feat(fix-update): allow user to profile commands with `pprof` by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1685 - Fix partial execution with mapped kinds by [@​HALtheWise](https://togithub.com/HALtheWise) in [bazelbuild/bazel-gazelle#1680 - prepare release 0.35.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1693 #### New Contributors - [@​mering](https://togithub.com/mering) made their first contribution in [bazelbuild/bazel-gazelle#1672 **Full Changelog**: bazelbuild/bazel-gazelle@v0.34.0...v0.35.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) | http_archive | minor | `v0.34.0` -> `v0.35.0` | --- ### Release Notes <details> <summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary> ### [`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0) [Compare Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0) #### What's Changed - Don't run on centos7 in BCR presubmit and add maintainers by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1663 - update readme for v0.34.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1662 - nit: doc `gazelle_generation_test` use of `arguments.txt` by [@​vpanta](https://togithub.com/vpanta) in [bazelbuild/bazel-gazelle#1660 - feat(bzlmod): allow patches in `archive_override`s by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1665 - fix(bzlmod): fail on unused overrides by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1669 - Annotate more globs with `allow_empty = True` by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1674 - Generate BUILD files for grpc compiler by [@​mering](https://togithub.com/mering) in [bazelbuild/bazel-gazelle#1672 - Disable lockfile check for BCR test module by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1673 - Make isolated extensions usable for Go tools by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1678 - bzlmod: support go.mod replace directives with a version qualifier on the left by [@​andyscott](https://togithub.com/andyscott) in [bazelbuild/bazel-gazelle#1679 - fix CI by running both WORKSPACE and Bzlmod on select packages by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1690 - disable lockfile by default by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1692 - feat(resolve): optimize applying overrides to be efficient by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1687 - feat(fix-update): allow user to profile commands with `pprof` by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1685 - Fix partial execution with mapped kinds by [@​HALtheWise](https://togithub.com/HALtheWise) in [bazelbuild/bazel-gazelle#1680 - prepare release 0.35.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1693 #### New Contributors - [@​mering](https://togithub.com/mering) made their first contribution in [bazelbuild/bazel-gazelle#1672 **Full Changelog**: bazelbuild/bazel-gazelle@v0.34.0...v0.35.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) | http_archive | minor | `v0.34.0` -> `v0.35.0` | --- ### Release Notes <details> <summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary> ### [`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0) [Compare Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0) #### What's Changed - Don't run on centos7 in BCR presubmit and add maintainers by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1663 - update readme for v0.34.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1662 - nit: doc `gazelle_generation_test` use of `arguments.txt` by [@​vpanta](https://togithub.com/vpanta) in [bazelbuild/bazel-gazelle#1660 - feat(bzlmod): allow patches in `archive_override`s by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1665 - fix(bzlmod): fail on unused overrides by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1669 - Annotate more globs with `allow_empty = True` by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1674 - Generate BUILD files for grpc compiler by [@​mering](https://togithub.com/mering) in [bazelbuild/bazel-gazelle#1672 - Disable lockfile check for BCR test module by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1673 - Make isolated extensions usable for Go tools by [@​fmeum](https://togithub.com/fmeum) in [bazelbuild/bazel-gazelle#1678 - bzlmod: support go.mod replace directives with a version qualifier on the left by [@​andyscott](https://togithub.com/andyscott) in [bazelbuild/bazel-gazelle#1679 - fix CI by running both WORKSPACE and Bzlmod on select packages by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1690 - disable lockfile by default by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1692 - feat(resolve): optimize applying overrides to be efficient by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1687 - feat(fix-update): allow user to profile commands with `pprof` by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1685 - Fix partial execution with mapped kinds by [@​HALtheWise](https://togithub.com/HALtheWise) in [bazelbuild/bazel-gazelle#1680 - prepare release 0.35.0 by [@​tyler-french](https://togithub.com/tyler-french) in [bazelbuild/bazel-gazelle#1693 #### New Contributors - [@​mering](https://togithub.com/mering) made their first contribution in [bazelbuild/bazel-gazelle#1672 **Full Changelog**: bazelbuild/bazel-gazelle@v0.34.0...v0.35.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/aspect-build/rules_py). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Previously, if mapped kinds were in use (i.e. `go_library` -> `go_custom_library`), and `gazelle update` was being run on just one directory, Gazelle's indexing system would fail to correctly index build rules of the mapped-to kind in directories that were not being re-built. This is because the logic to handle mapped kinds was triggered only when Generate() was run, not for Imports(). This PR solves the issue with the smallest fix. The whole kind-mapping system is honestly kinda messy, and I didn't want to propose a major refactor. Co-authored-by: Eric Miller <eric@skydio.com>
Previously, if mapped kinds were in use (i.e.
go_library
->go_custom_library
), andgazelle update
was being run on just one directory, Gazelle's indexing system would fail to correctly index build rules of the mapped-to kind in directories that were not being re-built.This is because the logic to handle mapped kinds was triggered only when Generate() was run, not for Imports().
This PR solves the issue with the smallest fix. The whole kind-mapping system is honestly kinda messy, and I didn't want to propose a major refactor.
What type of PR is this?
Bug fix
What package or component does this PR mostly affect?
cmd/gazelle
What does this PR do? Why is it needed?
Which issues(s) does this PR fix?
Other notes for review