feat: add preflight checks and version extraction

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-11 04:15:37 -04:00
parent 2cb901b77c
commit 9b3e943eea

View File

@@ -34,6 +34,32 @@ success() { echo -e "${GREEN}✓${NC} $1"; }
warn() { echo -e "${YELLOW}${NC} $1"; } warn() { echo -e "${YELLOW}${NC} $1"; }
error() { echo -e "${RED}${NC} $1"; } error() { echo -e "${RED}${NC} $1"; }
get_version_name() {
grep 'versionName' "$GRADLE_BUILD_FILE" | head -1 | sed 's/.*"\(.*\)".*/\1/'
}
preflight_check() {
local ok=true
if ! command -v java &>/dev/null && [[ -z "${JAVA_HOME:-}" ]]; then
error "Java not found. Install JDK 17+ or set JAVA_HOME."
ok=false
fi
if [[ ! -x "./gradlew" ]]; then
error "Gradle wrapper not found or not executable."
ok=false
fi
if [[ "$ok" != true ]]; then
exit 1
fi
}
ensure_dist_dir() {
mkdir -p "$DIST_DIR"
}
main_menu() { main_menu() {
echo -e "${BOLD}What would you like to do?${NC}" echo -e "${BOLD}What would you like to do?${NC}"
echo "" echo ""
@@ -63,6 +89,7 @@ manage_keystore() { warn "Not yet implemented"; }
clean_build() { warn "Not yet implemented"; } clean_build() { warn "Not yet implemented"; }
# --- Main --- # --- Main ---
preflight_check
banner banner
while true; do while true; do
main_menu main_menu