v0.8.0
This commit is contained in:
commit
4cb9717db2
97 files changed
+5946
No files matched your search
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds simply-tv (Android TV app) into dist/simply-tv-<version>.apk.
|
||||
#
|
||||
# The build runs in Docker (image from scripts/docker/android.Dockerfile), the host only
|
||||
# needs Docker. On the first build a signing key is created in keystore/ – keep it (and back
|
||||
# it up): Android only accepts updates signed with the same key.
|
||||
#
|
||||
# BUILD_IN_DOCKER=0 build on the host (needs JDK 17, Android SDK in $ANDROID_HOME, gradle)
|
||||
# BUILDER_IMAGE=... builder image name (default simply-tv-builder:1)
|
||||
# DOCKER_ARGS="..." extra arguments for `docker run`
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
IMAGE="${BUILDER_IMAGE:-simply-tv-builder:1}"
|
||||
|
||||
if [ -z "${SIMPLY_TV_IN_DOCKER:-}" ] && [ "${BUILD_IN_DOCKER:-1}" != 0 ]; then
|
||||
if ! docker image inspect "$IMAGE" >/dev/null 2>&1; then
|
||||
echo ">> building the builder image $IMAGE (first time only, ~1.5 GB)"
|
||||
docker build -t "$IMAGE" -f scripts/docker/android.Dockerfile scripts/docker
|
||||
fi
|
||||
exec docker run --rm \
|
||||
-e SIMPLY_TV_IN_DOCKER=1 -e HOST_UID="$(id -u)" -e HOST_GID="$(id -g)" \
|
||||
-v "$PWD":/src -v simply-tv-gradle:/root/.gradle \
|
||||
${DOCKER_ARGS:-} "$IMAGE" bash scripts/build-apk.sh "$@"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------- signing key (once)
|
||||
mkdir -p keystore
|
||||
if [ ! -f keystore/keystore.properties ]; then
|
||||
PASS="$(head -c 18 /dev/urandom | base64 | tr -dc 'A-Za-z0-9' | head -c 20)"
|
||||
keytool -genkeypair -noprompt -keystore keystore/simply-tv.jks -alias simply-tv \
|
||||
-keyalg RSA -keysize 3072 -validity 10000 -storepass "$PASS" -keypass "$PASS" \
|
||||
-dname "CN=simply-tv, O=simply-dvb" >/dev/null
|
||||
cat > keystore/keystore.properties <<PROPS
|
||||
storeFile=keystore/simply-tv.jks
|
||||
storePassword=$PASS
|
||||
keyAlias=simply-tv
|
||||
keyPassword=$PASS
|
||||
PROPS
|
||||
echo ">> created signing key keystore/simply-tv.jks – back it up together with keystore.properties"
|
||||
fi
|
||||
|
||||
[ -f local.properties ] || echo "sdk.dir=${ANDROID_HOME:-/opt/android-sdk}" > local.properties
|
||||
gradle --no-daemon -q :app:assembleRelease
|
||||
|
||||
VERSION="$(grep -m1 'versionName' app/build.gradle.kts | sed -E 's/.*"(.*)".*/\1/')"
|
||||
mkdir -p dist
|
||||
cp app/build/outputs/apk/release/app-release.apk "dist/simply-tv-$VERSION.apk"
|
||||
if [ -n "${HOST_UID:-}" ]; then
|
||||
chown -R "$HOST_UID:${HOST_GID:-$HOST_UID}" dist keystore app/build .gradle local.properties 2>/dev/null || true
|
||||
fi
|
||||
echo ">> dist/simply-tv-$VERSION.apk"
|
||||
Reference in new issue
Block a user