Skip to content

Commit 0d194cb

Browse files
Stability ape, {toolchain,download}_utils and rules_{gzip,bzip2,xz,zstd,tar} (#3791)
1 parent b114cc0 commit 0d194cb

36 files changed

Lines changed: 719 additions & 37 deletions

modules/ape/1.0.1/MODULE.bazel

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
module(
2+
name = "ape",
3+
version = "1.0.1",
4+
bazel_compatibility = [
5+
">=7.4.0",
6+
],
7+
compatibility_level = 1,
8+
)
9+
10+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
11+
bazel_dep(name = "platforms", version = "0.0.10")
12+
bazel_dep(name = "toolchain_utils", version = "1.0.2")
13+
bazel_dep(name = "download_utils", version = "1.0.1")
14+
bazel_dep(name = "rules_license", version = "1.0.0")
15+
bazel_dep(name = "rules_python", version = "1.0.0")
16+
17+
bazel_dep(name = "hermetic_cc_toolchain", version = "3.1.0", dev_dependency = True)
18+
19+
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
20+
python.toolchain(
21+
configure_coverage_tool = True,
22+
# TODO: need hermetic `chmod`/`id`: https://github.com/bazelbuild/rules_python/pull/2024
23+
ignore_root_user_error = True,
24+
python_version = "3.13",
25+
)
26+
27+
download_archive = use_repo_rule("@download_utils//download/archive:defs.bzl", "download_archive")
28+
29+
download_archive(
30+
name = "zig-0.11.0-arm64-darwin",
31+
srcs = [
32+
"entrypoint",
33+
"zig",
34+
],
35+
integrity = "sha256-xuv5J7sTpwfXQmdHSp9VMnTmSQb9Ib8cdaIL3oyt97I=",
36+
links = {
37+
"zig-macos-aarch64-0.11.0/zig": "zig",
38+
"zig": "entrypoint",
39+
},
40+
urls = [
41+
"https://gitlab.arm.com/api/v4/projects/bazel%2Fape/packages/generic/zig/0.11.0/zig-macos-aarch64-0.11.0.tar.xz",
42+
"https://ziglang.org/download/0.11.0/zig-macos-aarch64-0.11.0.tar.xz",
43+
],
44+
)
45+
46+
select = use_repo_rule("@toolchain_utils//toolchain/local/select:defs.bzl", "toolchain_local_select")
47+
48+
select(
49+
name = "zig",
50+
map = {
51+
"@zig-0.11.0-arm64-darwin": "arm64-darwin",
52+
},
53+
)
54+
55+
download_file = use_repo_rule("@download_utils//download/file:defs.bzl", "download_file")
56+
57+
download_file(
58+
name = "ape-m1.c",
59+
executable = False,
60+
integrity = "sha256-eK954gq7s/malzVZWbWb1YlJVkBkrbdU8DAuurtL96M=",
61+
output = "ape-m1.c",
62+
patches = [
63+
"//:ape-m1.patch",
64+
],
65+
urls = [
66+
"https://gitlab.arm.com/api/v4/projects/bazel%2Fape/packages/generic/cosmos.zip/4.0.2/ape-m1.c",
67+
"https://raw.githubusercontent.com/jart/cosmopolitan/4.0.2/ape/ape-m1.c",
68+
],
69+
)
70+
71+
compile = use_repo_rule("//ape/compile:repository.bzl", "compile")
72+
73+
compile(
74+
name = "ape-arm64.macho",
75+
srcs = ["@ape-m1.c"],
76+
links = {
77+
"entrypoint": "binary",
78+
},
79+
output = "binary",
80+
target = "{cpu}-macos-none",
81+
zig = "@zig//:entrypoint",
82+
)
83+
84+
pe = use_repo_rule("//ape/pe:repository.bzl", "pe")
85+
86+
pe(
87+
name = "ape.pe",
88+
links = {
89+
"entrypoint": "binary",
90+
},
91+
output = "binary",
92+
)
93+
94+
select(
95+
name = "launcher",
96+
map = {
97+
"@ape-arm64.elf": "arm64-linux",
98+
"@ape-x86_64.elf": "amd64-linux",
99+
"@ape-x86_64.macho": "amd64-darwin",
100+
"@ape-arm64.macho": "arm64-darwin",
101+
"@ape.pe": "windows",
102+
},
103+
)
104+
105+
resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolchain_resolved")
106+
107+
resolved(
108+
name = "resolved-ape",
109+
toolchain_type = "//ape/toolchain/ape:type",
110+
)
111+
112+
register_toolchains("//ape/toolchain/...")
113+
114+
cosmos = use_extension("//ape/cosmos:defs.bzl", "ape_cosmos")
115+
cosmos.upload(
116+
template = "https://gitlab.arm.com/api/v4/projects/bazel%2Fape/packages/generic/cosmos.zip/{version}/{name}",
117+
)
118+
119+
# TODO: enable this when we have unauthenticated access to `gitlab.arm.com` generic package registry (see #6)
120+
# cosmos.url(
121+
# template = "https://gitlab.arm.com/api/v4/projects/bazel%2Fape/packages/generic/cosmos.zip/{version}/{name}",
122+
# )
123+
cosmos.url(
124+
template = "https://cosmo.zip/pub/cosmos/v/{version}/bin/{name}",
125+
)
126+
cosmos.download(
127+
lock = "//ape/cosmos:4.0.2.json",
128+
version = "4.0.2",
129+
)
130+
cosmos.download(
131+
lock = "//ape/cosmos:3.9.2.json",
132+
version = "3.9.2",
133+
)
134+
cosmos.download(
135+
lock = "//ape/cosmos:3.7.1.json",
136+
version = "3.7.1",
137+
)
138+
cosmos.download(
139+
lock = "//ape/cosmos:3.3.1.json",
140+
version = "3.3.1",
141+
)
142+
cosmos.download(
143+
lock = "//ape/cosmos:3.2.4.json",
144+
version = "3.2.4",
145+
)
146+
147+
# https://github.com/ahgamut/superconfigure/issues/38
148+
cosmos.override(
149+
basename = "pigz",
150+
version = "3.2.4",
151+
)
152+
cosmos.use(
153+
aliases = True,
154+
bootstrap = True,
155+
metadata = True,
156+
upload = True,
157+
)
158+
use_repo(cosmos, "aliases", "ape-aarch64.elf", "ape-arm64.elf", "ape-x86_64.elf", "ape-x86_64.macho", "assimilate", "assimilate-aarch64.elf", "assimilate-x86_64.elf", "assimilate-x86_64.macho", "metadata", "upload")

modules/ape/1.0.1/presubmit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
bcr_test_module:
2+
module_path: e2e
3+
matrix:
4+
bazel:
5+
- 7.x
6+
- 8.x
7+
platform:
8+
- centos7_java11_devtoolset10
9+
- debian10
10+
- debian11
11+
- ubuntu2004
12+
- ubuntu2204
13+
- fedora39
14+
- macos
15+
- macos_arm64
16+
- windows
17+
tasks:
18+
e2e_tests:
19+
name: Run end-to-end Tests
20+
bazel: ${{ bazel }}
21+
platform: ${{ platform }}
22+
test_targets:
23+
- "//..."

modules/ape/1.0.1/source.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"url": "https://gitlab.arm.com/bazel/ape/-/releases/v1.0.1/downloads/src.tar.gz",
3+
"integrity": "sha512-YHlfxYHiCxzrifn5ywADS59XhmTk5u0rW/1fPepfk1C6/bXn3uwSADixLkvee6rAP9u2sulmHX0igt5F5+eqTA==",
4+
"strip_prefix": "ape-v1.0.1"
5+
}

