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 2015/12/21 11:27:58 UTC
cordova-lib git commit: CB-10193 Add deprecation notice about
pre_package removal
Repository: cordova-lib
Updated Branches:
refs/heads/master e3d887da0 -> 4478eaf07
CB-10193 Add deprecation notice about pre_package removal
Also fire pre_package manually if Windows platform doesn't support it
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/4478eaf0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/4478eaf0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/4478eaf0
Branch: refs/heads/master
Commit: 4478eaf0783a2f73962e5911a0c26cc4db1da241
Parents: e3d887d
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Sat Dec 12 12:47:13 2015 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Dec 21 13:26:13 2015 +0300
----------------------------------------------------------------------
cordova-lib/src/cordova/prepare.js | 14 ++++++++++++--
cordova-lib/src/hooks/HooksRunner.js | 10 +++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4478eaf0/cordova-lib/src/cordova/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/prepare.js b/cordova-lib/src/cordova/prepare.js
index b26449c..38094fa 100644
--- a/cordova-lib/src/cordova/prepare.js
+++ b/cordova-lib/src/cordova/prepare.js
@@ -23,6 +23,7 @@ var cordova_util = require('./util'),
PluginInfoProvider = require('cordova-common').PluginInfoProvider,
events = require('cordova-common').events,
platforms = require('../platforms/platforms'),
+ PlatformApiPoly = require('../platforms/PlatformApiPoly'),
HooksRunner = require('../hooks/HooksRunner'),
Q = require('q'),
restore = require('./restore-util'),
@@ -87,18 +88,27 @@ function preparePlatforms (platformList, projectRoot, options) {
// CB-9987 We need to reinstall the plugins for the platform it they were added by cordova@<5.4.0
return restoreMissingPluginsForPlatform(platform, projectRoot, options)
- .then(function (argument) {
+ .then(function () {
// platformApi prepare takes care of all functionality
// which previously had been executed by cordova.prepare:
// - reset config.xml and then merge changes from project's one,
// - update www directory from project's one and merge assets from platform_www,
// - reapply config changes, made by plugins,
// - update platform's project
- // Please note that plugins' changes, such as installes js files, assets and
+ // Please note that plugins' changes, such as installed js files, assets and
// config changes is not being reinstalled on each prepare.
var platformApi = platforms.getPlatformApi(platform);
return platformApi.prepare(project)
.then(function () {
+ if (platform === 'windows' && !(platformApi instanceof PlatformApiPoly)) {
+ // Windows Api doesn't fire 'pre_package' hook, so we fire it here
+ return new HooksRunner(projectRoot).fire('pre_package', {
+ wwwPath: platformApi.getPlatformInfo().locations.www,
+ platforms: ['windows']
+ });
+ }
+ })
+ .then(function () {
if (options.browserify)
return browserify(project, platformApi);
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4478eaf0/cordova-lib/src/hooks/HooksRunner.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/hooks/HooksRunner.js b/cordova-lib/src/hooks/HooksRunner.js
index 716156d..a6f17e4 100644
--- a/cordova-lib/src/hooks/HooksRunner.js
+++ b/cordova-lib/src/hooks/HooksRunner.js
@@ -50,10 +50,18 @@ HooksRunner.prototype.fire = function fire(hook, opts) {
}
opts = this.prepareOptions(opts);
+ var handlers = events.listeners(hook);
+ var scripts = scriptsFinder.getHookScripts(hook, opts);
+
+ // CB-10193 Emit warning if there is any handlers subscribed to 'pre_package'
+ if (hook === 'pre_package' && (handlers.length > 0 || scripts.length > 0)) {
+ events.emit('warn', '"pre_package" hook is deprecated and will be removed in next Windows platform versions. ' +
+ 'Please use "after_prepare" if you want to manipulate files in www before app will be packaged.');
+ }
+
// execute hook event listeners first
return executeEventHandlersSerially(hook, opts).then(function() {
// then execute hook script files
- var scripts = scriptsFinder.getHookScripts(hook, opts);
var context = new Context(hook, opts);
return runScriptsSerially(scripts, context);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org