Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions nodejs/private/toolchains_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,46 @@ with only the toolchain attribute pointing into the platform-specific repositori
"""

PLATFORMS = {
"darwin_amd64": struct(
"linux_amd64": struct(
compatible_with = [
"@platforms//os:macos",
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
),
"darwin_arm64": struct(
"linux_arm64": struct(
compatible_with = [
"@platforms//os:macos",
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
),
"linux_amd64": struct(
"linux_s390x": struct(
compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
"@platforms//cpu:s390x",
],
),
"linux_arm64": struct(
"linux_ppc64le": struct(
compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
"@platforms//cpu:ppc",
],
),
"windows_amd64": struct(
"darwin_amd64": struct(
compatible_with = [
"@platforms//os:windows",
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
),
"linux_s390x": struct(
"darwin_arm64": struct(
compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:s390x",
"@platforms//os:macos",
"@platforms//cpu:aarch64",
],
),
"linux_ppc64le": struct(
"windows_amd64": struct(
compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:ppc",
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
),
}
Expand Down Expand Up @@ -108,6 +108,12 @@ toolchain(
toolchain = "@{user_node_repository_name}_{platform}//:node_toolchain",
toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
)
toolchain(
name = "{platform}_toolchain_target",
target_compatible_with = {compatible_with},
toolchain = "@{user_node_repository_name}_{platform}//:node_toolchain",
toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
)
""".format(
platform = platform,
name = repository_ctx.attr.name,
Expand Down
5 changes: 4 additions & 1 deletion nodejs/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ def nodejs_register_toolchains(name, register = True, **kwargs):
**kwargs
)
if register:
native.register_toolchains("@%s_toolchains//:%s_toolchain" % (name, platform))
native.register_toolchains(
"@%s_toolchains//:%s_toolchain_target" % (name, platform),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment that this one needs to be first so it's resolved

"@%s_toolchains//:%s_toolchain" % (name, platform),
)

nodejs_repo_host_os_alias(
name = name + "_host",
Expand Down