Skip to content

Commit a357531

Browse files
committed
feat: ship the V8 internal headers as a release artifact [skip ci]
Both runtimes' inspector glue compiles against src/inspector, src/base, src/common and the crdtp headers. None of that is public API, and all of it has to match the libraries or it is an ABI mismatch -- the iOS tree was carrying 10.3 crdtp headers against a 14.9 libcrdtp until this week. Without them in the release a consumer still needs a full V8 checkout to re-vendor, which defeats shipping artifacts at all. Ships the subtrees rather than a precomputed closure, since the set each runtime needs differs. Includes the generated src/inspector/protocol/*.h, which only exist in a build directory but sit directly in Forward.h's include path -- verified by running the android runtime's vendoring script against the package alone, which reproduces its current 66-file tree exactly.
1 parent 41a9e54 commit a357531

3 files changed

Lines changed: 102 additions & 0 deletions

File tree

.github/workflows/build-matrix.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ jobs:
9595
path: v8-*-android-${{ matrix.abi }}.tar.gz
9696
retention-days: 7
9797

98+
# The internal headers are architecture-independent, so one job produces
99+
# them. It piggybacks on a build rather than getting its own job because
100+
# src/inspector/protocol/*.h are generated into gen/ and only exist once
101+
# something has been built.
102+
- name: Package the internal headers
103+
if: matrix.abi == 'arm64-v8a'
104+
run: |
105+
scripts/matrix/package-src-headers.sh \
106+
--gen-dir .v8/v8/out.gn/android-arm64-release/gen
107+
tar -czf "v8-${{ needs.config.outputs.v8_version }}-src-headers.tar.gz" \
108+
-C dist src-headers
109+
110+
- uses: actions/upload-artifact@v4
111+
if: matrix.abi == 'arm64-v8a'
112+
with:
113+
name: v8-src-headers
114+
path: v8-*-src-headers.tar.gz
115+
retention-days: 7
116+
98117
ios:
99118
needs: config
100119
if: ${{ github.event_name != 'workflow_dispatch' || inputs.platforms == 'all' || inputs.platforms == 'ios' }}

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ the NativeScript framework itself is built per platform.
6666
Consumers map `ios-arm64-device` onto `arm64-xros` and `ios-arm64-simulator`
6767
onto `arm64-xrsimulator`.
6868

69+
### The internal headers ship too
70+
71+
Both runtimes' inspector glue compiles against `src/inspector`, `src/base`,
72+
`src/common` and the crdtp headers — none of which are public API, and all of
73+
which have to match the libraries or they are an ABI mismatch. A release
74+
therefore also carries `v8-<version>-src-headers.tar.gz`, so a consumer never
75+
needs a V8 checkout to re-vendor them.
76+
77+
It ships the subtrees rather than a precomputed closure, because the set each
78+
runtime needs differs. It includes the generated `src/inspector/protocol/*.h`,
79+
which live in the build directory rather than the source tree but sit directly
80+
in the include path of `Forward.h`.
81+
6982
## Releasing
7083

7184
The matrix runs on every push to `main` and on pull requests touching the build
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
set -e
3+
#
4+
# Packages the V8 *internal* headers into dist/src-headers/.
5+
#
6+
# Both runtimes' inspector glue compiles against src/inspector, src/base,
7+
# src/common and the crdtp headers, none of which are public API. Keeping that
8+
# copy on a different V8 than the libraries is an ABI mismatch, so it has to
9+
# travel with a release -- otherwise a consumer still needs a full V8 checkout
10+
# to produce it, which defeats the point of shipping artifacts at all.
11+
#
12+
# The exact set each runtime needs differs (they include different roots), so
13+
# this ships the subtrees and lets each consumer compute its own closure rather
14+
# than baking one in here.
15+
#
16+
# Usage: package-src-headers.sh [--v8-dir <path>]
17+
#
18+
19+
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
20+
source "$ROOT_DIR/config.env"
21+
22+
V8_DIR="$ROOT_DIR/.v8/v8"
23+
GEN_DIR=""
24+
25+
while [ $# -gt 0 ]; do
26+
case "$1" in
27+
--v8-dir) V8_DIR="$2"; shift 2 ;;
28+
--v8-dir=*) V8_DIR="${1#*=}"; shift ;;
29+
--gen-dir) GEN_DIR="$2"; shift 2 ;;
30+
--gen-dir=*) GEN_DIR="${1#*=}"; shift ;;
31+
-h|--help) echo "Usage: $(basename "$0") [--v8-dir <path>] --gen-dir <path>"; exit 0 ;;
32+
*) echo "Unknown argument: $1" >&2; exit 1 ;;
33+
esac
34+
done
35+
36+
[ -d "$V8_DIR/src" ] || { echo "No V8 sources at $V8_DIR" >&2; exit 1; }
37+
38+
DIST="$ROOT_DIR/dist/src-headers"
39+
rm -rf "$DIST"
40+
mkdir -p "$DIST"
41+
42+
copy_headers() {
43+
local subdir="$1"
44+
[ -d "$V8_DIR/$subdir" ] || return 0
45+
# -inc as well as -h: absl's int128 pulls in int128_*_intrinsic.inc, and
46+
# several V8 headers include .inc the same way.
47+
(cd "$V8_DIR" && find "$subdir" \( -name '*.h' -o -name '*.inc' \) -print0) \
48+
| (cd "$V8_DIR" && tar --null -cf - -T -) \
49+
| (cd "$DIST" && tar -xf -)
50+
}
51+
52+
copy_headers src
53+
copy_headers third_party/inspector_protocol/crdtp
54+
copy_headers third_party/abseil-cpp/absl
55+
56+
# src/inspector/protocol/*.h are generated into the build directory rather than
57+
# living in the source tree, but the closure runs straight through them
58+
# (Forward.h -> Protocol.h -> the per-domain headers), so a consumer cannot
59+
# resolve its includes without them.
60+
if [ -z "$GEN_DIR" ] || [ ! -d "$GEN_DIR/src/inspector/protocol" ]; then
61+
echo "--gen-dir must point at a build's gen/ containing src/inspector/protocol" >&2
62+
exit 1
63+
fi
64+
mkdir -p "$DIST/src/inspector/protocol"
65+
cp "$GEN_DIR/src/inspector/protocol/"*.h "$DIST/src/inspector/protocol/"
66+
67+
echo "$V8_VERSION" > "$DIST/V8_VERSION"
68+
69+
echo "packaged $(find "$DIST" -name '*.h' -o -name '*.inc' | wc -l | tr -d ' ') headers"
70+
du -sh "$DIST"

0 commit comments

Comments
 (0)