fix(cli): keep -fno-objc-arc libraries out of the noarc folder

RA
1mo ago
+54-2

Description

Fixes #8038.

When a Cordova plugin declares a static library with compiler-flags="-fno-objc-arc", for example <source-file src="src/ios/libFoo.a" framework="true" compiler-flags="-fno-objc-arc" />, cap update ios with CocoaPods copies the library into noarc/<Plugin>/, but the generated CordovaPlugins.podspec references it as sources/<Plugin>/libFoo.a in s.vendored_libraries. The library is never linked, and the Xcode build fails with Undefined symbols. The podspec also gets an empty noarc subspec.

compiler-flags has no effect on a prebuilt library, and Cordova ignores it in this case. This change does the same:

  • copyPluginsNativeFiles only moves a source file to noarc when it is not a framework="true" library, so the library stays at the sources/ path that the podspec references.
  • filterARCFiles ignores framework="true" libraries, so no noarc subspec is generated when no source file needs it.

Testing

Added a CocoaPods case to cli/test/update.ios.spec.ts that adds a -fno-objc-arc .a library to the test Cordova plugin, runs cap add ios --packagemanager CocoaPods, and checks that:

  • The podspec's s.vendored_libraries path exists on disk.
  • The podspec has no noarc subspec.

Both checks fail without the change and pass with it. npm test in cli passes (109 tests).