Skip to content

Commit e2234b3

Browse files
committed
fix: harden android symbol scripts
1 parent 25fcebe commit e2234b3

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

build_android.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ trap 'mv Cargo.toml.bak Cargo.toml' EXIT
3333
echo "Building release version..."
3434
cargo build --release
3535

36+
export CARGO_PROFILE_RELEASE_DEBUG=2
3637
export CARGO_PROFILE_RELEASE_STRIP=false
3738

3839
# Install the cargo-ndk version used by the mobile release scripts.
@@ -217,11 +218,17 @@ create_native_debug_symbols_archive() {
217218

218219
rm -f "$NATIVE_DEBUG_SYMBOLS_ZIP"
219220
archive_path="$PWD/$NATIVE_DEBUG_SYMBOLS_ZIP"
220-
(
221+
if ! (
221222
cd "$tmp_dir"
222223
zip -qr "$archive_path" armeabi-v7a arm64-v8a x86 x86_64
223-
)
224-
zip -T "$NATIVE_DEBUG_SYMBOLS_ZIP" >/dev/null
224+
); then
225+
rm -rf "$tmp_dir"
226+
exit 1
227+
fi
228+
if ! zip -T "$NATIVE_DEBUG_SYMBOLS_ZIP" >/dev/null; then
229+
rm -rf "$tmp_dir"
230+
exit 1
231+
fi
225232
rm -rf "$tmp_dir"
226233
}
227234

@@ -280,6 +287,7 @@ validate_android_symbols
280287
create_native_debug_symbols_archive
281288
strip_android_libraries
282289
validate_stripped_android_symbols
290+
unset CARGO_PROFILE_RELEASE_DEBUG
283291
unset CARGO_PROFILE_RELEASE_STRIP
284292
unset RUSTFLAGS
285293

0 commit comments

Comments
 (0)