Nativescript-cli: CLI injects CODE_SIGN_ENTITLEMENTS into App_Resources/iOS/build.xcconfig

Created on 26 Jan 2021  路  3Comments  路  Source: NativeScript/nativescript-cli

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: 7.1.2
  • Cross-platform modules: 6.5.11
  • Android Runtime: 6.5.3
  • iOS Runtime: 6.5.4
  • XCode Version: 12.3
  • Plugin(s): irrelevant

Describe the bug

We had some issues where developers had the app cloned into a different directory, and thus having a different folder name during the build/run. We have a custom app.entitlements in our App_Resources/iOS folder. According to the docs it should automatically pick it up (and it does), however, it then links it in the build.xcconfig in the App_Resources/iOS folder. It adds the following line:

CODE_SIGN_ENTITLEMENTS = {root-folder-name}/{root-folder-name}.entitlements

You probably already see when this will go wrong: another developer clones the repository with a different folder name, and the CODE_SIGN_ENTITLEMENTS reference isn't correct anymore. It also doesn't correct it resulting in an error/warning in the XCode build.

In my opinion it should not link it in the App_Resources/iOS folder, it should link it in the generated build.xcconfig somewhere in the platforms folder. I don't think NativeScript should edit files in App_Resources by itself.

To Reproduce

  • Create a new project
  • Add an app.entitlements in the App_Resources/iOS folder
  • Run the app
  • See that App_Resources/iOS/build.xcconfig has been edited and gets a reference to the entitlements file
  • Rename the root folder of the project
  • Run the app again
  • You will get an error about the entitlements not being found

Expected behavior
It should link CODE_SIGN_ENTITLEMENTS in the generated build.xcconfig somewhere in the platforms folder. I don't think NativeScript should edit files in App_Resources by itself.

bug needs more info

Most helpful comment

@rigor789 I'm so sorry, this seems to be coming from nativescript-plugin-firebase:
https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/src/scripts/entitlements-before-prepare.js

All 3 comments

@janoshrubos & I just tried to reproduce this locally, however no matter what we tried, the App_Resources/iOS/build.xcconfig was never touched/changed by the CLI. Is this with a specific flavor/template? How did you create the new project?

@janoshrubos & I just tried to reproduce this locally, however no matter what we tried, the App_Resources/iOS/build.xcconfig was never touched/changed by the CLI. Is this with a specific flavor/template? How did you create the new project?

@rigor789 Did you add a app.entitlements file in your App_Resources/iOS folder? I will test tomorrow on a new project when I have access to the mac mini again.

This is an Angular project, but I don't think it's related to the flavor/template.

@rigor789 I'm so sorry, this seems to be coming from nativescript-plugin-firebase:
https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/src/scripts/entitlements-before-prepare.js

Was this page helpful?
0 / 5 - 0 ratings