mirror of
git://f0xx.org/android_cast
synced 2026-07-29 04:18:09 +03:00
snap
This commit is contained in:
46
rebuild.sh
46
rebuild.sh
@@ -5,16 +5,37 @@ set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
# Space-separated host:port list (wireless debugging). Edit as needed.
|
||||
CONNECTIONS_LIST=""
|
||||
# Hints for wireless debugging. Edit as needed.
|
||||
## CONNECTIONS_LIST_HINTS[IP_WITH_UNDERLINES]="hint string"
|
||||
declare -A CONNECTIONS_LIST_HINTS
|
||||
## android tv projector / android 13
|
||||
CONNECTIONS_LIST="${CONNECTIONS_LIST} 192.168.33.153:5555"
|
||||
CONNECTIONS_LIST_HINTS["192_168_33_153"]="[A13] Android Projector"
|
||||
## tab g6 max / android 16
|
||||
CONNECTIONS_LIST="${CONNECTIONS_LIST} 192.168.33.39:5555"
|
||||
CONNECTIONS_LIST_HINTS["192_168_33_39"]="[A16] Doogee Tab G6 Max / P8_EEA"
|
||||
## bl6000pro main / android 11
|
||||
CONNECTIONS_LIST="${CONNECTIONS_LIST} 192.168.33.106:5555"
|
||||
CONNECTIONS_LIST_HINTS["192_168_33_106"]="[A11] BlackView BL6000Pro / BL6000Pro_EEA"
|
||||
## bl6000pro aux / android 11
|
||||
CONNECTIONS_LIST="${CONNECTIONS_LIST} 192.168.33.173:5555"
|
||||
CONNECTIONS_LIST_HINTS["192_168_33_173"]="[A11] BlackView BL6000Pro / BL6000Pro"
|
||||
|
||||
get_ip_for_hint_key() {
|
||||
local ip=${1}
|
||||
ip="$(echo "${ip}" | sed -e s'@_@\.@g' -e s'@:.*@@' | tr -d '\n' )"
|
||||
printf "%s" "${ip}"
|
||||
}
|
||||
|
||||
get_hint_key_for_ip() {
|
||||
local ip=${1}
|
||||
ip="$(echo "${ip}" | sed -e s'@\.@_@g' -e s'@:.*@@' | tr -d '\n' )"
|
||||
printf "%s" "${ip}"
|
||||
}
|
||||
|
||||
get_hint() {
|
||||
local ip_mask="${1}"
|
||||
local -n hint
|
||||
ip_mask="$(get_hint_key_for_ip "${ip_mask}")"
|
||||
hint=CONNECTIONS_LIST_HINTS[${ip_mask}]
|
||||
printf "%s" "${hint}"
|
||||
}
|
||||
|
||||
APK="$ROOT/app/build/outputs/apk/debug/app-debug.apk"
|
||||
PACKAGE="com.foxx.androidcast"
|
||||
@@ -33,7 +54,7 @@ for arg in "$@"; do
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [--skip-tests] [--java-home=PATH]"
|
||||
echo " Builds debug APK, runs unit tests (unless skipped), reconnects devices in CONNECTIONS_LIST,"
|
||||
echo " Builds debug APK, runs unit tests (unless skipped), reconnects devices in CONNECTIONS_LIST_HINTS,"
|
||||
echo " installs on all adb devices in 'device' state, and launches the app."
|
||||
exit 0
|
||||
;;
|
||||
@@ -79,6 +100,10 @@ reconnect_endpoint() {
|
||||
local endpoint="$1"
|
||||
[[ -z "$endpoint" ]] && return 1
|
||||
local attempt out
|
||||
local hint=""
|
||||
hint="$(get_hint "${endpoint}")"
|
||||
[[ -n "${hint}" ]] && hint="(having hint: ${hint})"
|
||||
echo " trying to connect to $endpoint ${hint}"
|
||||
adb disconnect "$endpoint" >/dev/null 2>&1 || true
|
||||
for (( attempt = 1; attempt <= ADB_CONNECT_RETRIES; attempt++ )); do
|
||||
out="$(adb connect "$endpoint" 2>&1)" || true
|
||||
@@ -101,8 +126,8 @@ reconnect_known_devices() {
|
||||
adb start-server >/dev/null 2>&1 || true
|
||||
adb reconnect offline >/dev/null 2>&1 || true
|
||||
local endpoint
|
||||
for endpoint in $CONNECTIONS_LIST; do
|
||||
reconnect_endpoint "$endpoint" || true
|
||||
for endpoint in "${!CONNECTIONS_LIST_HINTS[@]}"; do
|
||||
reconnect_endpoint "$(get_ip_for_hint_key "$endpoint")" || true
|
||||
done
|
||||
adb devices -l
|
||||
}
|
||||
@@ -133,7 +158,8 @@ done
|
||||
|
||||
echo "==> Building debug APK (JAVA_HOME=$JAVA_HOME)"
|
||||
./gradlew --stop
|
||||
./gradlew clean assembleDebug
|
||||
./gradlew clean
|
||||
./gradlew --build-cache assembleDebug
|
||||
|
||||
if [[ "$RUN_UNIT_TESTS" == "1" ]]; then
|
||||
echo "==> Running unit tests (./gradlew testDebugUnitTest)"
|
||||
|
||||
Reference in New Issue
Block a user