starlark_repository: capture upstream BUILD files as starlark_package…#423
Merged
Conversation
… targets
Adds a new "preserve" build_file_generation mode that runs cmd/preserve_packages
between fetch_repo and gazelle. The tool mirrors fetch_repo -clean semantics
(deletes WORKSPACE / MODULE.bazel / etc.) but renames BUILD and BUILD.bazel to
BUILD.package and BUILD.bazel.package so the upstream package layout is
preserved as opaque files rather than discarded.
The starlarkrepository gazelle extension grows a parallel pair of kinds
alongside starlark_module / starlark_module_library:
- starlark_package: one per BUILD*.package, src points at the preserved file.
Name is the dot-sanitized filename (BUILD.package -> BUILD_package) to
avoid clashing with starlark_module names derived from .bzl files.
- starlark_package_library: emitted at the configured root, named
"starlark_packages" (not "packages", which would clash with packages.bzl).
Its `packages` attr is populated in Resolve via the RuleIndex.
starlark_repository.archive/.local default build_file_generation to "preserve"
so users get the new behavior automatically; they can still override.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a new "preserve" build_file_generation mode that runs cmd/preserve_packages between fetch_repo and gazelle. The tool mirrors fetch_repo -clean semantics (deletes WORKSPACE / MODULE.bazel / etc.) but renames BUILD and BUILD.bazel to BUILD.package and BUILD.bazel.package so the upstream package layout is preserved as opaque files rather than discarded.
The starlarkrepository gazelle extension grows a parallel pair of kinds alongside starlark_module / starlark_module_library:
packagesattr is populated in Resolve via the RuleIndex.starlark_repository.archive/.local default build_file_generation to "preserve" so users get the new behavior automatically; they can still override.