Class IOSMacCatalystPatches

java.lang.Object
com.iizix.run.common.IOSMacCatalystPatches

public class IOSMacCatalystPatches extends Object
Common Mac Catalyst linker patches for all iiziRun programs (Devel, Custom, Customized) that include FirebaseAnalytics via CocoaPods.

Problem. Firebase 11.14.0+ makes GoogleAdsOnDeviceConversion.xcframework a required transitive dependency of GoogleAppMeasurement/Default, but the xcframework ships only iOS-device and iOS-simulator slices -- no Mac Catalyst slice. Building for "My Mac (Mac Catalyst)" fails at link time with "Framework 'GoogleAdsOnDeviceConversion' not found". See firebase-ios-sdk#14995.

Why we patch post-build. cordova build ios internally re-runs cordova prepare, which regenerates the Podfile, which fires cordova-plugin-firebasex-core's after_prepare hook, which runs pod install and regenerates both the aggregate xcconfigs and Pods.xcodeproj. Any modification done BEFORE cordova build is wiped. This class must run AFTER cordova build completes so the changes survive into the next Xcode session where the user builds the Mac Catalyst target.

Two patches.

  1. Strip -framework "GoogleAdsOnDeviceConversion" (and -weak_framework variants) from OTHER_LDFLAGS in both Pods-App.debug.xcconfig and Pods-App.release.xcconfig. This removes the linker's search for the missing Catalyst slice.
  2. Add platformFilter = ios; to every PBXTargetDependency in Pods/Pods.xcodeproj/project.pbxproj that references the GoogleAdsOnDeviceConversion target. This prevents Xcode from trying to build/integrate the xcframework when the active destination is Mac Catalyst, while leaving iOS-device and iOS-simulator builds completely unaffected.
Removing the framework unconditionally is safe because iiziRun apps do not use Firebase Analytics on-device ad conversion measurement. Analytics degrades gracefully at runtime with a single log line ([FirebaseAnalytics][I-ACS023279] Conversion service disabled) and continues to function for event logging.

Callers. Invoked unconditionally from bin/ios-build-release.sh and bin/ios-build-debug.sh in iiziRunDevel (which always builds Mac Catalyst). Invoked from CommonBuilder for iiziRun Custom / ICU / BIG ACE only when RuntimeBuilderProps.build_mac_catalyst is true.

Author:
Christopher Mindus
  • Constructor Details

    • IOSMacCatalystPatches

      public IOSMacCatalystPatches()
  • Method Details

    • main

      public static void main(String[] args)
      Command-line entry point for the iiziRun Developer iOS build scripts.

      Exit codes: 0 = success, 1 = failure (stack trace on stderr).

      The current working directory must be the Cordova project root (the directory containing platforms/ios/). Arguments are currently ignored.

    • applyMacCatalystPatches

      public static void applyMacCatalystPatches(File appDir, Consumer<String> info, Consumer<String> warn) throws IOException
      Applies the two Mac Catalyst linker patches described in the class JavaDoc. Both patches are idempotent -- marker comments and platformFilter attribute presence mean re-running this method against already-patched artifacts is a no-op.

      Missing files/directories (e.g. platforms/ios/Pods/ absent because pod install never ran) produce WARN-level log lines but do NOT throw. This keeps the method safe to invoke even when an earlier build step failed.

      Parameters:
      appDir - The Cordova app directory (project root).
      info - Logs an informational message.
      warn - Logs a warning message.
      Throws:
      IOException - For I/O errors writing the modified files.