@@ -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
240240def 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