Currently I'm starting to use the library which seems to be very reliable but when I hit xcode.project('') the code stops with an exception.
I'm including this in a cordova hook to run a process after build and update some configuration.
The path is correct, I double check it, but the hook just stops when it gets to the load project line and doesn't return any message.
module.exports = function (context) {
const fs = require('fs');
const path = require('path');
const fsExtra = require('fs-extra');
const util = require('util')
// The next library help us execute the cli(s) we require
var glob = require('glob');
var plist = require('plist');
const cli = require('shelljs');
try {
// Only execute if we are dealing with iOS
if (!context.opts.cordova.platforms || context.opts.cordova.platforms.indexOf('ios') === -1 || process.platform !== 'darwin') {
console.log('HOOK_ERROR_PLATFORM_OR_OS_NOT_PRESENT');
return;
}
// We require these libraries to manipulate files, directories and paths
var rootdir = path.join(context.opts.projectRoot);
cli.echo('START_HOOK_ENTITLEMENTS');
// var pbxFiles = glob.sync("**/*.xcodeproj/project.pbxproj", {"cwd": rootdir});
var pbxFiles = glob.sync("**/*.pbxproj", {"cwd": rootdir});
pbxFiles.forEach(function(foundFile, idx, array){
if(foundFile.indexOf("CordovaLib") == -1
&& foundFile.indexOf('node_modules') == -1
&& foundFile.indexOf('plugins') == -1){
cli.echo('HOOK_ENTITLEMENTS_INITIATE_CHANGE');
// Not the "CordovaLib" project
var foundFileFull = path.join(rootdir, foundFile);
cli.echo("Using project file " + foundFileFull);
proj = xcode.project(foundFileFull);
cli.echo('HERE');
}
});
} catch(err) {
cli.echo('HOOK_STOP_UNEXPECTEDLY');
cli.echo(err);
return;
}
Hi,
Currently I'm starting to use the library which seems to be very reliable but when I hit xcode.project('') the code stops with an exception.
I'm including this in a cordova hook to run a process after build and update some configuration.
The path is correct, I double check it, but the hook just stops when it gets to the load project line and doesn't return any message.
module.exports = function (context) { const fs = require('fs'); const path = require('path'); const fsExtra = require('fs-extra'); const util = require('util') // The next library help us execute the cli(s) we require var glob = require('glob'); var plist = require('plist'); const cli = require('shelljs'); try { // Only execute if we are dealing with iOS if (!context.opts.cordova.platforms || context.opts.cordova.platforms.indexOf('ios') === -1 || process.platform !== 'darwin') { console.log('HOOK_ERROR_PLATFORM_OR_OS_NOT_PRESENT'); return; }
}