-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-aab.sh
More file actions
54 lines (40 loc) · 1.49 KB
/
Copy pathbuild-aab.sh
File metadata and controls
54 lines (40 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
# StreamClip AAB Build Script for Google Play Store
# Usage: ./build-aab.sh [full|github|store] [--no-minify]
# (default: store flavor, since AAB is for Play Store)
# Note: AAB does NOT need local signing - Google signs it after upload.
set -e
FLAVOR="${1:-store}"
NO_MINIFY=false
for arg in "$@"; do
case "$arg" in
--no-minify) NO_MINIFY=true ;;
esac
done
case "$FLAVOR" in
full|github|store) ;;
*) echo "Usage: $0 [full|github|store] [--no-minify]"; exit 1 ;;
esac
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
APP_DIR="$PROJECT_DIR/app"
VERSION=$(grep 'versionName' "$APP_DIR/build.gradle.kts" | head -1 | sed 's/.*versionName *= *"\([^"]*\)".*/\1/')
VERSION="v${VERSION:-2.1.2}"
FLAVOR_CAP="$(echo "$FLAVOR" | sed 's/\b./\u&/')"
GRADLE_TASK="bundle${FLAVOR_CAP}Release"
echo "=== Building StreamClip $VERSION AAB for $FLAVOR ==="
cd "$PROJECT_DIR"
GRADLE_ARGS="-PbuildAbi=arm64-v8a"
[[ "$NO_MINIFY" == true ]] && GRADLE_ARGS="$GRADLE_ARGS -PenableMinify=false -PenableShrinkResources=false"
./gradlew "$GRADLE_TASK" $GRADLE_ARGS
BUILD_DIR="$APP_DIR/build/outputs/bundle/${FLAVOR}Release"
AAB="$BUILD_DIR/app-$FLAVOR-release.aab"
if [[ ! -f "$AAB" ]]; then
echo "ERROR: AAB not found at $AAB"
ls "$BUILD_DIR" 2>/dev/null || true
exit 1
fi
OUTPUT="$PROJECT_DIR/StreamClip-${VERSION}-${FLAVOR}.aab"
cp "$AAB" "$OUTPUT"
SIZE=$(du -h "$OUTPUT" | cut -f1)
echo "=== Done: $OUTPUT ($SIZE) ==="
echo "Upload this AAB to Google Play Console. Google will sign it."