[
https://issues.apache.org/jira/browse/CB-11023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15292251#comment-15292251
]
ASF GitHub Bot commented on CB-11023:
-------------------------------------
Github user riknoll commented on the pull request:
https://github.com/apache/cordova-lib/pull/432#issuecomment-220467601
I think that the issue might be that we need to separate inserting child
elements and editing existing ones. Something like this:
```xml
<!-- Editing attributes in existing elements -->
<edit-config target="xpath/nonsense" mode="merge|overwrite">
<attribute name="attr" new-value="edited" />
</edit-config>
<!-- Existing config-file insert behavior -->
<insert-config parent="xpath/nonsense">
<child-element />
</insert-config>
```
This is a bit more verbose if you have a lot of edits that need to be
performed, but much more flexible because the xpath selector can be used to
reference specific elements, even in lists. It might also help with detecting
plugin conflicts. I don't care about the names of those tags (we can keep using
config-file if we want).
For plugin conflicts, detection should probably happen at "plugin add"
time. The add should fail on conflict and allow the user to override it using
`--force` if they want to. As for which plugin gets dibs in the forced add
scenario, it doesn't really matter as long as it is consistent. Hopefully the
user can determine the correct value on conflict and fix it by editing the
config from the project's `config.xml`.
> plugin.xml should be able to add attribute to an existing element in
> AndroidManifest.xml
> ----------------------------------------------------------------------------------------
>
> Key: CB-11023
> URL: https://issues.apache.org/jira/browse/CB-11023
> Project: Apache Cordova
> Issue Type: Improvement
> Components: CLI, Plugman
> Reporter: Carlos Santana
>
> We have a need for a plugin we develop to add the attribute android:name to
> the <application> element to be able to point to a Class that tracks app
> sessions for analytics.
> plugin.xml only support via <config-file> only to add elements to
> AndroidManfist.xml this request is to add an enhancement to also handle
> adding an attribute to an existing element.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]