Fix the MoonBit hermetic toolchain wiring in rules_moonbit. The toolchain exists but is not properly connected to the rules.
- ✅ Toolchain type defined in
moonbit/BUILD.bazel - ✅ Hermetic toolchain registration in
moonbit/tools/hermetic_toolchain.bzl - ✅ Toolchain resolution updated in
moonbit/private/compilation.bzl
- ❌ Remove
_moonbit_hermetic_toolchainattributes from all rules - ❌ Add
toolchains = ["//moonbit:moonbit_toolchain_type"]to all rules - ❌ Create module extension for MODULE.bazel
-
Define toolchain_type ✅
- Done in
moonbit/BUILD.bazel
- Done in
-
Register toolchain ✅
- Done in
moonbit/tools/hermetic_toolchain.bzl
- Done in
-
Add toolchains to rules ❌
- Need to add
toolchains = ["//moonbit:moonbit_toolchain_type"]to:moonbit_librarymoonbit_binarymoonbit_wasmmoonbit_jsmoonbit_c
- Need to add
-
Update compilation to use toolchain resolution ✅
- Done in
moonbit/private/compilation.bzl
- Done in
-
Create module extension ❌
- Add to
MODULE.bazelto auto-register toolchain
- Add to
moonbit/BUILD.bazel: ✅ Toolchain type definedmoonbit/tools/hermetic_toolchain.bzl: ✅ Toolchain registration updatedmoonbit/private/compilation.bzl: ✅ Toolchain resolution updatedmoonbit/private/moon.bzl: ❌ Still has hermetic toolchain attributesMODULE.bazel: ❌ Needs module extension
- Remove
_moonbit_hermetic_toolchainattributes from all rules - Add
toolchains = ["//moonbit:moonbit_toolchain_type"]to all rules - Create module extension in MODULE.bazel
- Test the complete toolchain wiring
Remove attribute from all rules:
- moonbit_library
- moonbit_binary
- moonbit_wasm
- moonbit_js
- moonbit_c
Add toolchains parameter to all rules:
moonbit_library = rule(
implementation = _moonbit_library_impl,
attrs = {
"srcs": attr.label_list(...),
"deps": attr.label_list(...),
},
toolchains = ["//moonbit:moonbit_toolchain_type"],
)Add module extension to auto-register toolchain:
moonbit_toolchain = use_extension(
"//moonbit:extensions.bzl",
"moonbit_toolchain",
)
use_repo(moonbit_toolchain, "moonbit_toolchain")- Phase 1: Toolchain Infrastructure ✅ Complete
- Phase 2: Rule Integration ❌ In Progress
- Phase 3: Module Extension ❌ Not Started
- Phase 4: Testing ❌ Not Started
Estimated Completion: 80% complete
- Bazel Toolchain Resolution
- rules_rust toolchain implementation
- rules_wasm_component toolchain implementation
Toolchain Wiring: In Progress - 80% Complete 🎉