Skip to content

[iOS] Build with nativescript-plugin-firebase requires legacy build system #4311

@mbektchiev

Description

@mbektchiev

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.1.1
  • Cross-platform modules: 5.1.2
  • Plugin(s): nativescript-plugin-firebase

Describe the bug
Build for iOS of projects having nativescript-plugin-firebase
and Firestore feature enabled when using Xcode 10's new build
system causes errors similar to the following:

Build system information
error: Multiple commands produce '<PbxCp <project-path>/platforms/ios/build/src/core/ext/filters/client_channel/backup_poller.h>':
1) Target 'gRPC-Core' (project 'Pods') has copy command from '<project-path>/platforms/ios/Pods/gRPC-Core/src/core/ext/filters/client_channel/backup_poller.h' to '<project-path>/platforms/ios/build/src/core/ext/filters/client_channel/backup_poller.h'
2) Target 'gRPC-C++' (project 'Pods') has copy command from '<project-path>/platforms/ios/Pods/gRPC-C++/src/core/ext/filters/client_channel/backup_poller.h' to '<project-path>/platforms/ios/build/src/core/ext/filters/client_channel/backup_poller.h'

To Reproduce

  • tns create master-detail --template tns-template-master-detail
  • cd master-detail
  • open node_modules/nativescript-plugin-firebase/scripts/postinstall.js in a text editor
  • Comment the following code (located between lines 3391 and 3421):
        const sanitizedAppName = path.basename($projectData.projectDir).split('').filter((c) => /[a-zA-Z0-9]/.test(c)).join('');

        const xcodeWorkspacePath = path.join($projectData.platformsDir, 'ios', sanitizedAppName + '.xcworkspace');
        if (!fs.existsSync(xcodeWorkspacePath)) {
          $logger.error(xcodeWorkspacePath + ' is missing.');
          reject();
          return;
        }

        const xcodeWorkspaceShareddataPath = path.join($projectData.platformsDir, 'ios', sanitizedAppName + '.xcworkspace', 'xcshareddata');
        $logger.trace('Using Xcode workspace settings path', xcodeWorkspaceShareddataPath);
        console.log('Using Xcode workspace settings path: ' + xcodeWorkspaceShareddataPath);

        if (!fs.existsSync(xcodeWorkspaceShareddataPath)) {
          fs.mkdirSync(xcodeWorkspaceShareddataPath);
        }

        const xcodeWorkspaceSettingsFile = path.join(xcodeWorkspaceShareddataPath, 'WorkspaceSettings.xcsettings');
        // for this temp fix we assume that if the file is there, it contains the correct config
        if (!fs.existsSync(xcodeWorkspaceSettingsFile)) {
          fs.writeFileSync(xcodeWorkspaceSettingsFile, \`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>BuildSystemType</key>
	<string>Original</string>
</dict>
</plist>
\`);
          $logger.trace('Xcode workspace file written');
        }
  • open firebase.nativescript.json
  • Add the following configuration line: "firestore": true,
  • Re-run the postinstall script to apply the changes: cd node_modules/nativescript-plugin-firebase; npm run postinstall; cd -
  • tns build ios

=> The build fails with lots of errors similar to the one shown above.

Expected behavior
The build should succeed with the new build system as it does with the legacy one.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions