You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/04 15:57:00 UTC

[jira] [Commented] (CB-14263) Makes all of cordova plugins compatible with cordova-android 7

    [ https://issues.apache.org/jira/browse/CB-14263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16708909#comment-16708909 ] 

ASF GitHub Bot commented on CB-14263:
-------------------------------------

dpogue closed pull request #35:  CB-14263: (android) make cordova plugin compatible with cordova-android 7
URL: https://github.com/apache/cordova-common/pull/35
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/PluginInfo/PluginInfo.js b/src/PluginInfo/PluginInfo.js
index 428df9d..7686105 100644
--- a/src/PluginInfo/PluginInfo.js
+++ b/src/PluginInfo/PluginInfo.js
@@ -124,13 +124,28 @@ function PluginInfo (dirname) {
     // <config-file> tag
     self.getConfigFiles = getConfigFiles;
     function getConfigFiles (platform) {
-        var configFiles = _getTags(self._et, 'config-file', platform, _parseConfigFile);
+        var configFiles = _getTags(self._et, 'config-file', platform, _parseConfigFile.bind(this, platform));
         return configFiles;
     }
 
-    function _parseConfigFile (tag) {
+    function _parseConfigFile (platform, tag) {
+        var target = tag.attrib['target'];
+        if (platform === 'android') {
+            if (target === 'AndroidManifest.xml') {
+                target = path.join('app', 'src', 'main', 'AndroidManifest.xml');
+            } else if (target.endsWith('config.xml')) {
+                target = path.join('app', 'src', 'main', 'res', 'xml', 'config.xml');
+            } else if (target.endsWith('strings.xml')) {
+                // Plugins really shouldn't mess with strings.xml, since it's able to be localized
+                target = path.join('app', 'src', 'main', 'res', 'values', 'strings.xml');
+            } else if (target.includes(path.join('res', 'xml'))) {
+                // Catch-all for all other stored XML configuration in legacy plugins
+                var config_file = path.basename(target);
+                target = path.join('app', 'src', 'main', 'res', 'xml', config_file);
+            }
+        }
         var configFile =
-            { target: tag.attrib['target'],
+            { target: target,
                 parent: tag.attrib['parent'],
                 after: tag.attrib['after'],
                 xmls: tag.getchildren(),


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Makes all of cordova plugins compatible with cordova-android 7
> --------------------------------------------------------------
>
>                 Key: CB-14263
>                 URL: https://issues.apache.org/jira/browse/CB-14263
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: AllPlugins, cordova-android, cordova-common
>    Affects Versions: cordova-common@2.2.3
>            Reporter: Heo
>            Priority: Major
>             Fix For: Master
>
>   Original Estimate: 12h
>  Remaining Estimate: 12h
>
> Cordova common's ConfigParser supports alias such as config.xml, AndroidManifest.xml paths. [https://github.com/apache/cordova-common/blob/7bf9627f0135c6b3518292660b6e07e6f5815926/src/ConfigChanges/ConfigFile.js#L192] But In PluginInfo parser, there is no alias rules for compatibility.
> There is lots of cordova plugins still not upgrade to cordova-android 7 syntax (plugin.xml)
> So i did some changes to cordova-common which will make cordova cli parsing some plugins which not support cordova-android 7 yet.
> [https://github.com/apache/cordova-cli/compare/master...leo6104:master]
> Here is my changes.
>  
>  
> I spent lots of times to fix this. I test it via my cutsom cordova-cli repository [https://github.com/leo6104/cordova-cli/] and i fix it in my cordova project.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org