Open mjromper opened 10 years ago
This is the console log and "verbose" set true.
Running "phonegap:build" task Cleaning mobile/build_ios Creating directory tree Cloning root directory Cloning .cordova directory Compiling config.xml Compiling template mobile/.cordova/_configTemplate.xml Adding plugins Running: phonegap local plugin add https://github.com/BLNK-DEV/BarcodeScanner -V [phonegap] adding the plugin: https://github.com/BLNK-DEV/BarcodeScanner [phonegap] successfully added the plugin Running: phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git -V [phonegap] adding the plugin: https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git [phonegap] successfully added the plugin Building platforms Running: phonegap local build ios -V [phonegap] adding the iOS platform... [phonegap] Creating ios project... [error] Cannot set property 'is_top_level' of undefined
Done, without errors.
See https://github.com/logankoester/grunt-phonegap/issues/61#issuecomment-37997480 - related I think.
@logankoester I believe it has to do with the way plugins are loaded/copied/compiled (I don't know exactly) into phonegap project. If there are no plugins then the task runs correctly, it creates the ios project and compiles successfully.
I believe that it is an issue with cordova-plugman (Phonegap CLI). When we run phonegap-build , it comes down to platform.js (cordova/src). It tries to install plugins-serially. That is the reason when there are no plugins , there is no issue raised
return plugins.reduce(function(soFar, plugin) {
return soFar.then(function() {
events.emit('verbose', 'Installing plugin "' + plugin + '" following successful platform add of ' + target);
return plugman.raw.install(target, output, path.basename(plugin), plugins_dir);
});
plugman.raw.install is expecting a fifth argument 'options' (in plugman/src/install.js)
module.exports = function installPlugin(platform, project_dir, id, plugins_dir, options) {
if (!platform_modules[platform]) {
return Q.reject(new Error(platform + " not supported."));
}
var current_stack = new action_stack();
options.is_top_level = true;
return possiblyFetch(id, plugins_dir, options)
.then(function(plugin_dir) {
return runInstall(current_stack, platform, project_dir, plugin_dir, plugins_dir, options);
});
};
Here options is undefined. On commenting options.is_top_level , I was able to overcome this issue. I do not know if that is the solution to it. But it does not seem to be a issue with grunt-phonegap.
This issue has been updated and fixed in the cordova-plugman repository. apache/cordova-plugman@2d2c791
And has been put to plugman ~ 0.20.2 Which has also been updated in the cordova-cli ~ 3.4.0-0.1.3 (not dev) https://git-wip-us.apache.org/repos/asf?p=cordova-cli.git;a=commitdiff;h=0f6250fa3d803e4ab3169dc637900b7533?b837ba
Updating the package dependency in phonegap-cli would solve this issue. And others associated with it - #38 and #36.
Here is the pull request for the same https://github.com/phonegap/phonegap-cli/pull/274
@li8 Good one! This solved the problem!
Just tried for iOS. if "plugins" is defined in the configuration, you get this error when running "grunt phonegap:build:ios". It creates the ios project but it doesn't compile due to the error.
phonegap version 3.4.0-0.19.7 grunt-phonegap: 0.13.3