Skip to content
Open
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
2 changes: 1 addition & 1 deletion cue/private/tools/cue/BUILD.toolchains.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ load(
)

declare_bazel_toolchains(
toolchain_prefix = "@{tool_repo}//",
tool_repo_prefix = "@{tool_repo}",
version = "{version}",
)
19 changes: 13 additions & 6 deletions cue/private/tools/cue/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ _download_tool = repository_rule(
)

# buildifier: disable=unnamed-macro
def declare_bazel_toolchains(version, toolchain_prefix):
def declare_bazel_toolchains(version, tool_repo_prefix):
native.constraint_value(
name = version,
constraint_setting = "{}:tool_version".format(_CONTAINING_PACKAGE_PREFIX),
Expand All @@ -210,7 +210,7 @@ def declare_bazel_toolchains(version, toolchain_prefix):
"{}:cpu_{}".format(constraint_value_prefix, platform.arch),
"{}:os_{}".format(constraint_value_prefix, platform.os),
],
toolchain = toolchain_prefix + (":{}_{}_{}".format(platform.os, platform.arch, version)),
toolchain = tool_repo_prefix + "-{os}-{arch}//:{os}_{arch}_{version}".format(arch = platform.arch, os = platform.os, version = version),
toolchain_type = "@{}//tools/cue:toolchain_type".format(_MODULE_REPOSITORY_NAME),
)

Expand Down Expand Up @@ -238,10 +238,17 @@ _toolchains_repo = repository_rule(
)

def download_tool(name, version = None):
_download_tool(
name = name,
version = version,
)
version = version or _DEFAULT_TOOL_VERSION
if version not in _TOOLS_BY_RELEASE:
fail("Unexpected version {} for cue tool. Available versions: {}".format(version, ", ".join(_TOOLS_BY_RELEASE.keys())))
for platform in _TOOLS_BY_RELEASE[version].keys():
repo_name = "{}-{}-{}".format(name, platform.os, platform.arch)
_download_tool(
name = repo_name,
arch = platform.arch,
os = platform.os,
version = version,
)
_toolchains_repo(
name = name + "_toolchains",
tool_repo = name,
Expand Down