[
https://issues.apache.org/jira/browse/CB-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric updated CB-5674:
---------------------
Description:
When a script calls the cordova.raw.plugin('add', [..list of plugins...])
function, the promise that it returns does not properly wait for all of the
plugins to complete their installation.
This prevents a script from reliably installing the plugins and then proceeding
to build the platforms, because the platforms may start building before the
plugins have finished installing.
I believe the issue is:
https://github.com/apache/cordova-cli/blob/f338c0fc6f2ccc09b48001e96dd80d15757c8e83/src/platform.js#L256-262
On L261, the value of f that is passed to the reduce function is undefined,
where the code looks to be expecting a function.
One solution could be to replace L256-262 with:
{code:javascript}
return Q.all(plugins.map(function(plugin) {
events.emit('verbose', 'Installing plugin "' + plugin + '" following
successful platform add of ' + target);
return require('plugman').raw.install(target, output, path.basename(plugin),
plugins_dir, {www_dir: parser.staging_dir()});
}));
{code}
was:
When a script calls the cordova.raw.plugin('add', [..list of plugins...])
function, the promise that it returns does not properly wait for all of the
plugins to complete their installation.
This prevents a script from reliably installing the plugins and then proceeding
to build the platforms, because the platforms may start building before the
plugins have finished installing.
I believe the issue is:
https://github.com/apache/cordova-cli/blob/f338c0fc6f2ccc09b48001e96dd80d15757c8e83/src/platform.js#L256-262
On L261, the value of f that is passed to the reduce function is undefined,
where the code looks to be expecting a function.
One solution could be to replace L256-262 with:
{code:javascript}
return Q.all(plugins.map(function(plugin) {
events.emit('verbose', 'Installing plugin "' + plugin + '" following
successful platform add of ' + target);
return require('plugman').raw.install(target, output, path.basename(plugin),
plugins_dir, { www_dir: parser.staging_dir() });
}));
{code}
> Installing plugins programatically using the cordova cli npm module fails due
> to promise issue
> ----------------------------------------------------------------------------------------------
>
> Key: CB-5674
> URL: https://issues.apache.org/jira/browse/CB-5674
> Project: Apache Cordova
> Issue Type: Bug
> Components: CLI
> Affects Versions: Master, 3.1.0, 3.2.0, 3.3.0
> Reporter: Eric
> Labels: javascript
>
> When a script calls the cordova.raw.plugin('add', [..list of plugins...])
> function, the promise that it returns does not properly wait for all of the
> plugins to complete their installation.
> This prevents a script from reliably installing the plugins and then
> proceeding to build the platforms, because the platforms may start building
> before the plugins have finished installing.
> I believe the issue is:
> https://github.com/apache/cordova-cli/blob/f338c0fc6f2ccc09b48001e96dd80d15757c8e83/src/platform.js#L256-262
> On L261, the value of f that is passed to the reduce function is undefined,
> where the code looks to be expecting a function.
> One solution could be to replace L256-262 with:
> {code:javascript}
> return Q.all(plugins.map(function(plugin) {
> events.emit('verbose', 'Installing plugin "' + plugin + '" following
> successful platform add of ' + target);
> return require('plugman').raw.install(target, output,
> path.basename(plugin), plugins_dir, {www_dir: parser.staging_dir()});
> }));
> {code}
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)