experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: add Android build scripts and configuration

+280 -1
+112
backend/tauri-mobile/build-android-release.sh
··· 1 + #!/bin/bash 2 + # Script to build for Android device (release) 3 + # Analogous to build-release.sh for iOS device 4 + # 5 + # Target: aarch64-linux-android (ARM64 device) 6 + # Produces an APK or AAB for distribution 7 + # 8 + # Usage: ./build-android-release.sh [--force|-f] [--aab] 9 + 10 + set -e 11 + 12 + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" 13 + TAURI_DIR="$SCRIPT_DIR/src-tauri" 14 + 15 + # Ensure ANDROID_HOME and JAVA_HOME are set 16 + if [ -z "$ANDROID_HOME" ]; then 17 + export ANDROID_HOME="$HOME/Library/Android/sdk" 18 + fi 19 + 20 + if [ -z "$JAVA_HOME" ]; then 21 + if [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then 22 + export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" 23 + fi 24 + fi 25 + 26 + # Find NDK 27 + if [ -z "$NDK_HOME" ]; then 28 + NDK_VERSION=$(ls "$ANDROID_HOME/ndk/" 2>/dev/null | sort -V | tail -1) 29 + if [ -n "$NDK_VERSION" ]; then 30 + export NDK_HOME="$ANDROID_HOME/ndk/$NDK_VERSION" 31 + fi 32 + fi 33 + 34 + # Validate environment 35 + if [ ! -d "$ANDROID_HOME" ]; then 36 + echo "ERROR: Android SDK not found at $ANDROID_HOME" 37 + echo "Install Android Studio or set ANDROID_HOME" 38 + exit 1 39 + fi 40 + 41 + if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then 42 + echo "ERROR: JAVA_HOME not found" 43 + echo "Install Android Studio or set JAVA_HOME" 44 + exit 1 45 + fi 46 + 47 + if [ -z "$NDK_HOME" ] || [ ! -d "$NDK_HOME" ]; then 48 + echo "ERROR: Android NDK not found" 49 + echo "Install NDK via Android Studio SDK Manager" 50 + exit 1 51 + fi 52 + 53 + echo "ANDROID_HOME=$ANDROID_HOME" 54 + echo "JAVA_HOME=$JAVA_HOME" 55 + echo "NDK_HOME=$NDK_HOME" 56 + 57 + # Parse flags 58 + FORCE_REBUILD=false 59 + BUILD_AAB=false 60 + while [ $# -gt 0 ]; do 61 + case "$1" in 62 + --force|-f) 63 + FORCE_REBUILD=true 64 + ;; 65 + --aab) 66 + BUILD_AAB=true 67 + ;; 68 + *) 69 + echo "Unknown option: $1" 70 + echo "Usage: $0 [--force|-f] [--aab]" 71 + exit 1 72 + ;; 73 + esac 74 + shift 75 + done 76 + 77 + cd "$SCRIPT_DIR" 78 + 79 + if [ "$FORCE_REBUILD" = true ]; then 80 + echo "(Forcing Rust recompile...)" 81 + touch "$TAURI_DIR/src/lib.rs" 82 + fi 83 + 84 + # Ensure local.properties exists 85 + if [ ! -f "$TAURI_DIR/gen/android/local.properties" ]; then 86 + echo "sdk.dir=$ANDROID_HOME" > "$TAURI_DIR/gen/android/local.properties" 87 + echo "Created local.properties" 88 + fi 89 + 90 + echo "Building frontend..." 91 + npm run build 92 + 93 + # custom-protocol is required so Tauri serves bundled assets 94 + export TAURI_ANDROID_FEATURES="custom-protocol" 95 + 96 + if [ "$BUILD_AAB" = true ]; then 97 + echo "Building Android release AAB (App Bundle for Play Store)..." 98 + npx tauri android build --aab 99 + echo "" 100 + echo "Done! Release AAB built." 101 + echo "AAB location: src-tauri/gen/android/app/build/outputs/bundle/release/" 102 + else 103 + echo "Building Android release APK..." 104 + npx tauri android build --apk 105 + echo "" 106 + echo "Done! Release APK built." 107 + echo "APK location: src-tauri/gen/android/app/build/outputs/apk/release/" 108 + fi 109 + 110 + echo "" 111 + echo "For Play Store distribution, use --aab flag for App Bundle format." 112 + echo "For sideloading, the APK can be installed with: adb install <path-to-apk>"
+98
backend/tauri-mobile/build-android.sh
··· 1 + #!/bin/bash 2 + # Script to build for Android emulator (debug) 3 + # Analogous to build-ios.sh for iOS simulator 4 + # 5 + # Target: x86_64-linux-android (emulator on x86_64 host) 6 + # Also builds aarch64-linux-android for ARM emulator images 7 + # 8 + # Usage: ./build-android.sh [--force|-f] 9 + 10 + set -e 11 + 12 + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" 13 + TAURI_DIR="$SCRIPT_DIR/src-tauri" 14 + 15 + # Ensure ANDROID_HOME and JAVA_HOME are set 16 + if [ -z "$ANDROID_HOME" ]; then 17 + export ANDROID_HOME="$HOME/Library/Android/sdk" 18 + fi 19 + 20 + if [ -z "$JAVA_HOME" ]; then 21 + if [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then 22 + export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" 23 + fi 24 + fi 25 + 26 + # Find NDK 27 + if [ -z "$NDK_HOME" ]; then 28 + NDK_VERSION=$(ls "$ANDROID_HOME/ndk/" 2>/dev/null | sort -V | tail -1) 29 + if [ -n "$NDK_VERSION" ]; then 30 + export NDK_HOME="$ANDROID_HOME/ndk/$NDK_VERSION" 31 + fi 32 + fi 33 + 34 + # Validate environment 35 + if [ ! -d "$ANDROID_HOME" ]; then 36 + echo "ERROR: Android SDK not found at $ANDROID_HOME" 37 + echo "Install Android Studio or set ANDROID_HOME" 38 + exit 1 39 + fi 40 + 41 + if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then 42 + echo "ERROR: JAVA_HOME not found" 43 + echo "Install Android Studio or set JAVA_HOME" 44 + exit 1 45 + fi 46 + 47 + if [ -z "$NDK_HOME" ] || [ ! -d "$NDK_HOME" ]; then 48 + echo "ERROR: Android NDK not found" 49 + echo "Install NDK via Android Studio SDK Manager" 50 + exit 1 51 + fi 52 + 53 + echo "ANDROID_HOME=$ANDROID_HOME" 54 + echo "JAVA_HOME=$JAVA_HOME" 55 + echo "NDK_HOME=$NDK_HOME" 56 + 57 + # Parse flags 58 + FORCE_REBUILD=false 59 + while [ $# -gt 0 ]; do 60 + case "$1" in 61 + --force|-f) 62 + FORCE_REBUILD=true 63 + ;; 64 + *) 65 + echo "Unknown option: $1" 66 + echo "Usage: $0 [--force|-f]" 67 + exit 1 68 + ;; 69 + esac 70 + shift 71 + done 72 + 73 + cd "$SCRIPT_DIR" 74 + 75 + if [ "$FORCE_REBUILD" = true ]; then 76 + echo "(Forcing Rust recompile...)" 77 + touch "$TAURI_DIR/src/lib.rs" 78 + fi 79 + 80 + # Ensure local.properties exists 81 + if [ ! -f "$TAURI_DIR/gen/android/local.properties" ]; then 82 + echo "sdk.dir=$ANDROID_HOME" > "$TAURI_DIR/gen/android/local.properties" 83 + echo "Created local.properties" 84 + fi 85 + 86 + echo "Building frontend..." 87 + npm run build 88 + 89 + echo "Building Android debug APK..." 90 + # custom-protocol is required so Tauri serves bundled assets via scheme handler 91 + # Tauri's android build handles cargo cross-compilation and Gradle packaging 92 + export TAURI_ANDROID_FEATURES="custom-protocol" 93 + npx tauri android build --debug 94 + 95 + echo "" 96 + echo "Done! Debug APK built." 97 + echo "Install on emulator: adb install <path-to-apk>" 98 + echo "APK location: src-tauri/gen/android/app/build/outputs/apk/debug/"
+62
backend/tauri-mobile/dev-android.sh
··· 1 + #!/bin/bash 2 + # Start Android emulator dev environment with HMR 3 + # Analogous to dev-ios-sim.sh for iOS simulator 4 + # 5 + # Usage: ./dev-android.sh 6 + 7 + set -e 8 + 9 + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" 10 + TAURI_DIR="$SCRIPT_DIR/src-tauri" 11 + 12 + # Ensure ANDROID_HOME and JAVA_HOME are set 13 + if [ -z "$ANDROID_HOME" ]; then 14 + export ANDROID_HOME="$HOME/Library/Android/sdk" 15 + fi 16 + 17 + if [ -z "$JAVA_HOME" ]; then 18 + if [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then 19 + export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" 20 + fi 21 + fi 22 + 23 + # Find NDK 24 + if [ -z "$NDK_HOME" ]; then 25 + NDK_VERSION=$(ls "$ANDROID_HOME/ndk/" 2>/dev/null | sort -V | tail -1) 26 + if [ -n "$NDK_VERSION" ]; then 27 + export NDK_HOME="$ANDROID_HOME/ndk/$NDK_VERSION" 28 + fi 29 + fi 30 + 31 + # Validate environment 32 + if [ ! -d "$ANDROID_HOME" ]; then 33 + echo "ERROR: Android SDK not found at $ANDROID_HOME" 34 + echo "Install Android Studio or set ANDROID_HOME" 35 + exit 1 36 + fi 37 + 38 + if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then 39 + echo "ERROR: JAVA_HOME not found" 40 + echo "Install Android Studio or set JAVA_HOME" 41 + exit 1 42 + fi 43 + 44 + echo "ANDROID_HOME=$ANDROID_HOME" 45 + echo "JAVA_HOME=$JAVA_HOME" 46 + echo "NDK_HOME=$NDK_HOME" 47 + 48 + # Ensure local.properties exists 49 + if [ ! -f "$TAURI_DIR/gen/android/local.properties" ]; then 50 + echo "sdk.dir=$ANDROID_HOME" > "$TAURI_DIR/gen/android/local.properties" 51 + echo "Created local.properties" 52 + fi 53 + 54 + cd "$SCRIPT_DIR" 55 + 56 + echo "Starting Android dev environment..." 57 + echo "Tauri will build frontend, compile Rust, and launch on emulator with HMR" 58 + echo "" 59 + 60 + # custom-protocol needed for asset serving 61 + export TAURI_ANDROID_FEATURES="custom-protocol" 62 + npx tauri android dev
+8 -1
backend/tauri-mobile/package.json
··· 35 35 "sim:install": "xcrun simctl install booted '/tmp/peek-xcodebuild-sim/Build/Products/debug-iphonesimulator/Peek Save.app'", 36 36 "xcode:clean": "cd src-tauri/gen/apple && xcodebuild -scheme peek-save_iOS -configuration Debug -sdk iphonesimulator -derivedDataPath /tmp/peek-xcodebuild-sim -destination 'platform=iOS Simulator,name=iPhone 17 Pro' clean", 37 37 "xcode:build": "rm -rf /tmp/peek-xcodebuild-sim && cd src-tauri/gen/apple && xcodebuild -scheme peek-save_iOS -configuration Debug -sdk iphonesimulator -derivedDataPath /tmp/peek-xcodebuild-sim -destination 'platform=iOS Simulator,name=iPhone 17 Pro' clean build", 38 - "build:share-ext": "src-tauri/gen/apple/build-share-ext.sh" 38 + "build:share-ext": "src-tauri/gen/apple/build-share-ext.sh", 39 + "build:android": "./build-android.sh", 40 + "build:android:force": "./build-android.sh --force", 41 + "build:android:release": "./build-android-release.sh", 42 + "build:android:release:force": "./build-android-release.sh --force", 43 + "build:android:aab": "./build-android-release.sh --aab", 44 + "dev:android": "./dev-android.sh", 45 + "clean:android": "cd src-tauri && rm -rf target/aarch64-linux-android target/x86_64-linux-android target/i686-linux-android target/armv7-linux-androideabi 2>/dev/null; echo 'Android build cache cleaned'" 39 46 }, 40 47 "dependencies": { 41 48 "@tauri-apps/api": "^2.10.1",