RFC: refactor(toolchain): create a hub repo for the coverage tool #2601
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.
This PR refactors how the coverage tool is handled in the toolchain
registration.
python_register_toolchains
, we are creating the coverage hub repopypi__coverage
separately in a macro that mimics thepip.parse
extension. This is done as part of
py_repositories
call that isused by
WORKSPACE
andbzlmod
users.@rules_python//python:none
label as the sentinel value ofno coverage tool so that the user can define a select statement that
when no coverage tool is defined a special value is passed.
bzlmod
hub_repository
for the coverage hub repo.I think dog fooding the
pkg_aliases
andhub_repository
a little moreis a nice thing and I might refactor the deps in the future to do that for
the
whl_library
andpip_compile
deps. What is more I have a theory thatit may be possible to wire a
py_console_script_binary
as the coverage tool bydoing the following:
py_runtime
out of thepython_repository
. I amnot sure if this is a pre-requisite to avoid circular deps. Maybe we don't
have to do this step.
coverage_py
viapip_parse
/pip.parse
as a regular thing.py_console_script_binary
to create a single executable.py_binary
to create a single executable file (I think there isa ticket for this).
rules_platform
to transition thepy_console_script_binary
into abinary with
values = {"collect_code_coverage": "false"}
. That way we wouldintroduce a py_runtime of one configuration to be a dependency of a different
configuration.
This refactor was partially inspired by the recent #2599 and #2597.