Repository navigation
Expand file tree
/
Copy pathci_cache_keys.sh
More file actions
75 lines (71 loc) · 3.5 KB
/
Copy pathci_cache_keys.sh
File metadata and controls
75 lines (71 loc) · 3.5 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
# CI fingerprints describe the checked-out commit, never generated/restored files.
# Run once immediately after checkout; reuse these outputs for restore AND save.
# This is intentionally not a local incremental-build key (which must read edits).
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
compiler_paths=(jac/jaclang/compiler_inputs.txt)
while IFS= read -r entry || [ -n "$entry" ]; do
case "$entry" in ''|'#'*|'!'*) continue ;; esac
compiler_paths+=("jac/jaclang/$entry")
done < jac/jaclang/compiler_inputs.txt
tree() { git ls-tree -r HEAD -- "$@"; }
compiler_tree() {
tree "${compiler_paths[@]}" |
awk -F '\t' '$2 ~ /\.(jac|py)$/ || $2 == "jac/jaclang/compiler_inputs.txt"' |
awk -F '\t' '$2 !~ /\/(tests|test|__pycache__)\// && $2 !~ /\/\.[^\/]+\// && $2 !~ /\.test\./'
}
# The compiler-input RULE lives twice on purpose: here in awk, and in
# jir.compiler_source_files. They cannot be merged -- this script runs at
# checkout time, before any jac binary exists (the same acyclicity constraint as
# the Zig seeds, #8785) -- so they are held to the same answer by
# jac/tests/compiler/test_compiler_identity_rule.jac instead. This mode is what
# that test reads; it prints package-relative paths, one per line.
if [ "${1:-}" = "--list-compiler-inputs" ]; then
compiler_tree | awk -F '\t' '{print $2}' | sed 's|^jac/jaclang/||' | LC_ALL=C sort -u
exit 0
fi
fingerprint() {
# Sort/deduplicate overlapping roots; paths and modes accompany blob hashes.
LC_ALL=C sort -u | git hash-object --stdin
}
emit() {
local digest
digest=$(fingerprint)
printf '%s=%s\n' "$1" "$digest"
}
compiler_tree | emit compiler
# The prebuilt CPython tree: its pin and the seed that fetches it.
tree jac/bootstrap/fetch_pbs.zig jac/bootstrap/seed.zig jac/bootstrap/pins.json |
emit python
tree jac/jaclang | emit payload
tree jac/jaclang jac/build.zig jac/build.zig.zon jac/launcher jac/bootstrap \
jac/native jac/_jac_finder.py jac/sitecustomize.py jac/examples/jaclang_org \
jac/examples/tiny_jacyac \
jac.toml jac/jac.toml | emit binary
# A -Ddev binary bundles no jaclang: only the launcher (compiled by the native
# backend, linking the fused runtime and native floors), the payload tool's
# Python payload, and the pins. A jaclang edit elsewhere reuses it.
# Of jac.toml the build reads only `version` (stamped into the dist-info), so
# check, lint and test settings there leave the binary alone.
{
tree jac/launcher jac/jaclang/dist/fused jac/jaclang/dist/payload \
jac/jaclang/compiler/backends/native jac/jaclang/runtime/na_stdlib \
jac/build.zig jac/build.zig.zon jac/bootstrap jac/native jac/_jac_finder.py \
jac/sitecustomize.py
git show HEAD:jac.toml | grep -m1 -E '^[[:space:]]*version[[:space:]]*='
} | emit devbinary
tree jac/launcher jac/bootstrap jac/build.zig jac/build.zig.zon jac/native \
jac/jaclang/client/js_runtime.jac jac/jaclang/compiler/backends/native/wasm_rt |
emit layers
# The dev kit's vendored runtimes (bun, static musl, wasm libc): the payload
# tool that fetches or builds them, its pins (BUN_VERSION lives in
# js_runtime.jac, WASM_FLOOR_MANIFEST in floors.jac), and the sources it
# compiles into the musl and wasm archives.
tree jac/bootstrap jac/build.zig jac/build.zig.zon jac/native \
jac/jaclang/dist/payload jac/jaclang/client/js_runtime.jac \
jac/jaclang/compiler/backends/native/floors.jac \
jac/jaclang/compiler/backends/native/wasm_rt \
jac/jaclang/compiler/backends/native/musl_compat \
jac/jaclang/compiler/backends/native/compiler_rt |
emit devassets