Skip to content

CB-13145: added variable replacing to framework tag #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions src/PluginInfo/PluginInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/PluginManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down