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

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

Closed
mbektchiev opened this issue Jan 22, 2019 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@mbektchiev
Copy link
Contributor

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.

@mbektchiev
Copy link
Contributor Author

For more information see CocoaPods/CocoaPods#483 (comment) 👍😄🎉❤️

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

4 participants