Skip to content

Commit 45b5967

Browse files
committed
bazel-9: updated
1 parent 677053d commit 45b5967

1 file changed

Lines changed: 167 additions & 0 deletions

File tree

bazel-9.yaml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
package:
2+
name: bazel-9
3+
version: "9.0.0"
4+
epoch: 0
5+
description: Bazel is an open-source build and test tool
6+
resources:
7+
cpu: 16
8+
memory: 16Gi
9+
dependencies:
10+
provides:
11+
- bazel=${{package.full-version}}
12+
copyright:
13+
- license: Apache-2.0
14+
15+
environment:
16+
contents:
17+
packages:
18+
- bash
19+
- build-base
20+
- busybox
21+
- ca-certificates-bundle
22+
- libstdc++-6
23+
- libstdc++-6-dev
24+
- openjdk-21
25+
- openssf-compiler-options
26+
- python3
27+
- zip
28+
29+
pipeline:
30+
- uses: fetch
31+
with:
32+
expected-sha256: dfa496089624d726a158afcac353725166f81c5708ee1ecc9e662f2891b3544d
33+
uri: https://github.com/bazelbuild/bazel/releases/download/${{package.version}}/bazel-${{package.version}}-dist.zip
34+
extract: false
35+
delete: false
36+
37+
- runs: unzip bazel-${{package.version}}-dist.zip
38+
39+
- runs: |
40+
mkdir -p $HOME/.cache/bazel/_bazel_root
41+
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk
42+
43+
EMBED_LABEL=${{package.version}}-${{package.epoch}} \
44+
EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk \
45+
--cxxopt=-fdelete-null-pointer-checks \
46+
--host_cxxopt=-fdelete-null-pointer-checks" \
47+
bash ./compile.sh
48+
49+
./output/bazel clean --expunge --repo_contents_cache=
50+
mkdir -p ${{targets.destdir}}/usr/bin
51+
cp ./output/bazel ${{targets.destdir}}/usr/bin/
52+
53+
update:
54+
enabled: true
55+
github:
56+
identifier: bazelbuild/bazel
57+
strip-prefix: v
58+
tag-filter: "9."
59+
60+
test:
61+
environment:
62+
contents:
63+
packages:
64+
- bash
65+
- git
66+
- python3
67+
- openjdk-21
68+
- openjdk-21-default-jvm
69+
- gcc
70+
environment:
71+
JAVA_HOME: /usr/lib/jvm/java-21-openjdk
72+
pipeline:
73+
- name: "Verify bazel version"
74+
runs: |
75+
bazel --version
76+
- name: "Test workspace creation and basic build: default behaviour"
77+
runs: |
78+
mkdir -p test-workspace
79+
cd test-workspace
80+
cat > WORKSPACE <<'EOF'
81+
workspace(name = "test_workspace")
82+
EOF
83+
84+
cat > MODULE.bazel <<'EOF'
85+
bazel_dep(name = "rules_python", version = "1.1.0")
86+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
87+
python.toolchain(
88+
configure_coverage_tool = False,
89+
ignore_root_user_error = True,
90+
python_version = "3.11",
91+
)
92+
EOF
93+
94+
cat > BUILD <<'EOF'
95+
genrule(
96+
name = "hello",
97+
outs = ["hello.txt"],
98+
cmd = "echo 'Hello, Wolfi!' > $@",
99+
)
100+
EOF
101+
102+
bazel build //:hello
103+
test -f bazel-bin/hello.txt
104+
- name: "Test workspace creation and basic build: --enable_workspace"
105+
runs: |
106+
mkdir -p test-workspace
107+
cd test-workspace
108+
cat > WORKSPACE <<'EOF'
109+
workspace(name = "test_workspace")
110+
EOF
111+
112+
cat > BUILD <<'EOF'
113+
genrule(
114+
name = "hello",
115+
outs = ["hello.txt"],
116+
cmd = "echo 'Hello, Wolfi!' > $@",
117+
)
118+
EOF
119+
120+
bazel build --noenable_bzlmod --enable_workspace //:hello
121+
test -f bazel-bin/hello.txt
122+
- name: "Test Java project build"
123+
runs: |
124+
mkdir -p java-test/src/main/java/hello
125+
cd java-test
126+
127+
cat > WORKSPACE <<'EOF'
128+
workspace(name = "java_test")
129+
EOF
130+
131+
cat > MODULE.bazel <<'EOF'
132+
bazel_dep(name = "rules_python", version = "1.1.0")
133+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
134+
python.toolchain(
135+
configure_coverage_tool = False,
136+
ignore_root_user_error = True,
137+
python_version = "3.11",
138+
)
139+
EOF
140+
141+
cat > BUILD <<'EOF'
142+
java_binary(
143+
name = "hello",
144+
srcs = ["src/main/java/hello/Hello.java"],
145+
main_class = "hello.Hello",
146+
)
147+
EOF
148+
149+
cat > src/main/java/hello/Hello.java <<'EOF'
150+
package hello;
151+
public class Hello {
152+
public static void main(String[] args) {
153+
System.out.println("Hello from Java!");
154+
}
155+
}
156+
EOF
157+
158+
bazel build //:hello
159+
- name: "Test query capabilities"
160+
runs: |
161+
cd java-test
162+
bazel query //...
163+
bazel query 'deps(//:hello)'
164+
- name: "Test clean command"
165+
runs: |
166+
cd java-test
167+
bazel clean --expunge

0 commit comments

Comments
 (0)