Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

add ipa and bundle build modes

Prateek Sunal6344348ff7ef
diff --git a/mobile/native/android/apps/ensu/README.md b/mobile/native/android/apps/ensu/README.md
index e4d1ff53de..953c825205 100644
--- a/mobile/native/android/apps/ensu/README.md
+++ b/mobile/native/android/apps/ensu/README.md
@@ -16,6 +16,7 @@ From `mobile/native/android/apps/ensu`:
```bash
./build.sh # builds Rust + debug APK
./build.sh release # builds Rust + release APK
+./build.sh bundle # builds Rust + release AAB (app bundle)
./run.sh # builds + installs + launches on connected adb device
```
@@ -24,6 +25,7 @@ Helpful flags:
- `--skip-rust` to skip Rust/jni rebuild
- `--endpoint <url>` to set `ENTE_API_ENDPOINT`
- `--device <serial>` for `run.sh`
+- mode aliases: `release-apk` and `release-aab`
Run `./build.sh --help` or `./run.sh --help` for full options.
diff --git a/mobile/native/android/apps/ensu/build.sh b/mobile/native/android/apps/ensu/build.sh
index 2ef8e6feb5..c454d05435 100755
--- a/mobile/native/android/apps/ensu/build.sh
+++ b/mobile/native/android/apps/ensu/build.sh
@@ -14,7 +14,14 @@ usage() {
Build Ensu Android app.
Usage:
- ./build.sh [debug|release] [options]
+ ./build.sh [debug|release|release-apk|bundle|release-aab] [options]
+
+Modes:
+ debug Build debug APK
+ release Build release APK
+ release-apk Alias for release
+ bundle Build release Android App Bundle (.aab)
+ release-aab Alias for bundle
Options:
--skip-rust Skip Rust/jni build step
@@ -25,13 +32,14 @@ Options:
Examples:
./build.sh
./build.sh release
+ ./build.sh bundle
./build.sh debug --endpoint https://api.example.com
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
- debug|release)
+ debug|release|release-apk|bundle|release-aab)
MODE="$1"
shift
;;
@@ -75,15 +83,25 @@ fi
if [[ "$SKIP_APP" -eq 0 ]]; then
cd "$ROOT"
- if [[ "$MODE" == "release" ]]; then
- TASK=":app-ui:assembleRelease"
- APK_PATH="app-ui/build/outputs/apk/release/app-ui-release.apk"
- else
- TASK=":app-ui:assembleDebug"
- APK_PATH="app-ui/build/outputs/apk/debug/app-ui-debug.apk"
- fi
+ case "$MODE" in
+ release|release-apk)
+ TASK=":app-ui:assembleRelease"
+ OUTPUT_LABEL="APK"
+ OUTPUT_PATH="app-ui/build/outputs/apk/release/app-ui-release.apk"
+ ;;
+ bundle|release-aab)
+ TASK=":app-ui:bundleRelease"
+ OUTPUT_LABEL="AAB"
+ OUTPUT_PATH="app-ui/build/outputs/bundle/release/app-ui-release.aab"
+ ;;
+ *)
+ TASK=":app-ui:assembleDebug"
+ OUTPUT_LABEL="APK"
+ OUTPUT_PATH="app-ui/build/outputs/apk/debug/app-ui-debug.apk"
+ ;;
+ esac
echo "==> Running Gradle task $TASK"
./gradlew "$TASK"
- echo "βœ… APK: $ROOT/$APK_PATH"
+ echo "βœ… $OUTPUT_LABEL: $ROOT/$OUTPUT_PATH"
fi
diff --git a/mobile/native/darwin/Apps/ensu/README.md b/mobile/native/darwin/Apps/ensu/README.md
index 761ee3aa94..df450c9e16 100644
--- a/mobile/native/darwin/Apps/ensu/README.md
+++ b/mobile/native/darwin/Apps/ensu/README.md
@@ -9,7 +9,8 @@ All commands below assume you run them from `darwin/Apps/ensu`.
```bash
./build.sh # Debug build for iOS simulator (prefers booted iPhone)
./build.sh device # Debug build for connected iOS device
-./build.sh archive # Release archive
+./build.sh archive # Release archive (.xcarchive)
+./build.sh ipa # Release IPA export (uses ExportOptions-AppStore.plist)
./run.sh # Build + install + launch on iOS simulator (prefers booted iPhone)
```
@@ -17,6 +18,7 @@ Helpful flags:
- `--destination-id <id>` to force a specific simulator/device
- `--endpoint <url>` to set `ENTE_API_ENDPOINT`
+- `--archive-path`, `--export-path`, `--export-options-plist` for release flows
- `--skip-build` for `run.sh`
Run `./build.sh --help` or `./run.sh --help` for full options.
@@ -104,6 +106,8 @@ xcrun devicectl device install app \
### Release (IPA)
Install the exported IPA via Apple Configurator or TestFlight after `xcodebuild -exportArchive`.
+Note: App Store IPA export requires valid distribution signing certificate/profile on this machine.
+
## Custom API Endpoint
Set the endpoint at build time using `ENTE_API_ENDPOINT`. If it is not set, the app defaults to `https://api.ente.io`.
diff --git a/mobile/native/darwin/Apps/ensu/build.sh b/mobile/native/darwin/Apps/ensu/build.sh
index bb2cc7829f..bf6cb50764 100755
--- a/mobile/native/darwin/Apps/ensu/build.sh
+++ b/mobile/native/darwin/Apps/ensu/build.sh
@@ -9,29 +9,37 @@ DERIVED_DATA_PATH="$ROOT/build"
MODE="sim"
DESTINATION_ID=""
ENDPOINT=""
+ARCHIVE_PATH="$DERIVED_DATA_PATH/Archive/ensu.xcarchive"
+EXPORT_PATH="$DERIVED_DATA_PATH/Export"
+EXPORT_OPTIONS_PLIST="$ROOT/ExportOptions-AppStore.plist"
usage() {
cat <<'EOF'
Build Ensu Apple app.
Usage:
- ./build.sh [sim|device|archive] [options]
+ ./build.sh [sim|device|archive|ipa] [options]
Modes:
sim Debug build for iOS simulator (default, prefers booted iPhone)
device Debug build for connected iOS device
- archive Release archive for App Store/TestFlight flow
+ archive Release archive (.xcarchive)
+ ipa Build + export IPA using ExportOptions plist
Options:
- --destination-id <id> Force specific destination id (sim/device)
- --endpoint <url> Set ENTE_API_ENDPOINT for this build
- -h, --help Show help
+ --destination-id <id> Force specific destination id (sim/device)
+ --endpoint <url> Set ENTE_API_ENDPOINT for this build
+ --archive-path <path> Override archive output path
+ --export-path <path> Override IPA export directory (ipa mode)
+ --export-options-plist <path> Override export options plist (ipa mode)
+ -h, --help Show help
Examples:
./build.sh
./build.sh sim
./build.sh device
./build.sh archive
+ ./build.sh ipa
EOF
}
@@ -107,7 +115,7 @@ pick_destination_id() {
while [[ $# -gt 0 ]]; do
case "$1" in
- sim|device|archive)
+ sim|device|archive|ipa)
MODE="$1"
shift
;;
@@ -127,6 +135,30 @@ while [[ $# -gt 0 ]]; do
fi
shift 2
;;
+ --archive-path)
+ ARCHIVE_PATH="${2:-}"
+ if [[ -z "$ARCHIVE_PATH" ]]; then
+ echo "Missing value for --archive-path" >&2
+ exit 1
+ fi
+ shift 2
+ ;;
+ --export-path)
+ EXPORT_PATH="${2:-}"
+ if [[ -z "$EXPORT_PATH" ]]; then
+ echo "Missing value for --export-path" >&2
+ exit 1
+ fi
+ shift 2
+ ;;
+ --export-options-plist)
+ EXPORT_OPTIONS_PLIST="${2:-}"
+ if [[ -z "$EXPORT_OPTIONS_PLIST" ]]; then
+ echo "Missing value for --export-options-plist" >&2
+ exit 1
+ fi
+ shift 2
+ ;;
-h|--help)
usage
exit 0
@@ -145,6 +177,20 @@ if [[ -n "$ENDPOINT" ]]; then
export ENTE_API_ENDPOINT="$ENDPOINT"
fi
+build_archive() {
+ mkdir -p "$(dirname "$ARCHIVE_PATH")"
+ echo "==> Building Release archive"
+ xcodebuild \
+ -project "$PROJECT" \
+ -scheme "$SCHEME" \
+ -configuration Release \
+ -sdk iphoneos \
+ -destination 'generic/platform=iOS' \
+ -archivePath "$ARCHIVE_PATH" \
+ archive
+ echo "βœ… Archive: $ARCHIVE_PATH"
+}
+
case "$MODE" in
sim)
if [[ -z "$DESTINATION_ID" ]]; then
@@ -186,15 +232,30 @@ case "$MODE" in
-derivedDataPath "$DERIVED_DATA_PATH"
;;
archive)
- echo "==> Building Release archive"
+ build_archive
+ ;;
+ ipa)
+ if [[ ! -f "$EXPORT_OPTIONS_PLIST" ]]; then
+ echo "Export options plist not found: $EXPORT_OPTIONS_PLIST" >&2
+ exit 1
+ fi
+
+ build_archive
+
+ mkdir -p "$EXPORT_PATH"
+ echo "==> Exporting IPA"
xcodebuild \
- -project "$PROJECT" \
- -scheme "$SCHEME" \
- -configuration Release \
- -sdk iphoneos \
- -destination 'generic/platform=iOS' \
- -archivePath "$DERIVED_DATA_PATH/Archive/ensu.xcarchive" \
- archive
+ -exportArchive \
+ -archivePath "$ARCHIVE_PATH" \
+ -exportPath "$EXPORT_PATH" \
+ -exportOptionsPlist "$EXPORT_OPTIONS_PLIST"
+
+ IPA_PATH="$(find "$EXPORT_PATH" -maxdepth 1 -type f -name '*.ipa' | head -n 1 || true)"
+ if [[ -n "$IPA_PATH" ]]; then
+ echo "βœ… IPA: $IPA_PATH"
+ else
+ echo "βœ… Exported to: $EXPORT_PATH"
+ fi
;;
esac