Skip to content

Commit 23ff8d9

Browse files
- Bazel 9 support - Enable `gitlab.arm.com` mirrors as first URL to reduce load on upstream bandwidth - Optimise the Apple Silicon launcher - Upgrade to stable dependency versions
1 parent c191ed4 commit 23ff8d9

File tree

4 files changed

+233
-31
lines changed

4 files changed

+233
-31
lines changed

modules/ape/1.1.0/MODULE.bazel

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
module(
2+
name = "ape",
3+
version = "1.1.0",
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 = "1.0.0")
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 = "pre-commit", version = "1.0.9", dev_dependency = True)
18+
bazel_dep(name = "pre-commit-hooks", version = "1.3.1", dev_dependency = True)
19+
bazel_dep(name = "hermetic_cc_toolchain", version = "4.0.1", dev_dependency = True)
20+
single_version_override(
21+
module_name = "hermetic_cc_toolchain",
22+
patch_strip = 1,
23+
patches = ["hermetic_cc_toolchain.patch"],
24+
)
25+
26+
zig = use_extension("@hermetic_cc_toolchain//toolchain:ext.bzl", "toolchains", dev_dependency = True)
27+
use_repo(zig, "zig_sdk")
28+
29+
register_toolchains(
30+
"@zig_sdk//toolchain/...",
31+
dev_dependency = True,
32+
)
33+
34+
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
35+
36+
[
37+
python.toolchain(
38+
configure_coverage_tool = True,
39+
# TODO: need hermetic `chmod`/`id`: https://github.com/bazelbuild/rules_python/pull/2024
40+
ignore_root_user_error = True,
41+
python_version = version,
42+
)
43+
for version in ("3.10", "3.11", "3.12", "3.13")
44+
]
45+
46+
download_archive = use_repo_rule("@download_utils//download/archive:defs.bzl", "download_archive")
47+
48+
download_archive(
49+
name = "zig-0.11.0-arm64-darwin",
50+
srcs = [
51+
"entrypoint",
52+
"zig",
53+
],
54+
integrity = "sha256-xuv5J7sTpwfXQmdHSp9VMnTmSQb9Ib8cdaIL3oyt97I=",
55+
links = {
56+
"zig-macos-aarch64-0.11.0/zig": "zig",
57+
"zig": "entrypoint",
58+
},
59+
urls = [
60+
"https://gitlab.arm.com/api/v4/projects/10212/packages/generic/zig/0.11.0/zig-macos-aarch64-0.11.0.tar.xz",
61+
"https://ziglang.org/download/0.11.0/zig-macos-aarch64-0.11.0.tar.xz",
62+
],
63+
)
64+
65+
select = use_repo_rule("@toolchain_utils//toolchain/local/select:defs.bzl", "toolchain_local_select")
66+
67+
select(
68+
name = "zig",
69+
map = {
70+
"@zig-0.11.0-arm64-darwin": "arm64-darwin",
71+
},
72+
)
73+
74+
download_file = use_repo_rule("@download_utils//download/file:defs.bzl", "download_file")
75+
76+
download_file(
77+
name = "ape-m1.c",
78+
executable = False,
79+
integrity = "sha256-eK954gq7s/malzVZWbWb1YlJVkBkrbdU8DAuurtL96M=",
80+
output = "ape-m1.c",
81+
patches = [
82+
"//:ape-m1.patch",
83+
],
84+
urls = [
85+
"https://gitlab.arm.com/api/v4/projects/10212/packages/generic/cosmos.zip/4.0.2/ape-m1.c",
86+
"https://raw.githubusercontent.com/jart/cosmopolitan/4.0.2/ape/ape-m1.c",
87+
],
88+
)
89+
90+
compile = use_repo_rule("//ape/compile:repository.bzl", "compile")
91+
92+
compile(
93+
name = "ape-arm64.macho",
94+
srcs = ["@ape-m1.c"],
95+
args = ["-O"],
96+
links = {
97+
"entrypoint": "binary",
98+
},
99+
output = "binary",
100+
target = "{cpu}-macos-none",
101+
zig = "@zig//:entrypoint",
102+
)
103+
104+
pe = use_repo_rule("//ape/pe:repository.bzl", "pe")
105+
106+
pe(
107+
name = "ape.pe",
108+
links = {
109+
"entrypoint": "binary",
110+
},
111+
output = "binary",
112+
)
113+
114+
select(
115+
name = "launcher",
116+
map = {
117+
"@ape-arm64.elf": "arm64-linux",
118+
"@ape-x86_64.elf": "amd64-linux",
119+
"@ape-x86_64.macho": "amd64-darwin",
120+
"@ape-arm64.macho": "arm64-darwin",
121+
"@ape.pe": "windows",
122+
},
123+
)
124+
125+
resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolchain_resolved")
126+
127+
resolved(
128+
name = "resolved-ape",
129+
toolchain_type = "//ape/toolchain/ape:type",
130+
)
131+
132+
register_toolchains("//ape/toolchain/...")
133+
134+
cosmos = use_extension("//ape/cosmos:defs.bzl", "ape_cosmos")
135+
cosmos.upload(
136+
template = "https://gitlab.arm.com/api/v4/projects/10212/packages/generic/cosmos.zip/{version}/{name}",
137+
)
138+
cosmos.url(
139+
template = "https://gitlab.arm.com/api/v4/projects/10212/packages/generic/cosmos.zip/{version}/{name}",
140+
)
141+
cosmos.url(
142+
template = "https://cosmo.zip/pub/cosmos/v/{version}/bin/{name}",
143+
)
144+
cosmos.download(
145+
lock = "//ape/cosmos:4.0.2.json",
146+
version = "4.0.2",
147+
)
148+
cosmos.download(
149+
lock = "//ape/cosmos:3.9.2.json",
150+
version = "3.9.2",
151+
)
152+
cosmos.download(
153+
lock = "//ape/cosmos:3.7.1.json",
154+
version = "3.7.1",
155+
)
156+
cosmos.download(
157+
lock = "//ape/cosmos:3.3.1.json",
158+
version = "3.3.1",
159+
)
160+
cosmos.download(
161+
lock = "//ape/cosmos:3.2.4.json",
162+
version = "3.2.4",
163+
)
164+
165+
# https://github.com/ahgamut/superconfigure/issues/38
166+
cosmos.override(
167+
basename = "pigz",
168+
version = "3.2.4",
169+
)
170+
cosmos.use(
171+
aliases = True,
172+
bootstrap = True,
173+
metadata = True,
174+
upload = True,
175+
)
176+
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.1.0/presubmit.yml

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

