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__coverageseparately in a macro that mimics thepip.parseextension. This is done as part of
py_repositoriescall that isused by
WORKSPACEandbzlmodusers.@rules_python//python:nonelabel 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.
bzlmodhub_repositoryfor the coverage hub repo.I think dog fooding the
pkg_aliasesandhub_repositorya little moreis a nice thing and I might refactor the deps in the future to do that for
the
whl_libraryandpip_compiledeps. What is more I have a theory thatit may be possible to wire a
py_console_script_binaryas the coverage tool bydoing the following:
py_runtimeout 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_pyviapip_parse/pip.parseas a regular thing.py_console_script_binaryto create a single executable.py_binaryto create a single executable file (I think there isa ticket for this).
rules_platformto transition thepy_console_script_binaryinto 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.