You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/10/28 22:31:03 UTC

git commit: Fix `cordova platform add` not using searchpath from config.json

Repository: cordova-lib
Updated Branches:
  refs/heads/master 61f5f54d2 -> 74fd91086


Fix `cordova platform add` not using searchpath from config.json

This was causing a problem when a platform was added and one of the already
installed plugins had a dependency specific to this new platform (this is
rather rare).

One example is org.chromium.socket depends on org.chromium.iossocketscommon
only for iOS but not for Android.

To reproduce using mobile-chrome-apps:

    cca create TstApp --link-to=spec --android
    cd TstApp
    cca prepare
    cca platform add ios


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

Branch: refs/heads/master
Commit: 74fd910866e44ba4d4327c441adb522eeb5a7fab
Parents: 61f5f54
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Tue Oct 28 17:06:01 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Tue Oct 28 17:06:01 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/74fd9108/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index ed7d5af..d8264e1 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -66,6 +66,9 @@ function add(hooksRunner, projectRoot, targets, opts) {
     var cfg = new ConfigParser(xml);
     var config_json = config.read(projectRoot);
     var platformsDir = path.join(projectRoot, 'platforms');
+    opts = opts || {};
+    opts.searchpath = opts.searchpath || config_json.plugin_search_path;
+
 
     // The "platforms" dir is safe to delete, it's almost equivalent to
     // cordova platform rm <list of all platforms>
@@ -121,11 +124,7 @@ function add(hooksRunner, projectRoot, targets, opts) {
             return p
             .then(function(libDir) {
                 var template = config_json && config_json.lib && config_json.lib[platform] && config_json.lib[platform].template || null;
-                var copts = null;
-                if ('spawnoutput' in opts) {
-                    copts = { stdio: opts.spawnoutput };
-                }
-                return call_into_create(platform, projectRoot, cfg, libDir, template, copts);
+                return call_into_create(platform, projectRoot, cfg, libDir, template, opts);
             });
         });
     })
@@ -462,7 +461,11 @@ function call_into_create(target, projectRoot, cfg, libDir, template_dir, opts)
         args.push(template_dir);
     }
 
-    return superspawn.spawn(bin, args, opts || { stdio: 'inherit' })
+    var copts = { stdio: 'inherit' };
+    if ('spawnoutput' in opts) {
+        copts = { stdio: opts.spawnoutput };
+    }
+    return superspawn.spawn(bin, args, copts)
     .then(function() {
         copy_cordova_js(projectRoot, target);
     })
@@ -492,8 +495,9 @@ function call_into_create(target, projectRoot, cfg, libDir, template_dir, opts)
                             cli_variables: variables
                         };
                     }
-                    return null;
+                    return {};
                 })();
+                options.searchpath = opts.searchpath;
 
                 return plugman.raw.install(target, output, plugin, plugins_dir, options);
             });


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