fix(build): add macOS compatibility for sed commands in build scripts
- Fix sed -i syntax differences between macOS and Linux - macOS requires empty string after -i flag: sed -i '' 'pattern' file - Linux uses: sed -i 'pattern' file - Add OSTYPE detection to handle both platforms correctly - Fixes build script failures on macOS systems Resolves: sed command a expects \ followed by text error on macOS
This commit is contained in:
@@ -120,7 +120,14 @@ build_android() {
|
||||
log_info " Fix: Commenting out problematic 'apply from' line"
|
||||
|
||||
# Apply the fix by commenting out the problematic line
|
||||
sed -i 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "app/capacitor.build.gradle"
|
||||
# Handle macOS vs Linux sed differences
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# macOS sed requires empty string after -i
|
||||
sed -i '' 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "app/capacitor.build.gradle"
|
||||
else
|
||||
# Linux sed
|
||||
sed -i 's/^apply from: "\.\.\/capacitor-cordova-android-plugins\/cordova\.variables\.gradle"/\/\/ Plugin development project - no Capacitor integration files needed\n\/\/ &/' "app/capacitor.build.gradle"
|
||||
fi
|
||||
|
||||
log_info "✅ Fix applied successfully"
|
||||
log_warn "⚠️ Note: This fix will be lost if you run 'npx cap sync' or 'npx cap update'"
|
||||
|
||||
Reference in New Issue
Block a user