diff --git a/.gitignore b/.gitignore index e602df9c3..c6abd9cd5 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ package-lock.json /.v8-prebuilt/ test-app/runtime/src/main/libs/*/libv8_monolith.a test-app/runtime/src/main/libs/.v8-release-stamp +test-app/runtime/src/main/libs/*/.v8-release-stamp test-app/runtime/src/main/cpp/include/** !test-app/runtime/src/main/cpp/include/zip.h !test-app/runtime/src/main/cpp/include/zipconf.h diff --git a/V8_RELEASE b/V8_RELEASE index ac872018f..7d44f0d8a 100644 --- a/V8_RELEASE +++ b/V8_RELEASE @@ -1 +1 @@ -v8-14.9.207.39-7 +v8-14.9.207.39-12 diff --git a/download_v8.sh b/download_v8.sh index e960ba58b..03d4e4789 100755 --- a/download_v8.sh +++ b/download_v8.sh @@ -67,14 +67,20 @@ if [ -z "$RELEASE" ]; then fi [ ${#ABIS[@]} -gt 0 ] || ABIS=(arm64-v8a armeabi-v7a x86_64 x86) -# The stamp records which release was installed, not which ABIs were asked for, -# so a previous --abi run must not satisfy a later request for the full set. -# The installed files are the source of truth. +# $STAMP records the release the shared headers came from; each ABI's library +# has its own stamp, since an --abi run installs only some of them. +ABI_STAMP_NAME=".v8-release-stamp" + +abi_release() { + local stamp="$LIBS_DIR/$1/$ABI_STAMP_NAME" + [ -f "$LIBS_DIR/$1/libv8_monolith.a" ] && [ -f "$stamp" ] && cat "$stamp" +} + installed() { [ -f "$STAMP" ] && [ "$(cat "$STAMP")" = "$RELEASE" ] || return 1 [ -f "$CPP_DIR/include/v8.h" ] && [ -d "$CPP_DIR/v8_inspector/src" ] || return 1 for abi in "${ABIS[@]}"; do - [ -f "$LIBS_DIR/$abi/libv8_monolith.a" ] || return 1 + [ "$(abi_release "$abi")" = "$RELEASE" ] || return 1 done } @@ -132,6 +138,19 @@ for ABI in "${ABIS[@]}"; do [ -f "$src" ] || { echo "Archive for $ABI has no libv8_monolith.a" >&2; exit 1; } mkdir -p "$LIBS_DIR/$ABI" cp "$src" "$LIBS_DIR/$ABI/libv8_monolith.a" + echo "$RELEASE" > "$LIBS_DIR/$ABI/$ABI_STAMP_NAME" +done + +# An ABI this run did not install keeps another release's library, which must +# not be linked against the headers installed below: remove it, so a build of +# that ABI fails until it is installed for this release too. +for dir in "$LIBS_DIR"/*/; do + abi="$(basename "$dir")" + [ -f "$dir/libv8_monolith.a" ] || continue + if [ "$(abi_release "$abi")" != "$RELEASE" ]; then + echo " removing $abi's library from another release; run with --abi $abi to install it" + rm -f "$dir/libv8_monolith.a" "$dir/$ABI_STAMP_NAME" + fi done echo "Installing public headers"