Conversation
There was a problem hiding this comment.
Pull Request Overview
Refactors the C++ toolchain repository rules by extracting inline implementations into dedicated impl files and updating load statements.
- Moved lazy download and eager declaration logic into
impl/declare_tools.bzlandimpl/declare_toolchain.bzl - Updated
toolchains_cc.bzlto load new repository rules (lazy_download_bins,eager_declare_toolchain) - Cleaned up debug print and centralized configuration loading
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| toolchains_cc.bzl | Removed inline _lazy_download_bins_impl/_eager_declare_toolchain_impl, now loads from impl |
| impl/declare_tools.bzl | Added _lazy_download_bins_impl and lazy_download_bins rule, removed debug print |
| impl/declare_toolchain.bzl | Added _eager_declare_toolchain_impl and eager_declare_toolchain rule, loaded config |
Comments suppressed due to low confidence (2)
impl/declare_tools.bzl:1
- [nitpick] The
directoryandsubdirectorysymbols are loaded but not used in this file. Consider removing these unused imports to clean up the code.
load("@bazel_skylib//rules/directory:directory.bzl", "directory")
impl/declare_toolchain.bzl:108
- The
declare_toolchainmacro implementation signature expectsall_toolsandtarget_tripleparameters, but they are not defined in theattrsdictionary. Addall_tools(attr.label) andtarget_triple(attr.string) entries to avoid missing attribute errors.
declare_toolchain = macro(
| "toolchain_name": attr.string( | ||
| mandatory = True, | ||
| doc = "The name of the toolchain, used for registration.", | ||
| ), |
There was a problem hiding this comment.
[nitpick] The toolchain_name attribute declared on lazy_download_bins is never used within _lazy_download_bins_impl. Either remove this unused attribute or reference rctx.attr.toolchain_name in the implementation.
| "toolchain_name": attr.string( | |
| mandatory = True, | |
| doc = "The name of the toolchain, used for registration.", | |
| ), |
| eager_declare_toolchain = repository_rule( | ||
| implementation = _eager_declare_toolchain_impl, | ||
| attrs = { | ||
| "toolchain_name": attr.string( |
There was a problem hiding this comment.
[nitpick] The toolchain_name attribute in eager_declare_toolchain is never accessed in its implementation. Consider removing it or using rctx.attr.toolchain_name to avoid unused parameters.
| # a select(...) which cant be used when inlining the labels and strings in | ||
| # the toolchain declaraltions. |
There was a problem hiding this comment.
There's a typo in the comment: 'declaraltions' should be 'declarations', and 'doesnt following' should be 'doesn't follow'.
| # a select(...) which cant be used when inlining the labels and strings in | |
| # the toolchain declaraltions. | |
| # a select(...) which can't be used when inlining the labels and strings in | |
| # the toolchain declarations. |
No description provided.