Files
bookMgr-client/scripts/patch-android-signing.sh
T
msksbr 6c90b09ef7 chore: clean up generated files and update gitignore
- remove api-docs.json from version control
- add src-tauri/gen/ to gitignore
2026-05-24 23:35:17 +08:00

29 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Patch the generated Android build.gradle.kts with signing configuration.
# Run this after `tauri android init` if the signing config is missing.
set -euo pipefail
BUILD_FILE="src-tauri/gen/android/app/build.gradle.kts"
SIGNING_FILE="src-tauri/android-signing.gradle.kts"
if [ ! -f "$BUILD_FILE" ]; then
echo "Error: $BUILD_FILE not found. Run 'tauri android init' first."
exit 1
fi
# Check if signing is already configured
if grep -q "keystoreProperties" "$BUILD_FILE" 2>/dev/null; then
echo "Signing already configured in $BUILD_FILE"
exit 0
fi
# Insert signing config block: find `signingConfigs` or add it before `buildTypes`,
# then add `signingConfig` to the release buildType.
# Strategy: replace the entire android block content using the external apply approach.
# Inject the apply-line at end of file (before the tauri.build.gradle.kts apply)
sed -i 's|apply(from = "tauri.build.gradle.kts")|apply(from = "../../../android-signing.gradle.kts")\napply(from = "tauri.build.gradle.kts")|' "$BUILD_FILE"
echo "Signing config patched into $BUILD_FILE"