# Builds the Android app (android/) and packages a versioned release APK. # The OCR pipeline itself (tooling-container/, 0-3_*.sh, test_batch.sh) is # container-only and has no host build step, so this Makefile only covers # the Android app. ANDROID_DIR := android ANDROID_APK := $(ANDROID_DIR)/app/build/outputs/apk/debug/app-debug.apk DIST_DIR := dist .PHONY: all android clean all: android # Builds the Android app (`./gradlew assembleDebug` in android/, via its # own Gradle/AGP toolchain) and copies the resulting debug APK into # dist/, named with the current git tag, or `make android VERSION=1.2.3` # to override. Untagged builds (including every CI build, unless a # release tag is pushed) get a 0.0.0-dev+ placeholder version. # Ships the auto-generated debug keystore, not a release signing config - # fine for sideloading; a real release signing setup is a separate, # not-yet-needed step. Requires the Android SDK (ANDROID_HOME set) - see # build-image/Dockerfile for the exact version this is built/tested # against, or run this inside it via ./run-image.sh. android: cd $(ANDROID_DIR) && ./gradlew assembleDebug @mkdir -p $(DIST_DIR) @V="$(VERSION)"; \ if [ -z "$$V" ]; then \ if TAG=$$(git describe --tags --exact-match --match 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null); then \ V=$${TAG#v}; \ else \ V="0.0.0-dev+$$(git rev-parse --short HEAD)"; \ echo "WARNING: HEAD is not on a vX.Y.Z tag - building placeholder version $$V (push a tag to drive a real release version)" >&2; \ fi; \ fi; \ case "$$V" in \ [0-9]*.[0-9]*.[0-9]*) ;; \ *) echo "PREFLIGHT FAIL: VERSION '$$V' is not a semantic version (expected X.Y.Z, optionally with a -pre+meta suffix)" >&2; exit 1;; \ esac; \ APK_NAME="fuelish-$$V.apk"; \ cp $(ANDROID_APK) "$(DIST_DIR)/$$APK_NAME"; \ echo "Wrote $(DIST_DIR)/$$APK_NAME" clean: rm -rf $(DIST_DIR) $(ANDROID_DIR)/build $(ANDROID_DIR)/app/build