Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make node toolchain_type public so new toolchains can be added #2591

Merged
merged 1 commit into from
Apr 7, 2021

Commits on Apr 7, 2021

  1. feat: make node toolchain_type public so new toolchains can be added

    Enables rules_nodejs to be used in cross-compilation contexts, where
    the target architecture is not supported by rules_nodejs.
    
    rules_nodejs's default toolchains are limited via target_compatible_with,
    which means they will not work when cross-compiling to Android or iOS
    with --platforms for example. With this change, users can define their
    own toolchain that is limited by execution platform instead of target
    platform.
    
    For example, if you're targeting an unsupported platform, but building
    on a Mac, you can place the following in the local WORKSPACE:
    
        register_toolchains("//ts/node_toolchain")
    
    And the following in ts/node_toolchain/BUILD.bazel:
    
        toolchain(
            name = "node_toolchain",
            exec_compatible_with = [
                "@platforms//os:osx",
                "@platforms//cpu:x86_64",
            ],
            toolchain = "@nodejs_darwin_amd64_config//:toolchain",
            toolchain_type = "@build_bazel_rules_nodejs//toolchains/node:toolchain_type",
        )
    
    Closes bazel-contrib#2565
    dae committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    a738dec View commit details
    Browse the repository at this point in the history