Compare commits
1 Commits
1112b04516
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 3574e60a8c |
+24
-5
@@ -6,12 +6,31 @@ ENV_FILE="env/prod.json"
|
|||||||
OUTPUT_DIR="build/outputs"
|
OUTPUT_DIR="build/outputs"
|
||||||
APK_SRC="build/app/outputs/flutter-apk/app-release.apk"
|
APK_SRC="build/app/outputs/flutter-apk/app-release.apk"
|
||||||
APK_DEST="$OUTPUT_DIR/rentaldrivego-release.apk"
|
APK_DEST="$OUTPUT_DIR/rentaldrivego-release.apk"
|
||||||
|
LOCAL_PROPERTIES="android/local.properties"
|
||||||
|
|
||||||
|
resolve_flutter() {
|
||||||
|
if command -v flutter &>/dev/null; then
|
||||||
|
command -v flutter
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "$LOCAL_PROPERTIES" ]]; then
|
||||||
|
local sdk_path
|
||||||
|
sdk_path="$(sed -n 's/^flutter\.sdk=//p' "$LOCAL_PROPERTIES" | head -n 1)"
|
||||||
|
if [[ -n "$sdk_path" && -x "$sdk_path/bin/flutter" ]]; then
|
||||||
|
echo "$sdk_path/bin/flutter"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# ── Checks ────────────────────────────────────────────────────────────────────
|
# ── Checks ────────────────────────────────────────────────────────────────────
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
if ! command -v flutter &>/dev/null; then
|
if ! FLUTTER_BIN="$(resolve_flutter)"; then
|
||||||
echo "❌ flutter not found in PATH"
|
echo "❌ flutter not found in PATH or $LOCAL_PROPERTIES"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -22,13 +41,13 @@ fi
|
|||||||
|
|
||||||
# ── Build ─────────────────────────────────────────────────────────────────────
|
# ── Build ─────────────────────────────────────────────────────────────────────
|
||||||
echo "▶ Cleaning previous build..."
|
echo "▶ Cleaning previous build..."
|
||||||
flutter clean
|
"$FLUTTER_BIN" clean
|
||||||
|
|
||||||
echo "▶ Fetching dependencies..."
|
echo "▶ Fetching dependencies..."
|
||||||
flutter pub get
|
"$FLUTTER_BIN" pub get
|
||||||
|
|
||||||
echo "▶ Building release APK (production)..."
|
echo "▶ Building release APK (production)..."
|
||||||
flutter build apk --release --dart-define-from-file="$ENV_FILE"
|
"$FLUTTER_BIN" build apk --release --dart-define-from-file="$ENV_FILE"
|
||||||
|
|
||||||
# ── Copy to output ────────────────────────────────────────────────────────────
|
# ── Copy to output ────────────────────────────────────────────────────────────
|
||||||
mkdir -p "$OUTPUT_DIR"
|
mkdir -p "$OUTPUT_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user