chahinebrini 579eb5b5e0 fix(deploy): ENOTEMPTY-Halbwipe von android/ verhindern
clean-ios.sh rief 'expo prebuild --clean' ohne --platform → wollte auch android/
löschen. Hält ein Gradle-Daemon android/build|.gradle offen, failt 'rmdir android'
mit ENOTEMPTY und hinterlässt ein halb-gewischtes android/ (Source weg, gelocktes
build/ bleibt) → späterer Release-Build failt mit "autolinking.json doesn't exist".

- clean-ios.sh: 'prebuild --clean --platform ios' → android/ wird beim iOS-Clean
  gar nicht mehr angefasst.
- deploy.sh: release_android_locks() (gradlew --stop + GradleDaemon-kill + rm
  build/.gradle) läuft vor dem android-prebuild --clean in ensure_native_dir.

Ergänzt den ensure_native_dir-Self-Healing-Fix (fe6a63b): jetzt wird der Halbwipe
nicht nur erkannt+repariert, sondern an der Quelle verhindert.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 08:00:20 +02:00

107 lines
3.5 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Rebreak Native: Nuclear iOS Clean + Rebuild
#
# Wann brauchst du das?
# - Build-Errors die nach Native-Code-Änderung aus dem Nichts kommen
# - "fmt consteval", "Hermes", "RCT-Folly" Compile-Errors in Pods
# - Stale DerivedData-Cache nach Xcode-Upgrade
# - Nach App-Bundle-ID/Entitlement-Änderungen
# - Nach Hinzufügen/Entfernen von Native Modules oder Config-Plugins
#
# Was es NICHT zerstört:
# - Code in app/, components/, modules/, plugins/ (alles was in git getrackt ist)
# - node_modules
#
# Was es zerstört:
# - ios/Pods, ios/Podfile.lock, ios/build (vollständig regeneriert via prebuild)
# - DerivedData-Cache von Xcode (wird beim nächsten Build neu aufgebaut)
#
# Modi:
# ./clean-ios.sh → clean + prebuild + pod install (kein Build)
# ./clean-ios.sh --build → + zusätzlich pnpm ios am Ende (wirft App auf Sim/Device)
# ./clean-ios.sh --xcode → + zum Schluss Xcode-Workspace öffnen
#
# Env:
# SKIP_PODS=1 → überspringt prebuild + pod install (nutze wenn Pods frisch sind)
# REBREAK_QUIET=1 → unterdrückt die "Nächste Schritte"-Hinweise am Ende
set -e
cd "$(dirname "$0")"
MODE=""
for arg in "$@"; do
case "$arg" in
--skip-pods) SKIP_PODS=1 ;;
--quiet) REBREAK_QUIET=1 ;;
*) MODE="$arg" ;;
esac
done
SKIP_PODS="${SKIP_PODS:-0}"
REBREAK_QUIET="${REBREAK_QUIET:-0}"
# FamilyControls-Flag: default ON für lokale Dev-Builds (= entitlement aktiv).
# Override via `REBREAK_ENABLE_FAMILY_CONTROLS=0 ./clean-ios.sh ...`.
# Wird von plugins/with-rebreak-protection-ios.js + app.config.ts gelesen.
export REBREAK_ENABLE_FAMILY_CONTROLS="${REBREAK_ENABLE_FAMILY_CONTROLS:-1}"
echo "🧹 Rebreak Native iOS Clean"
echo "==========================="
echo ""
# 1. Wipe Pods, Lockfile, Build-Output
echo "→ rm -rf ios/Pods ios/Podfile.lock ios/build"
rm -rf ios/Pods ios/Podfile.lock ios/build
# 2. Wipe Xcode DerivedData (nur für Rebreak — nicht das ganze ~/Library)
DERIVED_DATA="$HOME/Library/Developer/Xcode/DerivedData"
if [ -d "$DERIVED_DATA" ]; then
echo "→ rm -rf $DERIVED_DATA/Rebreak-*"
rm -rf "$DERIVED_DATA"/Rebreak-* 2>/dev/null || true
fi
if [ "$SKIP_PODS" = "1" ]; then
echo "⏭ SKIP_PODS=1 → prebuild + pod install übersprungen"
else
# 3. Prebuild: regeneriert ios/ aus app.config.ts + Config-Plugins
# Dank with-fmt-consteval-fix-Plugin wird das Podfile auto-gepatcht.
# ⚠️ --platform ios: NUR ios/ regenerieren, android/ NICHT anfassen. Ein
# 'prebuild --clean' ohne --platform will auch android/ löschen; hält ein
# Gradle-Daemon dort build/.gradle offen, failt das rmdir mit ENOTEMPTY und
# hinterlässt ein halb-gewischtes android/ (Source weg, gelocktes build/ bleibt).
echo "→ pnpm expo prebuild --clean --platform ios"
pnpm expo prebuild --clean --platform ios
# 4. Pod install
echo "→ cd ios && pod install"
(cd ios && pod install)
fi
echo ""
echo "✅ Clean done."
echo ""
case "$MODE" in
--build|build)
echo "🔨 Building + running on connected device/simulator..."
pnpm ios
;;
--xcode|xcode)
echo "🔨 Opening Xcode-Workspace..."
osascript -e 'tell application "Xcode" to close every window whose name contains "Rebreak.xcodeproj"' 2>/dev/null || true
open -a Xcode ios/Rebreak.xcworkspace
echo ""
echo " In Xcode: Cmd+R für Build & Run"
;;
"")
# no follow-up — clean done.
;;
*)
echo "Unknown mode: $MODE"
echo "Usage: ./clean-ios.sh [--build|--xcode]"
exit 1
;;
esac