[
https://issues.apache.org/jira/browse/CB-9278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14635904#comment-14635904
]
ASF GitHub Bot commented on CB-9278:
------------------------------------
Github user nikhilkh commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/266#discussion_r35160288
--- Diff: cordova-lib/src/cordova/restore-util.js ---
@@ -56,24 +57,23 @@ function installPlatformsFromConfigXML(platforms) {
if (!targets || !targets.length) {
return Q.all('No platforms are listed in config.xml to restore');
}
- // Run platform add for all the platforms seperately
+
+
+ // Run `platform add` for all the platforms separately
// so that failure on one does not affect the other.
- var promises = targets.map(function (target) {
+
+ // CB-9278 : Run `platform add` serially, one platform after another
+ // Otherwise, we get a bug where the following line:
https://github.com/apache/cordova-lib/blob/0b0dee5e403c2c6d4e7262b963babb9f532e7d27/cordova-lib/src/util/npm-helper.js#L39
+ // gets executed more simultaneously by each platform and leads to an
exception being thrown
+ return promiseutil.Q_chainmap_graceful(targets, function(target) {
if (target) {
events.emit('log', 'Restoring platform ' + target + '
referenced on config.xml');
return cordova.raw.platform('add', target);
}
return Q();
+ }, function(err) {
+ events.emit('log', err);
--- End diff --
Should these be logged as 'error' instead of 'log'
> Restoring multiple platforms fails
> ----------------------------------
>
> Key: CB-9278
> URL: https://issues.apache.org/jira/browse/CB-9278
> Project: Apache Cordova
> Issue Type: Bug
> Components: CordovaLib
> Affects Versions: Master
> Environment: OS X
> Reporter: Dmitry Blotsky
> Assignee: Omar Mefire
> Labels: cordova-lib, platform, restore, save
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> Steps to reproduce:
> 1. Create a blank app: {{cordova create test com.app.test test}}
> 2. Add and save a platform: {{cordova platform add --save ios}}
> 3. Add and save another platform: {{cordova platform add --save android}}
> 4. Remove the platforms: {{cordova platform remove android ios}}
> 5. Try to restore platforms automatically: {{cordova prepare}}
> Expected: both platforms installed and prepared
> Actual:
> {noformat}
> Error: Trying to initialize npm when settings have not been restored from a
> previous initialization.
> {noformat}
> Running {{cordova prepare}} again fixes the issue.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]