Skip to content

Commit 9981c77

Browse files
helly25fmeum
andauthored
Simplify url generation (#484)
Do not require complicated management of the url_base. The entries are all but a few the same anyway. --------- Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
1 parent addbaae commit 9981c77

File tree

1 file changed

+3
-58
lines changed

1 file changed

+3
-58
lines changed

toolchain/internal/llvm_distributions.bzl

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -596,70 +596,14 @@ _llvm_distributions = {
596596
# Note: Unlike the user-specified llvm_mirror attribute, the URL prefixes in
597597
# this map are not immediately appended with "/". This is because LLVM prebuilt
598598
# URLs changed when they switched to hosting the files on GitHub as of 10.0.0.
599+
_llvm_distributions_base_url_default = "https://github.com/llvm/llvm-project/releases/download/llvmorg-"
599600
_llvm_distributions_base_url = {
600601
"6.0.0": "https://releases.llvm.org/",
601602
"6.0.1": "https://releases.llvm.org/",
602603
"7.0.0": "https://releases.llvm.org/",
603604
"8.0.0": "https://releases.llvm.org/",
604605
"8.0.1": "https://releases.llvm.org/",
605606
"9.0.0": "https://releases.llvm.org/",
606-
"10.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
607-
"10.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
608-
"11.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
609-
"11.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
610-
"11.1.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
611-
"12.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
612-
"12.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
613-
"13.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
614-
"13.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
615-
"14.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
616-
"14.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
617-
"14.0.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
618-
"14.0.3": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
619-
"14.0.4": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
620-
"14.0.5": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
621-
"14.0.6": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
622-
"15.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
623-
"15.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
624-
"15.0.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
625-
"15.0.3": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
626-
"15.0.4": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
627-
"15.0.5": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
628-
"15.0.6": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
629-
"15.0.7": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
630-
"16.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
631-
"16.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
632-
"16.0.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
633-
"16.0.3": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
634-
"16.0.4": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
635-
"16.0.5": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
636-
"16.0.6": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
637-
"17.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
638-
"17.0.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
639-
"17.0.3": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
640-
"17.0.4": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
641-
"17.0.5": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
642-
"17.0.6": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
643-
"18.1.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
644-
"18.1.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
645-
"18.1.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
646-
"18.1.3": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
647-
"18.1.4": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
648-
"18.1.5": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
649-
"18.1.6": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
650-
"18.1.7": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
651-
"18.1.8": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
652-
"19.1.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
653-
"19.1.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
654-
"19.1.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
655-
"19.1.3": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
656-
"19.1.4": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
657-
"19.1.5": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
658-
"19.1.6": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
659-
"19.1.7": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
660-
"20.1.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
661-
"20.1.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
662-
"20.1.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
663607
}
664608

665609
def _get_auth(ctx, urls):
@@ -755,7 +699,8 @@ def _distribution_urls(rctx):
755699
if rctx.attr.alternative_llvm_sources:
756700
for pattern in rctx.attr.alternative_llvm_sources:
757701
urls.append(pattern.format(llvm_version = llvm_version, basename = basename))
758-
urls.append("{0}{1}".format(_llvm_distributions_base_url[llvm_version], url_suffix))
702+
url_base = _llvm_distributions_base_url.get(llvm_version, _llvm_distributions_base_url_default)
703+
urls.append(url_base + url_suffix)
759704

760705
sha256 = _llvm_distributions[basename]
761706

0 commit comments

Comments
 (0)