You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/04/27 14:22:16 UTC
[GitHub] [cordova-node-xcode] sitefinitysteve opened a new issue #110: addBuildPhase keeps adding phases when they already exist
sitefinitysteve opened a new issue #110:
URL: https://github.com/apache/cordova-node-xcode/issues/110
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-node-xcode] AndrWeisR commented on issue #110: addBuildPhase keeps adding phases when they already exist
Posted by GitBox <gi...@apache.org>.
AndrWeisR commented on issue #110:
URL: https://github.com/apache/cordova-node-xcode/issues/110#issuecomment-850003180
I did it with this js script, called from a Cordova "after_build" hook:
```
var xcode = require('xcode'),
fs = require('fs'),
projectPath = 'platforms/ios/MyProj.xcodeproj/project.pbxproj',
proj = xcode.project(projectPath);
proj.parse(function (err) {
var scriptName = 'My Script';
var buildPhases = proj.getPBXObject('PBXShellScriptBuildPhase');
if (JSON.stringify(buildPhases).match(scriptName)) {
console.log('Xcode project not updated - ' + scriptName + ' already exists')
} else {
var options = {shellPath: '/bin/sh', shellScript: 'bash somescript.sh'};
proj.addBuildPhase([], 'PBXShellScriptBuildPhase', scriptName, proj.getFirstTarget().uuid, options);
fs.writeFileSync(projectPath, proj.writeSync());
console.log('Xcode project updated - added ' + scriptName);
}
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org