- Introduced a new Flutter project for the cxyz Android manga/comic reader, including essential files such as pubspec.yaml, AndroidManifest.xml, and Gradle configuration. - Added .gitignore files to exclude unnecessary files and directories for both the main project and Android-specific files. - Implemented initial README.md with project description, features, setup instructions, and API details for ComicLand, MangaRead, and MangaTown. - Configured analysis options and dependencies in pubspec.yaml to support Flutter development. - Established a pnpm workspace and lockfile for dependency management. - Included various Android resources such as icons, styles, and launch backgrounds for a complete application setup.
58 lines
1.5 KiB
Bash
Executable File
58 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build cxyz Android APK and copy to a SOURCES-tagged filename.
|
|
#
|
|
# Usage:
|
|
# ./scripts/build_apk.sh
|
|
# ./scripts/build_apk.sh mangaread
|
|
# ./scripts/build_apk.sh all
|
|
# ./scripts/build_apk.sh comicland,mangaread,mangatown
|
|
# ./scripts/build_apk.sh mangaread --debug
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
SOURCES="${1:-comicland}"
|
|
MODE="release"
|
|
if [[ "${2:-}" == "--debug" ]] || [[ "${1:-}" == "--debug" ]]; then
|
|
MODE="debug"
|
|
if [[ "${1:-}" == "--debug" ]]; then
|
|
SOURCES="comicland"
|
|
fi
|
|
fi
|
|
|
|
# Normalize tag for filename: comicland,mangaread → comicland-mangaread
|
|
SOURCES_TAG="$(echo "$SOURCES" | tr '[:upper:]' '[:lower:]' | tr ',' '-' | tr -cd 'a-z0-9-')"
|
|
if [[ -z "$SOURCES_TAG" ]]; then
|
|
SOURCES_TAG="comicland"
|
|
SOURCES="comicland"
|
|
fi
|
|
|
|
REPO_ROOT="$(cd "$ROOT/.." && pwd)"
|
|
export PATH="${REPO_ROOT}/.tools/bin:${REPO_ROOT}/.tools/flutter-sdk/bin:${PATH:-}"
|
|
export CI=true BOT=true
|
|
|
|
echo "Building APK (SOURCES=${SOURCES}, mode=${MODE})…"
|
|
|
|
BUILD_ARGS=(build apk --dart-define="SOURCES=${SOURCES}")
|
|
if [[ "$MODE" == "debug" ]]; then
|
|
BUILD_ARGS+=(--debug)
|
|
fi
|
|
|
|
flutter "${BUILD_ARGS[@]}"
|
|
|
|
SRC_APK="build/app/outputs/flutter-apk/app-${MODE}.apk"
|
|
OUT_NAME="cxyz-${SOURCES_TAG}-${MODE}.apk"
|
|
OUT_APK="build/app/outputs/flutter-apk/${OUT_NAME}"
|
|
|
|
if [[ ! -f "$SRC_APK" ]]; then
|
|
echo "error: expected APK missing: $SRC_APK" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cp -f "$SRC_APK" "$OUT_APK"
|
|
|
|
echo
|
|
echo "APK: ${ROOT}/${OUT_APK}"
|
|
echo " (also ${SRC_APK})"
|