modules/ape/metadata.json

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
{
2-
"homepage": "https://gitlab.arm.com/bazel/ape",
3-
"maintainers": [
4-
{
5-
"email": "matthew.clarkson@arm.com",
6-
"github": "mattyclarkson",
7-
"name": "Matt Clarkson"
8-
}
9-
],
10-
"repository": [
11-
"https://gitlab.arm.com/bazel/ape"
12-
],
13-
"versions": [
14-
"1.0.0-alpha.1",
15-
"1.0.0-alpha.2",
16-
"1.0.0-alpha.3",
17-
"1.0.0-alpha.5",
18-
"1.0.0-beta.2",
19-
"1.0.0-beta.3",
20-
"1.0.0-beta.4",
21-
"1.0.0-beta.6",
22-
"1.0.0-beta.7",
23-
"1.0.0-beta.11",
24-
"1.0.0-beta.12",
25-
"1.0.0-beta.13",
26-
"1.0.0-beta.14",
27-
"1.0.0-beta.15",
28-
"1.0.0-beta.16",
29-
"1.0.0-beta.17"
30-
]
2+
"homepage": "https://gitlab.arm.com/bazel/ape",
3+
"maintainers": [
4+
{
5+
"email": "matthew.clarkson@arm.com",
6+
"name": "Matt Clarkson",
7+
"github": "mattyclarkson"
8+
}
9+
],
10+
"repository": [
11+
"https://gitlab.arm.com/bazel/ape"
12+
],
13+
"versions": [
14+
"1.0.0-alpha.1",
15+
"1.0.0-alpha.2",
16+
"1.0.0-alpha.3",
17+
"1.0.0-alpha.5",
18+
"1.0.0-beta.2",
19+
"1.0.0-beta.3",
20+
"1.0.0-beta.4",
21+
"1.0.0-beta.6",
22+
"1.0.0-beta.7",
23+
"1.0.0-beta.11",
24+
"1.0.0-beta.12",
25+
"1.0.0-beta.13",
26+
"1.0.0-beta.14",
27+
"1.0.0-beta.15",
28+
"1.0.0-beta.16",
29+
"1.0.0-beta.17",
30+
"1.0.1"
31+
]
3132
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module(
2+
name = "download_utils",
3+
version = "1.0.1",
4+
bazel_compatibility = [
5+
">=7.1.0",
6+
],
7+
compatibility_level = 1,
8+
)
9+
10+
bazel_dep(name = "rules_license", version = "1.0.0")
11+
12+
bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)
13+
bazel_dep(name = "toolchain_utils", version = "1.0.2", dev_dependency = True)
14+
15+
separator = use_repo_rule("//lib:separator.bzl", "separator")
16+
17+
separator(name = "separator")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
bcr_test_module:
2+
module_path: e2e
3+
matrix:
4+
bazel:
5+
- 7.x
6+
- 8.x
7+
platform:
8+
- centos7_java11_devtoolset10
9+
- debian10
10+
- debian11
11+
- ubuntu2004
12+
- ubuntu2204
13+
- fedora39
14+
- macos
15+
- macos_arm64
16+
- windows
17+
tasks:
18+
e2e_tests:
19+
name: Run end-to-end Tests
20+
bazel: ${{ bazel }}
21+
platform: ${{ platform }}
22+
test_targets:
23+
- "//..."
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"url": "https://gitlab.arm.com/bazel/download_utils/-/releases/v1.0.1/downloads/src.tar.gz",
3+
"integrity": "sha512-nsUJrJJjUWKzTQA187uWHhnBSqPA7t8Q6Rqry83Sj63Kf09L6xEFCR7thlnRUtbRbzabIKGr7JreouFdjjdarw==",
4+
"strip_prefix": "download_utils-v1.0.1"
5+
}

modules/download_utils/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"1.0.0-beta.1",
88
"1.0.0-beta.2",
99
"1.0.0-beta.4",
10-
"1.0.0-beta.5"
10+
"1.0.0-beta.5",
11+
"1.0.1"
1112
],
1213
"maintainers": [
1314
{
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module(
2+
name = "rules_bzip2",
3+
version = "1.0.0",
4+
bazel_compatibility = [
5+
">=7.1.0",
6+
],
7+
compatibility_level = 1,
8+
)
9+
10+
bazel_dep(name = "rules_license", version = "1.0.0")
11+
bazel_dep(name = "rules_coreutils", version = "1.0.1")
12+
bazel_dep(name = "toolchain_utils", version = "1.0.2")
13+
bazel_dep(name = "ape", version = "1.0.1")
14+
bazel_dep(name = "bzip2", version = "1.0.8.bcr.1", repo_name = "bcr")
15+
16+
bazel_dep(name = "hermetic_cc_toolchain", version = "3.1.0", dev_dependency = True)
17+
18+
cosmos = use_extension("@ape//ape/cosmos:defs.bzl", "ape_cosmos")
19+
use_repo(cosmos, cosmos = "bzip2")
20+
21+
export = use_extension("@toolchain_utils//toolchain/export:defs.bzl", "toolchain_export")
22+
export.symlink(
23+
name = "bzip2",
24+
target = "@cosmos",
25+
)
26+
use_repo(export, "bzip2")
27+
28+
resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolchain_resolved")
29+
30+
resolved(
31+
name = "resolved-bzip2",
32+
toolchain_type = "//bzip2/toolchain/bzip2:type",
33+
)
34+
35+
register_toolchains("//bzip2/toolchain/...")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
bcr_test_module:
2+
module_path: e2e
3+
matrix:
4+
bazel:
5+
- 7.x
6+
- 8.x
7+
platform:
8+
- centos7_java11_devtoolset10
9+
- debian10
10+
- debian11
11+
- ubuntu2004
12+
- ubuntu2204
13+
- fedora39
14+
- macos
15+
- macos_arm64
16+
- windows
17+
tasks:
18+
e2e_tests:
19+
name: Run end-to-end Tests
20+
bazel: ${{ bazel }}
21+
platform: ${{ platform }}
22+
test_targets:
23+
- "//..."

0 commit comments

Comments
 (0)