You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/08/22 23:46:51 UTC
cordova-common git commit: CB-13145: added variable replacing to
framework tag
Repository: cordova-common
Updated Branches:
refs/heads/CB-13145 [created] 8988dc809
CB-13145: added variable replacing to framework tag
Project: http://git-wip-us.apache.org/repos/asf/cordova-common/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-common/commit/8988dc80
Tree: http://git-wip-us.apache.org/repos/asf/cordova-common/tree/8988dc80
Diff: http://git-wip-us.apache.org/repos/asf/cordova-common/diff/8988dc80
Branch: refs/heads/CB-13145
Commit: 8988dc80990465f3d151450dfda5eb13add1922a
Parents: b4187f4
Author: Steve Gill <st...@gmail.com>
Authored: Thu Aug 17 17:18:12 2017 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Aug 22 16:46:36 2017 -0700
----------------------------------------------------------------------
src/PluginInfo/PluginInfo.js | 27 +++++++++++++++++++++++----
src/PluginManager.js | 2 +-
2 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-common/blob/8988dc80/src/PluginInfo/PluginInfo.js
----------------------------------------------------------------------
diff --git a/src/PluginInfo/PluginInfo.js b/src/PluginInfo/PluginInfo.js
index 75c96c1..4cb5307 100644
--- a/src/PluginInfo/PluginInfo.js
+++ b/src/PluginInfo/PluginInfo.js
@@ -306,15 +306,34 @@ function PluginInfo (dirname) {
return n.attrib.name;
});
};
- self.getFrameworks = function (platform) {
+
+ self.getFrameworks = function (platform, options) {
return _getTags(self._et, 'framework', platform, function (el) {
+ var src = el.attrib.src;
+ if (options) {
+ var vars = options.cli_variables || {};
+ if (Object.keys(vars).length === 0) {
+ // get variable defaults from plugin.xml for removal
+ vars = self.getPreferences(platform);
+ }
+
+ var regExp;
+ // Iterate over plugin variables.
+ // Replace them in framework src if they exist
+ Object.keys(vars).forEach(function (name) {
+ if (vars[name]) {
+ regExp = new RegExp('\\$' + name, 'g');
+ src = src.replace(regExp, vars[name]);
+ }
+ });
+ }
var ret = {
itemType: 'framework',
type: el.attrib.type,
parent: el.attrib.parent,
custom: isStrTrue(el.attrib.custom),
embed: isStrTrue(el.attrib.embed),
- src: el.attrib.src,
+ src: src,
spec: el.attrib.spec,
weak: isStrTrue(el.attrib.weak),
versions: el.attrib.versions,
@@ -328,14 +347,14 @@ function PluginInfo (dirname) {
};
self.getFilesAndFrameworks = getFilesAndFrameworks;
- function getFilesAndFrameworks (platform) {
+ function getFilesAndFrameworks (platform, options) {
// Please avoid changing the order of the calls below, files will be
// installed in this order.
var items = [].concat(
self.getSourceFiles(platform),
self.getHeaderFiles(platform),
self.getResourceFiles(platform),
- self.getFrameworks(platform),
+ self.getFrameworks(platform, options),
self.getLibFiles(platform)
);
return items;
http://git-wip-us.apache.org/repos/asf/cordova-common/blob/8988dc80/src/PluginManager.js
----------------------------------------------------------------------
diff --git a/src/PluginManager.js b/src/PluginManager.js
index 7b8a0d4..b875d0e 100644
--- a/src/PluginManager.js
+++ b/src/PluginManager.js
@@ -92,7 +92,7 @@ PluginManager.prototype.doOperation = function (operation, plugin, options) {
var actions = new ActionStack();
// gather all files need to be handled during operation ...
- plugin.getFilesAndFrameworks(this.platform)
+ plugin.getFilesAndFrameworks(this.platform, options)
.concat(plugin.getAssets(this.platform))
.concat(plugin.getJsModules(this.platform))
// ... put them into stack ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org