-
-
Notifications
You must be signed in to change notification settings - Fork 639
chore(bazelrc): fix the update-deleted-packages script #3425
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
Open
aignas
wants to merge
2
commits into
bazel-contrib:main
Choose a base branch
from
aignas:aignas.chore.update-deleted-packages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+67
−14
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Generated via './tools/update_deleted_packages.sh' | ||
| common --deleted_packages=examples/build_file_generation | ||
| common --deleted_packages=examples/build_file_generation/random_number_generator | ||
| common --deleted_packages=examples/bzlmod | ||
| common --deleted_packages=examples/bzlmod/entry_points | ||
| common --deleted_packages=examples/bzlmod/entry_points/tests | ||
| common --deleted_packages=examples/bzlmod/libs/my_lib | ||
| common --deleted_packages=examples/bzlmod/other_module | ||
| common --deleted_packages=examples/bzlmod/other_module/other_module/pkg | ||
| common --deleted_packages=examples/bzlmod/patches | ||
| common --deleted_packages=examples/bzlmod/py_proto_library | ||
| common --deleted_packages=examples/bzlmod/py_proto_library/example.com/another_proto | ||
| common --deleted_packages=examples/bzlmod/py_proto_library/example.com/proto | ||
| common --deleted_packages=examples/bzlmod/py_proto_library/foo_external | ||
| common --deleted_packages=examples/bzlmod/runfiles | ||
| common --deleted_packages=examples/bzlmod/tests | ||
| common --deleted_packages=examples/bzlmod/tests/other_module | ||
| common --deleted_packages=examples/bzlmod/whl_mods | ||
| common --deleted_packages=examples/multi_python_versions/libs/my_lib | ||
| common --deleted_packages=examples/multi_python_versions/requirements | ||
| common --deleted_packages=examples/multi_python_versions/tests | ||
| common --deleted_packages=examples/pip_parse | ||
| common --deleted_packages=examples/pip_parse_vendored | ||
| common --deleted_packages=examples/pip_repository_annotations | ||
| common --deleted_packages=examples/py_proto_library | ||
| common --deleted_packages=examples/py_proto_library/example.com/another_proto | ||
| common --deleted_packages=examples/py_proto_library/example.com/proto | ||
| common --deleted_packages=gazelle | ||
| common --deleted_packages=gazelle/examples/bzlmod_build_file_generation | ||
| common --deleted_packages=gazelle/examples/bzlmod_build_file_generation/other_module/other_module/pkg | ||
| common --deleted_packages=gazelle/examples/bzlmod_build_file_generation/runfiles | ||
| common --deleted_packages=gazelle/manifest | ||
| common --deleted_packages=gazelle/manifest/generate | ||
| common --deleted_packages=gazelle/manifest/hasher | ||
| common --deleted_packages=gazelle/manifest/test | ||
| common --deleted_packages=gazelle/modules_mapping | ||
| common --deleted_packages=gazelle/python | ||
| common --deleted_packages=gazelle/pythonconfig | ||
| common --deleted_packages=gazelle/python/private | ||
| common --deleted_packages=tests/integration/compile_pip_requirements | ||
| common --deleted_packages=tests/integration/compile_pip_requirements_test_from_external_repo | ||
| common --deleted_packages=tests/integration/custom_commands | ||
| common --deleted_packages=tests/integration/ignore_root_user_error | ||
| common --deleted_packages=tests/integration/ignore_root_user_error/submodule | ||
| common --deleted_packages=tests/integration/local_toolchains | ||
| common --deleted_packages=tests/integration/pip_parse | ||
| common --deleted_packages=tests/integration/pip_parse/empty | ||
| common --deleted_packages=tests/integration/py_cc_toolchain_registered | ||
| common --deleted_packages=tests/modules/another_module | ||
| common --deleted_packages=tests/modules/other | ||
| common --deleted_packages=tests/modules/other/nspkg_delta | ||
| common --deleted_packages=tests/modules/other/nspkg_gamma | ||
| common --deleted_packages=tests/modules/other/nspkg_single | ||
| common --deleted_packages=tests/modules/other/simple_v1 | ||
| common --deleted_packages=tests/modules/other/simple_v2 | ||
| common --deleted_packages=tests/modules/other/with_external_data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,17 +23,19 @@ | |
| # 2. For each of the directories, get all directories that contains a BUILD.bazel file. | ||
| # 3. Sort and remove duplicates. | ||
|
|
||
| set -euxo pipefail | ||
| set -euo pipefail | ||
|
|
||
| DIR="$(dirname $0)/.." | ||
| cd $DIR | ||
|
|
||
| # The sed -i.bak pattern is compatible between macos and linux | ||
| sed -i.bak "/^[^#].*--deleted_packages/s#=.*#=$(\ | ||
| find examples/*/* tests/*/* \( -name WORKSPACE -or -name MODULE.bazel \) | | ||
| { | ||
| echo "# Generated via './tools/update_deleted_packages.sh'" | ||
| find examples tests gazelle \( -name WORKSPACE -or -name MODULE.bazel \) | | ||
| xargs -n 1 dirname | | ||
| xargs -n 1 -I{} find {} \( -name BUILD -or -name BUILD.bazel \) | | ||
| xargs -I{} find {} \( -name BUILD -or -name BUILD.bazel \) | | ||
| xargs -n 1 dirname | | ||
| grep -v "gazelle/docs" | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| sort -u | | ||
| paste -sd, -\ | ||
| )#" $DIR/.bazelrc && rm .bazelrc.bak | ||
| sed 's/^/common --deleted_packages=/g' | ||
| } | tee "$DIR"/.bazelrc.deleted_packages | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
findcommand is a great improvement. To make it even more robust and consistent with the pre-commit trigger, consider a couple of adjustments:.pre-commit-config.yamlfor this hook triggers onWORKSPACE.bzlmodfiles, but thisfindcommand doesn't look for them. It would be good to add it for consistency.filesregex is also missing thegazelledirectory andBUILDfiles (it only hasBUILD.bazel). While that's in another file, it would be good to update it as part of this PR to ensure the hook triggers correctly. The regex in.pre-commit-config.yamlshould probably be^((examples|tests|gazelle)/.*/(MODULE.bazel|WORKSPACE|WORKSPACE.bzlmod|BUILD.bazel|BUILD)|.bazelrc)$.Making these consistent will prevent future confusion.