Skip to content

Commit 8e9907e

Browse files
smertnik3shSergei Shirshanov
authored andcommitted
Use "excution platform" version of cue binary
1 parent 0da0531 commit 8e9907e

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

cue/private/tools/cue/BUILD.toolchains.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ load(
44
)
55

66
declare_bazel_toolchains(
7-
toolchain_prefix = "@{tool_repo}//",
7+
tool_repo_prefix = "@{tool_repo}",
88
version = "{version}",
99
)

cue/private/tools/cue/toolchain.bzl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ _download_tool = repository_rule(
197197
)
198198

199199
# buildifier: disable=unnamed-macro
200-
def declare_bazel_toolchains(version, toolchain_prefix):
200+
def declare_bazel_toolchains(version, tool_repo_prefix):
201201
native.constraint_value(
202202
name = version,
203203
constraint_setting = "{}:tool_version".format(_CONTAINING_PACKAGE_PREFIX),
@@ -210,7 +210,7 @@ def declare_bazel_toolchains(version, toolchain_prefix):
210210
"{}:cpu_{}".format(constraint_value_prefix, platform.arch),
211211
"{}:os_{}".format(constraint_value_prefix, platform.os),
212212
],
213-
toolchain = toolchain_prefix + (":{}_{}_{}".format(platform.os, platform.arch, version)),
213+
toolchain = tool_repo_prefix + "-{os}-{arch}//:{os}_{arch}_{version}".format(arch = platform.arch, os = platform.os, version = version),
214214
toolchain_type = "@{}//tools/cue:toolchain_type".format(_MODULE_REPOSITORY_NAME),
215215
)
216216

@@ -238,10 +238,17 @@ _toolchains_repo = repository_rule(
238238
)
239239

240240
def download_tool(name, version = None):
241-
_download_tool(
242-
name = name,
243-
version = version,
244-
)
241+
version = version or _DEFAULT_TOOL_VERSION
242+
if version not in _TOOLS_BY_RELEASE:
243+
fail("Unexpected version value {} for cue tool. Availible versions is: {}".format(version, ", ".join(_TOOLS_BY_RELEASE.keys())))
244+
for platform in _TOOLS_BY_RELEASE[version].keys():
245+
repo_name = "{}-{}-{}".format(name, platform.os, platform.arch)
246+
_download_tool(
247+
name = repo_name,
248+
arch = platform.arch,
249+
os = platform.os,
250+
version = version,
251+
)
245252
_toolchains_repo(
246253
name = name + "_toolchains",
247254
tool_repo = name,

0 commit comments

Comments
 (0)