aboutsummaryrefslogtreecommitdiff
path: root/test-rig/build-apk.sh
blob: 18b3969234c15aa18bbbb09142a769384c5dc704 (plain) (blame)
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
#!/bin/sh
# Smoke test: build a signed release APK from inside the rig using a
# throwaway keystore. Validates that scripts/build-apk + the gradle
# signingConfigs wiring still produces a valid signed apk.
#
# Output: /work/app/build/outputs/apk/release/app-release.apk
#         (and the keystore in /work/.tools/release-smoke.jks)

set -eu

KS="/work/.tools/release-smoke.p12"
KS_PASS="changeit"
KEY_ALIAS="scrcpy-android-smoke"

mkdir -p /work/.tools

if [ ! -f "$KS" ]; then
    echo "build-apk.sh: generating throwaway keystore at $KS"
    keytool -genkey -noprompt \
        -keystore "$KS" -storetype PKCS12 \
        -storepass "$KS_PASS" -keypass "$KS_PASS" \
        -alias "$KEY_ALIAS" -keyalg RSA -keysize 2048 -validity 365 \
        -dname "CN=scrcpy-android smoke, OU=test, O=local, C=US" \
        >/dev/null
fi

export KEYSTORE_PATH="$KS"
export KEYSTORE_PASS="$KS_PASS"
export KEY_ALIAS="$KEY_ALIAS"
export KEY_PASS="$KS_PASS"

exec /work/scripts/build-apk