CB-10644 Adds deprecation message about old platforms support removal. This closes #394
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/96cd416d Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/96cd416d Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/96cd416d Branch: refs/heads/common-1.1.x Commit: 96cd416df9edbb9e6a41307a15721282e24fc9fa Parents: 3cef082 Author: Vladimir Kotikov <v-vlk...@microsoft.com> Authored: Fri Jan 22 14:22:35 2016 +0300 Committer: Vladimir Kotikov <v-vlk...@microsoft.com> Committed: Wed Feb 24 22:26:04 2016 +0300 ---------------------------------------------------------------------- cordova-lib/src/platforms/platforms.js | 10 ++++++++-- cordova-lib/src/platforms/platformsConfig.json | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/96cd416d/cordova-lib/src/platforms/platforms.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/platforms/platforms.js b/cordova-lib/src/platforms/platforms.js index a932267..2f8ab7c 100644 --- a/cordova-lib/src/platforms/platforms.js +++ b/cordova-lib/src/platforms/platforms.js @@ -48,11 +48,17 @@ function getPlatformApi(platform, platformRootDir) { var PlatformApi; try { // First we need to find whether platform exposes its' API via js module - // If it has, then we have to require it and extend BasePlatformApi - // with platform's API. + // If it does, then we require and instantiate it. var platformApiModule = path.join(platformRootDir, 'cordova', 'Api.js'); 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.'); + } + PlatformApi = require('./PlatformApiPoly'); } http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/96cd416d/cordova-lib/src/platforms/platformsConfig.json ---------------------------------------------------------------------- diff --git a/cordova-lib/src/platforms/platformsConfig.json b/cordova-lib/src/platforms/platformsConfig.json index ff5c3d3..8b4a649 100644 --- a/cordova-lib/src/platforms/platformsConfig.json +++ b/cordova-lib/src/platforms/platformsConfig.json @@ -5,6 +5,7 @@ "handler_file": "../plugman/platforms/ios", "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git", "version": "~4.0.1", + "apiCompatibleSince": "4.0.0", "deprecated": false }, "osx": { @@ -13,6 +14,7 @@ "handler_file": "../plugman/platforms/ios", "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-osx.git", "version": "~4.0.0", + "apiCompatibleSince": "4.0.0", "deprecated": false }, "android": { @@ -20,6 +22,7 @@ "handler_file": "../plugman/platforms/android", "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-android.git", "version": "~5.1.0", + "apiCompatibleSince": "5.0.0", "deprecated": false }, "ubuntu": { @@ -73,6 +76,7 @@ "handler_file": "../plugman/platforms/windows", "url": "https://git-wip-us.apache.org/repos/asf?p=cordova-windows.git", "version": "~4.3.0", + "apiCompatibleSince": "4.3.0", "deprecated": false }, "webos": { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org