Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/sample-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,24 @@ jobs:
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'

./scripts/set-dsn-aos.mjs
# Build all ABIs (not just x86) so armeabi-v7a and the 64-bit ABIs are
# exercised too. The Sentry perf-logger native library is compiled from
# source per ABI, and ABI-specific breakage has shipped before (#6394
# 16 KB alignment, #6398 armeabi-v7a link) precisely because CI only
# built x86. The 16 KB alignment check below then runs across every ABI.
./scripts/build-android.sh -PreactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# Split ABI coverage across the two matrix entries:
# - `dev` โ†’ subset (arm64-v8a only) so we can assert the module
# builds only the ABIs the app requested โ€” the root
# cause of #6398 was hardcoded abiFilters ignoring
# `reactNativeArchitectures`.
# - `production` โ†’ all four ABIs so the 16 KB alignment check below
# runs across every ABI (guards against #6394).
if [[ "${{ matrix.build-type }}" == "production" ]]; then
./scripts/build-android.sh -PreactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
else
./scripts/build-android.sh -PreactNativeArchitectures=arm64-v8a
fi

- name: Check libsentry-tm-perf-logger.so honors reactNativeArchitectures
if: ${{ matrix.build-type == 'dev' }}
# Asserts the module packaged our .so for exactly the subset the app
# requested โ€” guards against regressing the #6398 root-cause fix.
run: ./scripts/check-tm-perf-logger-abi-subset.sh ${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk 'arm64-v8a'

- name: Check 16 KB native library alignment
# Only Sentry-owned libraries are checked: third-party/React Native
Expand Down
58 changes: 58 additions & 0 deletions scripts/check-tm-perf-logger-abi-subset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

# Regression guard for the `reactNativeArchitectures` fix in
# https://github.com/getsentry/sentry-react-native/issues/6398.
#
# `libsentry-tm-perf-logger.so` is compiled from source in the consuming app.
# `packages/core/android/build.gradle` must honour the host app's
# `reactNativeArchitectures` property (like react-native-screens / reanimated
# do) so the module builds only the ABIs the app requested. When it doesn't,
# the module builds ABIs whose React Native `reactnative` prefab isn't
# provided โ†’ link failure.
#
# This check asserts that a built APK contains `libsentry-tm-perf-logger.so`
# for EXACTLY the ABIs the app requested โ€” no more, no less. Point it at a
# clean-build APK from a subset-ABI build (e.g. `-PreactNativeArchitectures=arm64-v8a`).
#
# Usage: scripts/check-tm-perf-logger-abi-subset.sh <path-to-apk-or-aab> <expected-abis-csv>
# e.g. scripts/check-tm-perf-logger-abi-subset.sh app.apk 'arm64-v8a'

set -euo pipefail

apk="${1:-}"
expected_csv="${2:-}"
if [[ -z "$apk" || ! -f "$apk" || -z "$expected_csv" ]]; then
echo "usage: $0 <path-to-apk-or-aab> <expected-abis-csv>" >&2
exit 2
fi

workdir="$(mktemp -d)"
trap 'rm -rf "$workdir"' EXIT

# Extract only the native libraries. APK stores them under `lib/`, AAB under `base/lib/`.
unzip -qq -o "$apk" 'lib/*' 'base/lib/*' -d "$workdir" 2>/dev/null || true

# ABIs where our library was packaged, one per line, sorted, unique.
actual=$(
find "$workdir" -type f -name 'libsentry-tm-perf-logger.so' 2>/dev/null \
| sed -E 's|.*/lib/([^/]+)/.*|\1|' \
| sort -u
)
expected=$(echo "$expected_csv" | tr ',' '\n' | sed '/^$/d' | sort -u)

echo "expected ABIs: $(echo $expected | tr '\n' ' ')"
echo "actual ABIs: $(echo $actual | tr '\n' ' ')"

if [[ -z "$actual" ]]; then
echo "โœ– libsentry-tm-perf-logger.so not found in $apk" >&2
echo " Expected it packaged for: $(echo $expected | tr '\n' ' ')" >&2
exit 1
fi

if [[ "$actual" != "$expected" ]]; then
echo "โœ– ABI mismatch โ€” module built ABIs the app did not request (or missed one)." >&2
echo " Root cause of #6398: abiFilters not honoring reactNativeArchitectures." >&2
exit 1
fi

echo "โœ” libsentry-tm-perf-logger.so packaged for exactly the requested ABI(s)"
Loading