mirror of
git://f0xx.org/android_cast
synced 2026-07-29 02:59:00 +03:00
Merge branch 'feature/gzip-ota-build-deploy' into next.
Resolve deploy.sh migration helper duplication and combine gitignore entries for out/ and ota-publish/. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -222,7 +222,9 @@ if [[ ! -f "$LIBVPX_A" ]]; then
|
||||
fi
|
||||
|
||||
cp -f "$LIBVPX_A" "$OUT/libvpx.a"
|
||||
cp -f "$OUT/libvpx.a" "$PROJECT_OUT/libvpx.a"
|
||||
if [[ "$OUT" != "$PROJECT_OUT" ]]; then
|
||||
cp -f "$OUT/libvpx.a" "$PROJECT_OUT/libvpx.a"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Built: $PROJECT_OUT/libvpx.a (size $(ls -lah "${PROJECT_OUT}/libvpx.a" | awk '{print $5}'))"
|
||||
|
||||
@@ -42,10 +42,24 @@ fi
|
||||
|
||||
export ANDROIDCAST_ROOT="$ROOT"
|
||||
export ANDROIDCAST_CCACHE="${ANDROIDCAST_CCACHE:-1}"
|
||||
GRADLE_JAVA_OPT=()
|
||||
if [[ -n "${JAVA_HOME:-}" ]]; then
|
||||
GRADLE_JAVA_OPT=(-Dorg.gradle.java.home="${JAVA_HOME}")
|
||||
fi
|
||||
# shellcheck source=android-ndk.sh
|
||||
source "$ROOT/scripts/android-ndk.sh"
|
||||
export ANDROID_NDK_HOME="$(androidcast_find_ndk_root "$ROOT")"
|
||||
export ANDROID_NDK_ROOT="$ANDROID_NDK_HOME"
|
||||
if [[ -n "${ANDROID_SDK_ROOT:-}" ]]; then
|
||||
LOCAL_PROPS="$ROOT/local.properties"
|
||||
LOCAL_PROPS_BACKUP=""
|
||||
if [[ -f "$LOCAL_PROPS" ]]; then
|
||||
LOCAL_PROPS_BACKUP="$(mktemp)"
|
||||
cp -f "$LOCAL_PROPS" "$LOCAL_PROPS_BACKUP"
|
||||
fi
|
||||
trap 'if [[ -n "${LOCAL_PROPS_BACKUP:-}" && -f "${LOCAL_PROPS_BACKUP}" ]]; then cp -f "${LOCAL_PROPS_BACKUP}" "$LOCAL_PROPS"; rm -f "${LOCAL_PROPS_BACKUP}"; else rm -f "$LOCAL_PROPS"; fi' EXIT
|
||||
printf 'sdk.dir=%s\n' "${ANDROID_SDK_ROOT//\\/\\\\}" > "$LOCAL_PROPS"
|
||||
fi
|
||||
|
||||
if [[ "$RUN_NATIVE" == "1" && "$RUN_APK" == "1" ]]; then
|
||||
echo "==> Phase: native codecs"
|
||||
@@ -59,16 +73,19 @@ else
|
||||
echo "==> Phase: native codecs (skipped)"
|
||||
fi
|
||||
|
||||
# Avoid host-specific CMake cache paths when running in Docker.
|
||||
rm -rf "$ROOT/app/.cxx" "$ROOT/app/build/.cxx" "$ROOT/app/build/intermediates/cxx"
|
||||
|
||||
if [[ "$RUN_APK" == "1" ]]; then
|
||||
echo "==> Phase: gradle ${GRADLE_TASK}"
|
||||
if [[ "$RUN_UNIT_TESTS" == "1" ]]; then
|
||||
./gradlew --no-daemon clean "${GRADLE_TASK}" testDebugUnitTest
|
||||
./gradlew --no-daemon "${GRADLE_JAVA_OPT[@]}" clean "${GRADLE_TASK}" testDebugUnitTest
|
||||
else
|
||||
./gradlew --no-daemon clean "${GRADLE_TASK}"
|
||||
./gradlew --no-daemon "${GRADLE_JAVA_OPT[@]}" clean "${GRADLE_TASK}"
|
||||
fi
|
||||
else
|
||||
echo "==> Phase: gradle tests-only"
|
||||
./gradlew --no-daemon testDebugUnitTest
|
||||
./gradlew --no-daemon "${GRADLE_JAVA_OPT[@]}" testDebugUnitTest
|
||||
fi
|
||||
|
||||
APK=""
|
||||
|
||||
32
scripts/deploy-ota-staging.sh
Executable file
32
scripts/deploy-ota-staging.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Rsync ./out/ota/v0 to a remote web root (staging OTA tree).
|
||||
#
|
||||
# Usage:
|
||||
# OTA_DEPLOY_TARGET=foxx@10.7.16.128:/var/www/localhost/htdocs/ \
|
||||
# ./scripts/deploy-ota-staging.sh
|
||||
#
|
||||
# Dry run:
|
||||
# OTA_DEPLOY_DRY_RUN=1 ./scripts/deploy-ota-staging.sh
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SRC="${ROOT}/out/ota/v0"
|
||||
TARGET="${OTA_DEPLOY_TARGET:?Set OTA_DEPLOY_TARGET=user@host:/path/to/web/root}"
|
||||
|
||||
if [[ ! -d "$SRC" ]]; then
|
||||
echo "Missing ${SRC} — run ./scripts/docker-build-ota.sh first" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RSYNC_OPTS=(-av --delete)
|
||||
if [[ "${OTA_DEPLOY_DRY_RUN:-}" == "1" ]]; then
|
||||
RSYNC_OPTS+=(--dry-run -v)
|
||||
fi
|
||||
|
||||
echo "Sync ${SRC}/ -> ${TARGET}/v0/"
|
||||
rsync "${RSYNC_OPTS[@]}" "${SRC}/" "${TARGET%/}/v0/"
|
||||
|
||||
echo "Channel pointer (after deploy):"
|
||||
if [[ -f "${ROOT}/out/BUILD_INFO.json" ]]; then
|
||||
grep channelUrl "${ROOT}/out/BUILD_INFO.json" || true
|
||||
fi
|
||||
39
scripts/docker-build-ota.sh
Executable file
39
scripts/docker-build-ota.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Host wrapper: build androidcast-ci image and run build + OTA staging publish.
|
||||
#
|
||||
# Usage:
|
||||
# export OTA_BASE_URL=https://apps.f0xx.org
|
||||
# ./scripts/docker-build-ota.sh
|
||||
#
|
||||
# Artifacts: ./out/android_cast-latest.apk ./out/ota/v0/ota/...
|
||||
#
|
||||
# Deploy to BE (example — adjust host/path):
|
||||
# rsync -av ./out/ota/v0/ user@be:/var/www/localhost/htdocs/v0/
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
IMAGE="${ANDROIDCAST_CI_IMAGE:-androidcast-ci:latest}"
|
||||
|
||||
docker build -t "$IMAGE" -f "${ROOT}/Dockerfile" "${ROOT}"
|
||||
|
||||
mkdir -p "${ROOT}/out"
|
||||
|
||||
docker run --rm \
|
||||
-v "${ROOT}:/workspace" \
|
||||
-w /workspace \
|
||||
-e OTA_BASE_URL="${OTA_BASE_URL:-}" \
|
||||
-e OTA_CHANNEL="${OTA_CHANNEL:-staging}" \
|
||||
-e GRADLE_TASK="${GRADLE_TASK:-assembleDebug}" \
|
||||
-e SKIP_NATIVE="${SKIP_NATIVE:-0}" \
|
||||
-e SKIP_TESTS="${SKIP_TESTS:-0}" \
|
||||
-e RELEASE_NOTES="${RELEASE_NOTES:-}" \
|
||||
-e OUT_DIR=/workspace/out \
|
||||
"$IMAGE" \
|
||||
./scripts/ci-build-and-publish-ota.sh
|
||||
|
||||
echo ""
|
||||
echo "Done. APK: ${ROOT}/out/android_cast-latest.apk"
|
||||
if [[ -f "${ROOT}/out/BUILD_INFO.json" ]]; then
|
||||
echo "OTA channel URL:"
|
||||
sed -n 's/.*"channelUrl": "\([^"]*\)".*/\1/p' "${ROOT}/out/BUILD_INFO.json" | head -1
|
||||
fi
|
||||
@@ -4,9 +4,12 @@
|
||||
# Usage:
|
||||
# ./scripts/generate-ota-v0.sh path/to/app-release.apk https://host[:port] [out-dir] [channel]
|
||||
#
|
||||
# channel — JSON file under v0/ota/channel/ (default: stable). Use staging for QA.
|
||||
# RELEASE_NOTES — optional env, embedded in manifest.
|
||||
#
|
||||
# channel — JSON under v0/ota/channel/ (stable, staging, dev, nightly, or custom)
|
||||
# Writes under out-dir (default: ./ota-publish):
|
||||
# v0/ota/channel/stable.json
|
||||
# v0/ota/channel/<channel>.json
|
||||
# v0/ota/00/00.MM/00.MM.mm/android_cast_00.MM.mm.BB_manifest.json
|
||||
# v0/ota/00/00.MM/00.MM.mm/android_cast_00.MM.mm.BB_sign.json
|
||||
# v0/ota/00/00.MM/00.MM.mm/android_cast_00.MM.mm.BB.otapkg
|
||||
@@ -17,6 +20,19 @@ apk="${1:?APK path required}"
|
||||
host_base="${2:?Base URL required, e.g. https://192.168.1.1:8080}"
|
||||
out_dir="${3:-ota-publish}"
|
||||
channel="${4:-stable}"
|
||||
release_notes="${RELEASE_NOTES:-}"
|
||||
json_notes() {
|
||||
if command -v jq >/dev/null 2>&1; then
|
||||
jq -n --arg n "$release_notes" '$n'
|
||||
else
|
||||
local esc="${release_notes//\\/\\\\}"
|
||||
esc="${esc//\"/\\\"}"
|
||||
esc="${esc//$'\n'/\\n}"
|
||||
esc="${esc//$'\r'/}"
|
||||
printf '"%s"' "$esc"
|
||||
fi
|
||||
}
|
||||
NOTES_JSON="$(json_notes)"
|
||||
|
||||
if [[ ! -f "$apk" ]]; then
|
||||
echo "APK not found: $apk" >&2
|
||||
@@ -84,7 +100,7 @@ cat >"${rel_dir}/${manifest_name}" <<EOF
|
||||
"signUrl": "${sign_url}",
|
||||
"sizeBytes": ${apk_size},
|
||||
"mandatory": false,
|
||||
"releaseNotes": ""
|
||||
"releaseNotes": ${NOTES_JSON}
|
||||
}
|
||||
EOF
|
||||
|
||||
@@ -113,7 +129,7 @@ cat >"${rel_dir}/${manifest_name}" <<EOF
|
||||
"bundleSha256": "${bundle_sha256}",
|
||||
"bundleSizeBytes": ${bundle_size},
|
||||
"mandatory": false,
|
||||
"releaseNotes": ""
|
||||
"releaseNotes": ${NOTES_JSON}
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user