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/11/06 20:16:45 UTC

cordova-lib git commit: CB-12088 Fix misleading warning when adding platform without Api.js

Repository: cordova-lib
Updated Branches:
  refs/heads/master 6e687ec69 -> d3c92092c


CB-12088 Fix misleading warning when adding platform without Api.js

 This closes #506


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

Branch: refs/heads/master
Commit: d3c92092c9468e26fa11a4b3eb25bd2fb90afb5a
Parents: 6e687ec
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Tue Nov 1 13:48:51 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Sun Nov 6 23:16:15 2016 +0300

----------------------------------------------------------------------
 cordova-lib/src/platforms/platforms.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d3c92092/cordova-lib/src/platforms/platforms.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/platforms/platforms.js b/cordova-lib/src/platforms/platforms.js
index 9d25bfb..db9b76d 100644
--- a/cordova-lib/src/platforms/platforms.js
+++ b/cordova-lib/src/platforms/platforms.js
@@ -56,10 +56,14 @@ function getPlatformApi(platform, platformRootDir) {
         PlatformApi = require(platformApiModule);
     } catch (err) {
         // Check if platform already compatible w/ PlatformApi and show deprecation warning
-        if (err && err.code === 'MODULE_NOT_FOUND' && platforms[platform].apiCompatibleSince) {
-            events.emit('warn', ' Using this version of Cordova with older version of cordova-' + platform +
-                ' is being deprecated. Consider upgrading to cordova-' + platform + '@' +
-                platforms[platform].apiCompatibleSince + ' or newer.');
+        if (err && err.code === 'MODULE_NOT_FOUND') {
+            if (platforms[platform].apiCompatibleSince) {
+                events.emit('warn', ' Using this version of Cordova with older version of cordova-' + platform +
+                    ' is being deprecated. Consider upgrading to cordova-' + platform + '@' +
+                    platforms[platform].apiCompatibleSince + ' or newer.');
+            }
+            // else nothing - there is no Api.js and no deprecation information hence
+            // the platform just does not expose Api and we will use polyfill as usual
         } else {
             events.emit('warn', 'Error loading cordova-'+platform);
         }


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