You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/08/18 14:41:45 UTC

cordova-lib git commit: CB-11698 Fix plugin installation when restoring platform

Repository: cordova-lib
Updated Branches:
  refs/heads/master 2a178662a -> 3654a11ab


CB-11698 Fix plugin installation when restoring platform

This partially reverts #464 and forces cordova to always check for
and install plugins, added to the project, to platform that is being
restored at the moment.

 This closes #479


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/3654a11a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/3654a11a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/3654a11a

Branch: refs/heads/master
Commit: 3654a11abc51ab3aead47a9c02ebc135424777b1
Parents: 2a17866
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Fri Aug 12 13:36:36 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Thu Aug 18 17:41:25 2016 +0300

----------------------------------------------------------------------
 cordova-lib/spec-cordova/save.spec.js | 23 +++++++++++++++++++++++
 cordova-lib/src/cordova/platform.js   |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/3654a11a/cordova-lib/spec-cordova/save.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/save.spec.js b/cordova-lib/spec-cordova/save.spec.js
index 31f7e96..3bac963 100644
--- a/cordova-lib/spec-cordova/save.spec.js
+++ b/cordova-lib/spec-cordova/save.spec.js
@@ -676,6 +676,29 @@ describe('(save flag)', function () {
                 done();
             });
         });
+
+        it('spec.25 should install plugins already added to the project into platform when restoring it', function (done) {
+            var fail = jasmine.createSpy('fail').andCallFake(function (err) {
+                console.log(err.message);
+            });
+
+            cordova.raw.plugin('add', localPluginPath)
+            .then(function () {
+                helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
+                return prepare({ platforms: [ platformName ] });
+            })
+            .then(function () {
+                expect(path.join(appPath, 'platforms', platformName)).toExist();
+                // Validate that plugin has been installed to platform by checking
+                // platformJson file for plugin entry added
+                var platformJson = require(path.join(appPath, 'platforms', platformName, platformName + '.json'));
+                expect(platformJson.installed_plugins[localPluginName]).toBeDefined();
+            })
+            .finally(function () {
+                expect(fail).not.toHaveBeenCalled();
+                done();
+            });
+        });
     });
 
     describe('(cleanup)', function () {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/3654a11a/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 680fb3b..0d5f166 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -198,7 +198,7 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                     }
                 })
                 .then(function() {
-                    if (cmd == 'add' && !opts.restoring) {
+                    if (cmd == 'add') {
                         return installPluginsForNewPlatform(platform, projectRoot, opts);
                     }
                 })


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org