Skip to content

Support xcconfig file from plugin #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Fatme opened this issue Sep 7, 2015 · 8 comments
Closed

Support xcconfig file from plugin #883

Fatme opened this issue Sep 7, 2015 · 8 comments
Assignees
Labels
Milestone

Comments

@Fatme
Copy link
Contributor

Fatme commented Sep 7, 2015

The .xcconfig file should be in platforms/ios folder of the plugin and will be included into native project's xcconfig file.

@Fatme Fatme added the feature label Sep 7, 2015
@Fatme Fatme added this to the 1.4.0 milestone Sep 7, 2015
@jasssonpet jasssonpet self-assigned this Sep 12, 2015
jasssonpet added a commit that referenced this issue Sep 15, 2015
@Fatme Fatme reopened this Sep 16, 2015
@ligaz ligaz modified the milestones: 1.4.0 (Under review), 1.3.1 Sep 17, 2015
@jasssonpet
Copy link
Contributor

It turns out that now the CocoaPods xcconfig overrides the default one and the build fails.

@jasssonpet
Copy link
Contributor

I've moved the nativescript xcconfig to the project level, and Cocoapods uses the target xcconfig so everything should work now - NativeScript/ios-jsc#322

@jasssonpet
Copy link
Contributor

At the moment there is an issue, that only one plugin with xcconfig is supported. This is because at a given level (target or project), only the last assignment of Xcode flags is preserved. The $(inherited) value works only for parent settings, not for previous ones.

This conflicts occur also not only between plugins with xcconfig files, but also with CocoaPods (which uses xcconfig files) and now with the iOS runtime also.

A possible solution is that we merge the build setting flags from all plugins in a single variable assignment. For example:

  • plugin-1.xcconfig: OTHER_LDFLAGS -framework "CoreGraphics"
  • plugin-2.xcconfig: OTHER_LDFLAGS -l"sqlite3"
  • build.xcconfig: OTHER_LDFLAGS -framework "CoreGraphics" -l"sqlite3"

This is what CocoaPods is doing: https://guides.cocoapods.org/syntax/podspec.html#pod_target_xcconfig.

@jasssonpet
Copy link
Contributor

After some more discussion with @fealebenpae we have a new proposal:

Instead of a xcconfig file, each plugin could have a .json file that looks something like:

{
  "OTHER_LDFLAGS": "-framework CoreGraphics"
}

This would make processing the file easier.

On prepare we should modify the application build.xcconfig to look like:

OTHER_LDFLAGS _<PLUGIN_NAME> = -framework CoreGraphics
OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_<PLUGIN_NAME>)

The extra variable is in order to make removing plugins safely possible.

@Fatme I would appreciate hearing your thoughts on this.

@ligaz
Copy link

ligaz commented Sep 29, 2015

Isn't it better if we say that the only way to support this is via Cocoapods? If you have a plugin that requires compiler flag changes wrap it in a pod and give it to us.

@fealebenpae
Copy link
Contributor

Does CocoaPods support binary-only pods? That is to say, if you only have a static library from a vendor, say TelerikUI, can you wrap that in a pod?

@ligaz
Copy link

ligaz commented Sep 30, 2015

It looks like this according to this issue. Also there is support for vendored_frameworks and vendored_libraries as mentioned in the Changelog.

@vchimev
Copy link

vchimev commented Oct 21, 2015

Issue 1:

VCHIMEVMAC:Work vchimev$ node_modules/.bin/tns plugin add plugin/xcconfig-plugin --path app123
npm WARN package.json @ No description
npm WARN package.json @ No repository field.
npm WARN package.json @ No README data
[email protected] app123/node_modules/xcconfig-plugin
Successfully installed plugin xcconfig-plugin.
VCHIMEVMAC:Work vchimev$ cat app123/package.json 
{
  "nativescript": {
    "id": "org.nativescript.app123",
    "tns-ios": {
      "version": "1.4.1"
    }
  },
  "dependencies": {
    "tns-core-modules": "1.4.0",
    "xcconfig-plugin": "file:plugin/xcconfig-plugin"
  }
}
VCHIMEVMAC:Work vchimev$ 
VCHIMEVMAC:Work vchimev$ 
VCHIMEVMAC:Work vchimev$ node_modules/.bin/tns run ios --path app123
Successfully prepared plugin xcconfig-plugin for ios.
Processing node_modules failed. Error:Error: EISDIR, read

Issue 2:
After adding plugin which contains Podfile and prepare the project, plugin-debug.xcconfig and plugin-release.xcconfig disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants