aspect-build / aspect-build/rules_js
[FR]: Select appropriate `node_toolchain` automatically
- Dominant language
- Starlark
- Stars
- 378
- Forks
- 183
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 32
Description
### What is the current behavior?
Currently for multi-arch builds, one has to `select` on the appropriate `node_toolchain` on JS rules. For example:
```
node_toolchain = select(
{
"@platforms//cpu:arm64": "@nodejs_linux_arm64//:toolchain",
"@platforms//cpu:x86_64": "@nodejs_linux_amd64//:toolchain",
"//conditions:default": "@platforms//:incompatible",
},
),
```
From (my understanding of) the platform ideology, this behavior is unexpected, as the toolchain is coupled to the rule, rather than being registered elsewhere and automatically selected. Following similar rule syntax where the toolchain is not specified, one can find that their `js_*` targets have the wrong architecture's Node libraries bundled to them.
### Describe the feature
The node toolchains should be registered so the correct toolchain for the specified platform is chosen automatically.
Contributor guide
Research direction
Start by examining how the JS rules currently accept node_toolchain and how node toolchains are registered for platform selection. Reproduce a multi-arch js_* target using the default rule syntax, then verify that the selected Node libraries match the specified platform without a per-target select.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100