forked from bazel-contrib/rules_nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bazel-integration-testing.patch
54 lines (51 loc) · 1.85 KB
/
bazel-integration-testing.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
diff tools/repositories.bzl tools/repositories.bzl
index 8364dac..42e998d 100644
--- tools/repositories.bzl
+++ tools/repositories.bzl
@@ -15,11 +15,6 @@
load("//tools:bazel_hash_dict.bzl", "BAZEL_HASH_DICT")
load(":common.bzl", "BAZEL_VERSIONS")
-_BAZEL_BINARY_PACKAGES = [
- "http://releases.bazel.build/{version}/release/bazel-{version}{installer}-{platform}.{extension}",
- "https://github.com/bazelbuild/bazel/releases/download/{version}/bazel-{version}{installer}-{platform}.{extension}",
-]
-
def _get_platform_name(rctx):
os_name = rctx.os.name.lower()
@@ -45,7 +40,36 @@ def _get_installer(rctx):
extension = "sh"
installer = "-installer"
- urls = [url.format(version=version, installer=installer, platform=platform, extension=extension) for url in _BAZEL_BINARY_PACKAGES]
+ filename = "bazel-{version}{installer}-{platform}.{extension}".format(
+ version = version,
+ installer = installer,
+ platform = platform,
+ extension = extension,
+ )
+
+ kind = "release"
+ # Mimics determineURL in github.com/bazelbuild/bazelisk/bazelisk.go
+ enabled_packages = [
+ "https://releases.bazel.build/{version}/{kind}/{filename}",
+ ]
+
+ if "rc" in version:
+ version_components = version.split("rc")
+ version = version_components[0]
+ kind = "rc" + version_components[1]
+ else:
+ enabled_packages.append(
+ "https://github.com/{fork}/bazel/releases/download/{version}/{filename}")
+ urls = [
+ url.format(
+ # TODO: support other forks like bazelisk does
+ fork = "bazelbuild",
+ version=version,
+ kind = kind,
+ filename = filename,
+ )
+ for url in enabled_packages
+ ]
args = {"url": urls, "type": "zip"}
if version in BAZEL_HASH_DICT and platform in BAZEL_HASH_DICT[version]:
args["sha256"] = BAZEL_HASH_DICT[version][platform]