Skip to content
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

CLI merges xcconfig files only for specified build configuration #4561

Closed
rosen-vladimirov opened this issue Apr 23, 2019 · 0 comments
Closed
Assignees
Milestone

Comments

@rosen-vladimirov
Copy link
Contributor

rosen-vladimirov commented Apr 23, 2019

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.3.3
  • Cross-platform modules: Not applicable
  • Android Runtime: Not applicable
  • iOS Runtime: Not applicable
  • Plugin(s): any plugin with Podfile, preferably nativescript-socket.io
  • Cocoapods version: 1.6.1

Describe the bug

During project preparation CLI merges xcconfig files, but it does it only for the currently passed build configuration, i.e. debug or release. This leads to different problems:

Setting SWIFT_VERSION in project's build.xcconfig breaks build for iOS

With Cocoapods 1.6.x there are some differences in case Pods with Swift code are handled. Previously users were able to have post_install task in the Podfile in which to set Swift version for specified Pod. Now, this is not working and projects which have such Pods cannot be build. One easy workaround is to set SWIFT_VERSION in App_Resources/iOS/build.xcconfig, however this leads to error:

Copying template files...
Platform ios successfully added. v5.3.1
Preparing project...
Successfully prepared plugin nativescript-socket.io for ios.
Successfully prepared plugin nativescript-theme-core for ios.
Successfully prepared plugin tns-core-modules for ios.
Successfully prepared plugin tns-core-modules-widgets for ios.
Installing pods...
Analyzing dependencies
[!] There may only be up to 1 unique SWIFT_VERSION per target. Found target(s) with multiple Swift versions:
myApp: Swift 
myApp: Swift 4.0

[!] Automatically assigning platform `ios` with version `9.0` on target `myApp` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
'pod install' command failed.

The problem is that CLI prepares the project only for one build configuration, i.e. debug or release, but Cocoapods check the SWIFT_VERSION value in both configurations. As CLI had not prepared the project for release build, the value in the release target is not set, so Cocoapods fail.

Unable to find included file "../plugins-release.xcconfig" file error in Xcode

In case you create a project with NativeScript CLI and build it for iOS, you can safely open the .xcworkspace/.xcodeproject in <project dir>/platforms/ios and try to build the application for release. However, this will fail in Xcode with error: Unable to find included file "../plugins-release.xcconfig".

To Reproduce

Setting SWIFT_VERSION in project's build.xcconfig breaks build for iOS

$ pod --version # in case the installed version is not 1.6.x or later, install new one with sudo gem update cocoapods
$ tns create myApp
$ cd myApp
$ npm i --save nativescript-socket.io

Open <project dir>/app/App_Resources/iOS/build.xcconfig and add the following line:

SWIFT_VERSION = 4.0

Now build the project:

$ tns build ios

Unable to find included file "../plugins-release.xcconfig" file error in Xcode

$ tns create myApp
$ cd myApp
$ tns build ios
$ open platforms/ios/myApp.xcodeproj

The last command will open Xcode.
From the top menus select Product -> Profile. This will build the app in release mode. However, the build fails with error that plugins-release.xcconfig file is missing.

Expected behavior
The build should succeed in both cases.

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

No branches or pull requests

2 participants