modules/ape/1.1.0/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.1.0/downloads/src.tar.gz",
3+
"integrity": "sha512-inCnlhP+NgllGyiOcVDMTHaX0i2y1Uxq5TXuePvyG4BOBelXc9Bk/VAZE+IakmTzgjZDE1w+pd/8TwSq7dCbXQ==",
4+
"strip_prefix": "ape-v1.1.0"
5+
}

modules/ape/metadata.json

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
{
2-
"homepage": "https://gitlab.arm.com/bazel/ape",
3-
"maintainers": [
4-
{
5-
"email": "[email protected]",
6-
"name": "Matt Clarkson",
7-
"github": "mattyclarkson",
8-
"github_user_id": 1081113
9-
}
10-
],
11-
"repository": [
12-
"https://gitlab.arm.com/bazel/ape"
13-
],
14-
"versions": [
15-
"1.0.0-alpha.1",
16-
"1.0.0-alpha.2",
17-
"1.0.0-alpha.3",
18-
"1.0.0-alpha.5",
19-
"1.0.0-beta.2",
20-
"1.0.0-beta.3",
21-
"1.0.0-beta.4",
22-
"1.0.0-beta.6",
23-
"1.0.0-beta.7",
24-
"1.0.0-beta.11",
25-
"1.0.0-beta.12",
26-
"1.0.0-beta.13",
27-
"1.0.0-beta.14",
28-
"1.0.0-beta.15",
29-
"1.0.0-beta.16",
30-
"1.0.0-beta.17",
31-
"1.0.1"
32-
]
2+
"homepage": "https://gitlab.arm.com/bazel/ape",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"name": "Matt Clarkson",
7+
"github": "mattyclarkson",
8+
"github_user_id": 1081113
9+
}
10+
],
11+
"repository": [
12+
"https://gitlab.arm.com/bazel/ape"
13+
],
14+
"versions": [
15+
"1.0.0-alpha.1",
16+
"1.0.0-alpha.2",
17+
"1.0.0-alpha.3",
18+
"1.0.0-alpha.5",
19+
"1.0.0-beta.2",
20+
"1.0.0-beta.3",
21+
"1.0.0-beta.4",
22+
"1.0.0-beta.6",
23+
"1.0.0-beta.7",
24+
"1.0.0-beta.11",
25+
"1.0.0-beta.12",
26+
"1.0.0-beta.13",
27+
"1.0.0-beta.14",
28+
"1.0.0-beta.15",
29+
"1.0.0-beta.16",
30+
"1.0.0-beta.17",
31+
"1.0.1",
32+
"1.1.0"
33+
]
3334
}

0 commit comments

Comments
 (0)