Skip to content

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

Open
RaphaelFakhri wants to merge 1 commit into
ionic-team:mainfrom
RaphaelFakhri:fix/cli-ios-noarc-libraries
Open

RaphaelFakhri wants to merge 1 commit into
ionic-team:mainfrom
RaphaelFakhri:fix/cli-ios-noarc-libraries

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

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).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CordovaPlugins.podspec vendored_libraries path

1 participant