-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
build(android): rework merging of external library's resources #11094
Changes from 2 commits
6185f3f
649d25d
9dd289b
f98cb42
690b87a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,20 @@ AndroidBaseBuilder.prototype.writeXmlFile = function writeXmlFile(srcOrDoc, dest | |
if (n) { | ||
nodes[node.tagName] || (nodes[node.tagName] = {}); | ||
if (nodes[node.tagName][n] && n !== 'app_name') { | ||
_t.logger.warn(__('Overwriting XML node %s in file %s', String(n).cyan, dest.cyan)); | ||
// We have a node with the same name. Merging as follows: | ||
// Nodes with the same name get overwritten to maintain backwards compatiblity. | ||
// Nodes with different name are appended to the parent node. | ||
xml.forEachElement(node, function (nodeChild) { | ||
// We have node with the same name, remove the current one. | ||
xml.forEachElement(nodes[node.tagName][n], function (alreadyAddedChild) { | ||
if (alreadyAddedChild.getAttribute('name') === nodeChild.getAttribute('name')) { | ||
alreadyAddedChild.parentNode.removeChild(alreadyAddedChild); | ||
} | ||
}); | ||
nodes[node.tagName][n].appendChild(nodeChild.cloneNode(true)); | ||
}); | ||
_t.logger.warn(__('Merging XML node %s in file %s', String(n).cyan, dest.cyan)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been bothering me for ages, but i think this should be |
||
return; | ||
} | ||
nodes[node.tagName][n] = node; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.