summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/apply_flavor_izzy.sh13
-rwxr-xr-xscripts/apply_flavor_libre.sh13
-rwxr-xr-xscripts/apply_flavor_play.sh13
-rwxr-xr-xscripts/extract_apks_libre.sh28
-rwxr-xr-xscripts/extract_apks_play.sh28
-rw-r--r--scripts/fix_android_log_levels.bat43
-rwxr-xr-xscripts/fix_android_log_levels.sh36
-rwxr-xr-xscripts/screenshot_post_process.sh87
-rwxr-xr-xscripts/update_flutter_version.sh15
9 files changed, 276 insertions, 0 deletions
diff --git a/scripts/apply_flavor_izzy.sh b/scripts/apply_flavor_izzy.sh
new file mode 100755
index 0000000..ac86e73
--- /dev/null
+++ b/scripts/apply_flavor_izzy.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+if [ ! -d "scripts" ]; then
+ cd ..
+fi
+
+PUBSPEC_PATH="pubspec.yaml"
+
+./flutterw clean
+
+sed -i 's|plugins/aves_services_.*|plugins/aves_services_google|g' "$PUBSPEC_PATH"
+sed -i 's|plugins/aves_report_.*|plugins/aves_report_console|g' "$PUBSPEC_PATH"
+
+./flutterw pub get
diff --git a/scripts/apply_flavor_libre.sh b/scripts/apply_flavor_libre.sh
new file mode 100755
index 0000000..da614cf
--- /dev/null
+++ b/scripts/apply_flavor_libre.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+if [ ! -d "scripts" ]; then
+ cd ..
+fi
+
+PUBSPEC_PATH="pubspec.yaml"
+
+./flutterw clean
+
+sed -i 's|plugins/aves_services_.*|plugins/aves_services_none|g' "$PUBSPEC_PATH"
+sed -i 's|plugins/aves_report_.*|plugins/aves_report_console|g' "$PUBSPEC_PATH"
+
+./flutterw pub get
diff --git a/scripts/apply_flavor_play.sh b/scripts/apply_flavor_play.sh
new file mode 100755
index 0000000..1775ad3
--- /dev/null
+++ b/scripts/apply_flavor_play.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+if [ ! -d "scripts" ]; then
+ cd ..
+fi
+
+PUBSPEC_PATH="pubspec.yaml"
+
+./flutterw clean
+
+sed -i 's|plugins/aves_services_.*|plugins/aves_services_google|g' "$PUBSPEC_PATH"
+sed -i 's|plugins/aves_report_.*|plugins/aves_report_crashlytics|g' "$PUBSPEC_PATH"
+
+./flutterw pub get
diff --git a/scripts/extract_apks_libre.sh b/scripts/extract_apks_libre.sh
new file mode 100755
index 0000000..67e97b4
--- /dev/null
+++ b/scripts/extract_apks_libre.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+if [ ! -d "scripts" ]; then
+ cd ..
+fi
+
+BUNDLE="/home/tibo/Downloads/app-libre-release.aab"
+APKS_FULL="/home/tibo/Downloads/app-libre-release.apks"
+APKS_STRIPPED="/home/tibo/Downloads/app-libre-release_stripped.apks"
+
+rm "$APKS_FULL"
+
+# shellcheck disable=SC2001
+OUTPUT=$(sed "s|\.aab|\.apks|" <<<"$BUNDLE")
+
+KEYS_PATH="android/key.properties"
+STORE_PATH=$(sed -n 's|.*storeFile=\(.*\)[\r\n]|\1|p' "$KEYS_PATH")
+# shellcheck disable=SC1003
+STORE_PW=$(sed -n 's|.*storePassword=\(.*\)[\r\n]|\1|p' "$KEYS_PATH" | sed 's|\\'\''|'\''|g')
+KEY_ALIAS=$(sed -n 's|.*keyAlias=\(.*\)[\r\n]|\1|p' "$KEYS_PATH")
+# shellcheck disable=SC1003
+KEY_PW=$(sed -n 's|.*keyPassword=\(.*\)[\r\n]|\1|p' "$KEYS_PATH" | sed 's|\\'\''|'\''|g')
+
+echo "$BUNDLE -> $OUTPUT"
+bundletool build-apks --bundle="$BUNDLE" --output="$OUTPUT" \
+ --ks="$STORE_PATH" --ks-pass="pass:$STORE_PW" \
+ --ks-key-alias="$KEY_ALIAS" --key-pass="pass:$KEY_PW"
+
+../apkstripper "$APKS_FULL" "$APKS_STRIPPED" \ No newline at end of file
diff --git a/scripts/extract_apks_play.sh b/scripts/extract_apks_play.sh
new file mode 100755
index 0000000..7cec9fc
--- /dev/null
+++ b/scripts/extract_apks_play.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+if [ ! -d "scripts" ]; then
+ cd ..
+fi
+
+BUNDLE="/home/tibo/Downloads/app-play-release.aab"
+APKS_FULL="/home/tibo/Downloads/app-play-release.apks"
+APKS_STRIPPED="/home/tibo/Downloads/app-play-release_stripped.apks"
+
+rm "$APKS_FULL"
+
+# shellcheck disable=SC2001
+OUTPUT=$(sed "s|\.aab|\.apks|" <<<"$BUNDLE")
+
+KEYS_PATH="android/key.properties"
+STORE_PATH=$(sed -n 's|.*storeFile=\(.*\)[\r\n]|\1|p' "$KEYS_PATH")
+# shellcheck disable=SC1003
+STORE_PW=$(sed -n 's|.*storePassword=\(.*\)[\r\n]|\1|p' "$KEYS_PATH" | sed 's|\\'\''|'\''|g')
+KEY_ALIAS=$(sed -n 's|.*keyAlias=\(.*\)[\r\n]|\1|p' "$KEYS_PATH")
+# shellcheck disable=SC1003
+KEY_PW=$(sed -n 's|.*keyPassword=\(.*\)[\r\n]|\1|p' "$KEYS_PATH" | sed 's|\\'\''|'\''|g')
+
+echo "$BUNDLE -> $OUTPUT"
+bundletool build-apks --bundle="$BUNDLE" --output="$OUTPUT" \
+ --ks="$STORE_PATH" --ks-pass="pass:$STORE_PW" \
+ --ks-key-alias="$KEY_ALIAS" --key-pass="pass:$KEY_PW"
+
+../apkstripper "$APKS_FULL" "$APKS_STRIPPED" \ No newline at end of file
diff --git a/scripts/fix_android_log_levels.bat b/scripts/fix_android_log_levels.bat
new file mode 100644
index 0000000..d5a860b
--- /dev/null
+++ b/scripts/fix_android_log_levels.bat
@@ -0,0 +1,43 @@
+@echo off
+setlocal
+
+if defined ANDROID_SDK_ROOT (set sdk=%ANDROID_SDK_ROOT%)
+if defined ANDROID_SDK (set sdk=%ANDROID_SDK%)
+cd /d %sdk%\platform-tools
+
+@echo on
+
+adb.exe shell setprop persist.log.tag.ACodec WARN
+adb.exe shell setprop persist.log.tag.AHierarchicalStateMachine ERROR
+adb.exe shell setprop persist.log.tag.AudioCapabilities ERROR
+adb.exe shell setprop persist.log.tag.AudioTrack INFO
+adb.exe shell setprop persist.log.tag.BufferPoolAccessor2.0 INFO
+adb.exe shell setprop persist.log.tag.CCodec INFO
+adb.exe shell setprop persist.log.tag.CCodecBufferChannel INFO
+adb.exe shell setprop persist.log.tag.CCodecBuffers INFO
+adb.exe shell setprop persist.log.tag.CCodecConfig INFO
+adb.exe shell setprop persist.log.tag.Codec2Client INFO
+adb.exe shell setprop persist.log.tag.CompatibilityChangeReporter INFO
+adb.exe shell setprop persist.log.tag.Counters WARN
+adb.exe shell setprop persist.log.tag.CustomizedTextParser INFO
+adb.exe shell setprop persist.log.tag.EGL_emulation INFO
+adb.exe shell setprop persist.log.tag.HostConnection INFO
+adb.exe shell setprop persist.log.tag.InputMethodManager WARN
+adb.exe shell setprop persist.log.tag.InsetsSourceConsumer INFO
+adb.exe shell setprop persist.log.tag.InputTransport INFO
+adb.exe shell setprop persist.log.tag.J4A INFO
+adb.exe shell setprop persist.log.tag.MediaCodec WARN
+adb.exe shell setprop persist.log.tag.MediaMetadataRetriever INFO
+adb.exe shell setprop persist.log.tag.MediaMetadataRetrieverJNI INFO
+adb.exe shell setprop persist.log.tag.NativeTiffDecoder INFO
+adb.exe shell setprop persist.log.tag.NuMediaExtractor INFO
+adb.exe shell setprop persist.log.tag.PipelineWatcher INFO
+adb.exe shell setprop persist.log.tag.ReflectedParamUpdater INFO
+adb.exe shell setprop persist.log.tag.skia INFO
+adb.exe shell setprop persist.log.tag.SurfaceControl WARN
+adb.exe shell setprop persist.log.tag.SurfaceUtils INFO
+adb.exe shell setprop persist.log.tag.SurfaceView WARN
+adb.exe shell setprop persist.log.tag.VideoCapabilities ERROR
+
+@echo off
+endlocal
diff --git a/scripts/fix_android_log_levels.sh b/scripts/fix_android_log_levels.sh
new file mode 100755
index 0000000..1a01224
--- /dev/null
+++ b/scripts/fix_android_log_levels.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+adb shell setprop persist.log.tag.ACodec WARN
+adb shell setprop persist.log.tag.AHierarchicalStateMachine ERROR
+adb shell setprop persist.log.tag.AudioCapabilities ERROR
+adb shell setprop persist.log.tag.AudioTrack INFO
+adb shell setprop persist.log.tag.BufferPoolAccessor2.0 INFO
+adb shell setprop persist.log.tag.CCodec INFO
+adb shell setprop persist.log.tag.CCodecBufferChannel INFO
+adb shell setprop persist.log.tag.CCodecBuffers INFO
+adb shell setprop persist.log.tag.CCodecConfig INFO
+adb shell setprop persist.log.tag.Codec2Client INFO
+adb shell setprop persist.log.tag.CompatibilityChangeReporter INFO
+adb shell setprop persist.log.tag.ConnectivityManager INFO
+adb shell setprop persist.log.tag.Counters WARN
+adb shell setprop persist.log.tag.CustomizedTextParser INFO
+adb shell setprop persist.log.tag.EGL_emulation INFO
+adb shell setprop persist.log.tag.ffmpeg-kit-flutter INFO
+adb shell setprop persist.log.tag.HostConnection INFO
+adb shell setprop persist.log.tag.InputMethodManager WARN
+adb shell setprop persist.log.tag.InsetsSourceConsumer INFO
+adb shell setprop persist.log.tag.InputTransport INFO
+adb shell setprop persist.log.tag.J4A INFO
+adb shell setprop persist.log.tag.MediaCodec WARN
+adb shell setprop persist.log.tag.MediaMetadataRetriever INFO
+adb shell setprop persist.log.tag.MediaMetadataRetrieverJNI INFO
+adb shell setprop persist.log.tag.NativeTiffDecoder INFO
+adb shell setprop persist.log.tag.NuMediaExtractor INFO
+adb shell setprop persist.log.tag.OpenGLRenderer INFO
+adb shell setprop persist.log.tag.PipelineWatcher INFO
+adb shell setprop persist.log.tag.ReflectedParamUpdater INFO
+adb shell setprop persist.log.tag.skia INFO
+adb shell setprop persist.log.tag.SurfaceControl WARN
+adb shell setprop persist.log.tag.SurfaceUtils INFO
+adb shell setprop persist.log.tag.SurfaceView WARN
+adb shell setprop persist.log.tag.VideoCapabilities ERROR
+
diff --git a/scripts/screenshot_post_process.sh b/scripts/screenshot_post_process.sh
new file mode 100755
index 0000000..5472c34
--- /dev/null
+++ b/scripts/screenshot_post_process.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+if [ ! -d "scripts" ]; then
+ cd ..
+fi
+
+# process raw screenshots from test driver to generate:
+# - scaled down versions for IzzyOnDroid
+# - framed versions for Google Play
+# - framed and scaled down versions for README (English only)
+
+# expects:
+# - ImageMagick 6
+# - raw screenshots sized at 1080x2520 (21∶9) in `/screenshots/raw`
+
+DEVICE_OVERLAY_LTR=~/code/aves_extra/screenshots/device_overlay_ltr.png
+DEVICE_OVERLAY_RTL=~/code/aves_extra/screenshots/device_overlay_rtl.png
+DEVICE_FRAME=~/code/aves_extra/screenshots/device_frame_1142x2650_for_1080x2520.png
+# FRAME_SIZE: dimensions of DEVICE_FRAME
+FRAME_SIZE=1142x2650
+# FRAME_OFFSET: offset for content in DEVICE_FRAME
+FRAME_OFFSET=31x53
+# PLAY_SIZE: contain FRAME_SIZE in 9:16
+PLAY_SIZE=1490x2650
+
+cd screenshots || exit
+
+# add Android system overlay
+for source in raw/*/*; do
+ if [[ -f "$source" ]]; then
+ target=${source/raw/overlay}
+ echo "$source -> $target"
+ mkdir -p "$(dirname "$target")"
+ locale="$(basename "$(dirname "$source")")"
+ [[ $locale = "ar" || $locale = "fa" ]] && overlay="$DEVICE_OVERLAY_RTL" || overlay="$DEVICE_OVERLAY_LTR"
+ convert "$source" $overlay -composite "$target"
+ fi
+done
+
+# izzy: scale down + fastlane folder structure
+for source in overlay/*/*; do
+ if [[ -f "$source" ]]; then
+ target=$(echo "$source" | sed -e 's/overlay\/\(.*\)\//izzy\/\1\/images\/phoneScreenshots\//g')
+ echo "$source -> $target"
+ mkdir -p "$(dirname "$target")"
+ convert -resize 350x "$source" "$target"
+ fi
+done
+mv izzy/en izzy/en-US
+mv izzy/en_Shaw izzy/en-XW-Shaw
+mv izzy/es izzy/es-MX
+mv izzy/nb izzy/nb-NO
+mv izzy/pt izzy/pt-BR
+mv izzy/zh izzy/zh-CN
+mv izzy/zh_Hant izzy/zh-Hant
+
+# play: add device frame
+for source in overlay/*/*; do
+ if [[ -f "$source" ]]; then
+ target=${source/overlay/framed}
+ echo "$source -> $target"
+ mkdir -p "$(dirname "$target")"
+ convert "$source" -background transparent -splice $FRAME_OFFSET -extent $FRAME_SIZE $DEVICE_FRAME -composite "$target"
+ fi
+done
+
+# play: fix aspect ratio
+for source in framed/*/*; do
+ if [[ -f "$source" ]]; then
+ target=${source/framed/play}
+ echo "$source -> $target"
+ mkdir -p "$(dirname "$target")"
+ convert "$source" -gravity center -background transparent -extent $PLAY_SIZE "$target"
+ fi
+done
+mv play/nb play/no-NO
+mv play/zh play/zh-CN
+mv play/zh_Hant play/zh-TW
+
+# readme: scale down
+for source in framed/en/*; do
+ if [[ -f "$source" ]]; then
+ target=${source/framed/readme}
+ echo "$source -> $target"
+ mkdir -p "$(dirname "$target")"
+ convert -resize 250x "$source" "$target"
+ fi
+done
diff --git a/scripts/update_flutter_version.sh b/scripts/update_flutter_version.sh
new file mode 100755
index 0000000..868c464
--- /dev/null
+++ b/scripts/update_flutter_version.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+if [ ! -d "scripts" ]; then
+ cd ..
+fi
+
+FILE_PATH="lib/flutter_version.dart"
+
+rm "$FILE_PATH"
+echo "Updating flutter_version.dart:"
+{
+ echo "const Map<String, String> version = "
+ ./flutterw --version --machine
+ echo ";"
+} >> "$FILE_PATH"
+cat "$FILE_PATH"