build: don't let aapt2's SIGPIPE read as a failed build
release.sh piped 'aapt2 dump badging' into head -1; under pipefail the SIGPIPE that head causes made the substitution fail, so the script exited silently right after printing the version. sed -n 1p reads to the end and leaves the status alone.
This commit is contained in:
parent
b14628a01d
commit
4ab40cdc6e
1 changed files with 3 additions and 1 deletions
|
|
@ -58,7 +58,9 @@ echo "release: $TAG (versionCode $VERSION_CODE)"
|
|||
APK=app/build/outputs/apk/release/app-release.apk
|
||||
[ -f "$APK" ] || fail "no APK at $APK"
|
||||
|
||||
BADGING=$("$AAPT2" dump badging "$APK" | head -1)
|
||||
# sed -n 1p, not head -1: head closes the pipe early and pipefail would
|
||||
# turn aapt2's SIGPIPE into a failed "build".
|
||||
BADGING=$("$AAPT2" dump badging "$APK" 2>/dev/null | sed -n "1p")
|
||||
APK_CODE=$(printf '%s' "$BADGING" | sed -n "s/.*versionCode='\([0-9]*\)'.*/\1/p")
|
||||
APK_NAME=$(printf '%s' "$BADGING" | sed -n "s/.*versionName='\([^']*\)'.*/\1/p")
|
||||
[ "$APK_CODE" = "$VERSION_CODE" ] || fail "APK has versionCode $APK_CODE but version.properties says $VERSION_CODE — stale or unbuilt APK"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue