cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject git commit: Revert "Add <plugins> tag to config.xml, containing a list of plugins."
Date Fri, 15 Nov 2013 18:08:46 GMT
Updated Branches:
  refs/heads/master 7259921ce -> a23892962


Revert "Add <plugins> tag to config.xml, containing a list of plugins."

This reverts commit 7259921ceeededb6a280916c6898bc28a0a972ae.

We have decided that this approach is a mistake, and are pursuing an
alternative implementation. Code for that will follow.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/a2389296
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/a2389296
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/a2389296

Branch: refs/heads/master
Commit: a2389296222955ec2c197b200412a95cb7acc0e8
Parents: 7259921
Author: Braden Shepherdson <braden@chromium.org>
Authored: Fri Nov 15 13:08:12 2013 -0500
Committer: Braden Shepherdson <braden@chromium.org>
Committed: Fri Nov 15 13:08:12 2013 -0500

----------------------------------------------------------------------
 spec/plugins/ChildBrowser/plugin.xml            |  2 +-
 spec/plugins/DummyPlugin/plugin.xml             |  2 +-
 spec/plugins/FaultyPlugin/plugin.xml            |  2 +-
 spec/plugins/WeblessPlugin/plugin.xml           |  2 +-
 spec/projects/android_two/res/xml/config.xml    | 23 ++++++++++++++++--
 .../android_two_no_perms/res/xml/config.xml     | 23 ++++++++++++++++--
 spec/util/config-changes.spec.js                | 25 +++++++-------------
 spec/util/xml-helpers.spec.js                   | 12 +++++-----
 src/util/config-changes.js                      | 11 +--------
 9 files changed, 62 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/plugins/ChildBrowser/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/ChildBrowser/plugin.xml b/spec/plugins/ChildBrowser/plugin.xml
index 4f89053..512c02f 100644
--- a/spec/plugins/ChildBrowser/plugin.xml
+++ b/spec/plugins/ChildBrowser/plugin.xml
@@ -56,7 +56,7 @@
         </config-file>
 
         <!-- CDV 2.0+ (for now) -->
-        <config-file target="res/xml/config.xml" parent="/widget/plugins">
+        <config-file target="res/xml/config.xml" parent="/cordova/plugins">
             <plugin name="ChildBrowser"
                 value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
         </config-file>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/plugins/DummyPlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/DummyPlugin/plugin.xml b/spec/plugins/DummyPlugin/plugin.xml
index c15c259..fad5072 100644
--- a/spec/plugins/DummyPlugin/plugin.xml
+++ b/spec/plugins/DummyPlugin/plugin.xml
@@ -57,7 +57,7 @@
         </config-file>
 
         <!-- CDV 2.0+ (for now) -->
-        <config-file target="res/xml/config.xml" parent="/widget/plugins">
+        <config-file target="res/xml/config.xml" parent="/cordova/plugins">
             <plugin name="DummyPlugin"
                 value="com.phonegap.plugins.dummyplugin.DummyPlugin"/>
         </config-file>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/plugins/FaultyPlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/FaultyPlugin/plugin.xml b/spec/plugins/FaultyPlugin/plugin.xml
index f6dca00..30af6e7 100644
--- a/spec/plugins/FaultyPlugin/plugin.xml
+++ b/spec/plugins/FaultyPlugin/plugin.xml
@@ -51,7 +51,7 @@
         </config-file>
 
         <!-- CDV 2.0+ (for now) -->
-        <config-file target="res/xml/config.xml" parent="/widget/plugins">
+        <config-file target="res/xml/config.xml" parent="/cordova/plugins">
             <plugin name="FaultyPlugin"
                 value="com.phonegap.plugins.faultyplugin.FaultyPlugin"/>
         </config-file>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/plugins/WeblessPlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/WeblessPlugin/plugin.xml b/spec/plugins/WeblessPlugin/plugin.xml
index 4e69b6c..5522d22 100644
--- a/spec/plugins/WeblessPlugin/plugin.xml
+++ b/spec/plugins/WeblessPlugin/plugin.xml
@@ -47,7 +47,7 @@
         </config-file>
 
         <!-- CDV 2.0+ (for now) -->
-        <config-file target="res/xml/config.xml" parent="/widget/plugins">
+        <config-file target="res/xml/config.xml" parent="/cordova/plugins">
             <plugin name="WeblessPlugin"
                 value="com.phonegap.plugins.weblessplugin.WeblessPlugin"/>
         </config-file>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/projects/android_two/res/xml/config.xml
----------------------------------------------------------------------
diff --git a/spec/projects/android_two/res/xml/config.xml b/spec/projects/android_two/res/xml/config.xml
index 40ac844..d37aba5 100644
--- a/spec/projects/android_two/res/xml/config.xml
+++ b/spec/projects/android_two/res/xml/config.xml
@@ -17,7 +17,7 @@
        specific language governing permissions and limitations
        under the License.
 -->
-<widget>
+<cordova>
     <!--
     access elements control the Android whitelist.
     Domains are assumed blocked unless set otherwise
@@ -31,5 +31,24 @@
 
     <log level="DEBUG"/>
     <preference name="useBrowserHistory" value="false" />
-</widget>
+<plugins>
+    <plugin name="App" value="org.apache.cordova.App"/>
+    <plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
+    <plugin name="Device" value="org.apache.cordova.Device"/>
+    <plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
+    <plugin name="Compass" value="org.apache.cordova.CompassListener"/>
+    <plugin name="Media" value="org.apache.cordova.AudioHandler"/>
+    <plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
+    <plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
+    <plugin name="File" value="org.apache.cordova.FileUtils"/>
+    <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
+    <plugin name="Notification" value="org.apache.cordova.Notification"/>
+    <plugin name="Storage" value="org.apache.cordova.Storage"/>
+    <plugin name="Temperature" value="org.apache.cordova.TempListener"/>
+    <plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
+    <plugin name="Capture" value="org.apache.cordova.Capture"/>
+    <plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
+    <plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
+</plugins>
+</cordova>
 

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/projects/android_two_no_perms/res/xml/config.xml
----------------------------------------------------------------------
diff --git a/spec/projects/android_two_no_perms/res/xml/config.xml b/spec/projects/android_two_no_perms/res/xml/config.xml
index 40ac844..d37aba5 100644
--- a/spec/projects/android_two_no_perms/res/xml/config.xml
+++ b/spec/projects/android_two_no_perms/res/xml/config.xml
@@ -17,7 +17,7 @@
        specific language governing permissions and limitations
        under the License.
 -->
-<widget>
+<cordova>
     <!--
     access elements control the Android whitelist.
     Domains are assumed blocked unless set otherwise
@@ -31,5 +31,24 @@
 
     <log level="DEBUG"/>
     <preference name="useBrowserHistory" value="false" />
-</widget>
+<plugins>
+    <plugin name="App" value="org.apache.cordova.App"/>
+    <plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
+    <plugin name="Device" value="org.apache.cordova.Device"/>
+    <plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
+    <plugin name="Compass" value="org.apache.cordova.CompassListener"/>
+    <plugin name="Media" value="org.apache.cordova.AudioHandler"/>
+    <plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
+    <plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
+    <plugin name="File" value="org.apache.cordova.FileUtils"/>
+    <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
+    <plugin name="Notification" value="org.apache.cordova.Notification"/>
+    <plugin name="Storage" value="org.apache.cordova.Storage"/>
+    <plugin name="Temperature" value="org.apache.cordova.TempListener"/>
+    <plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
+    <plugin name="Capture" value="org.apache.cordova.Capture"/>
+    <plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
+    <plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
+</plugins>
+</cordova>
 

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/config-changes.spec.js b/spec/util/config-changes.spec.js
index f252d1e..5e46b69 100644
--- a/spec/util/config-changes.spec.js
+++ b/spec/util/config-changes.spec.js
@@ -149,16 +149,11 @@ describe('config-changes module', function() {
                 xml = (new et.ElementTree(dummy_xml.find('./platform[@name="android"]/config-file[@target="res/xml/plugins.xml"]'))).write({xml_declaration:false});
                 xml = innerXML(xml);
                 expect(munge['res/xml/plugins.xml']['/plugins'][xml]).toEqual(1);
-
-                expect(munge['config.xml']).toBeDefined();
-                expect(munge['config.xml']['/widget/plugins']).toBeDefined();
-                expect(munge['config.xml']['/widget/plugins']['<plugin id="com.phonegap.plugins.dummyplugin"
version="0.6.0" />']).toBeDefined();
-
                 expect(munge['res/xml/config.xml']).toBeDefined();
-                expect(munge['res/xml/config.xml']['/widget/plugins']).toBeDefined();
+                expect(munge['res/xml/config.xml']['/cordova/plugins']).toBeDefined();
                 xml = (new et.ElementTree(dummy_xml.find('./platform[@name="android"]/config-file[@target="res/xml/config.xml"]'))).write({xml_declaration:false});
                 xml = innerXML(xml);
-                expect(munge['res/xml/config.xml']['/widget/plugins'][xml]).toEqual(1);
+                expect(munge['res/xml/config.xml']['/cordova/plugins'][xml]).toEqual(1);
             });
             it('should split out multiple children of config-file elements into individual
leaves', function() {
                 var munge = configChanges.generate_plugin_config_munge(childrenplugin, 'android',
temp, {});
@@ -263,12 +258,11 @@ describe('config-changes module', function() {
                     var manifest_doc = new et.ElementTree(et.XML(fs.readFileSync(path.join(temp,
'AndroidManifest.xml'), 'utf-8')));
                     var munge = dummy_xml.find('./platform[@name="android"]/config-file[@target="AndroidManifest.xml"]');
                     configChanges.process(plugins_dir, temp, 'android');
-                    expect(spy.calls.length).toEqual(5);
+                    expect(spy.calls.length).toEqual(4);
                     expect(spy.argsForCall[0][2]).toEqual('/*');
                     expect(spy.argsForCall[1][2]).toEqual('/*');
-                    expect(spy.argsForCall[2][2]).toEqual('/widget/plugins');
-                    expect(spy.argsForCall[3][2]).toEqual('/manifest/application');
-                    expect(spy.argsForCall[4][2]).toEqual('/widget/plugins');
+                    expect(spy.argsForCall[2][2]).toEqual('/manifest/application');
+                    expect(spy.argsForCall[3][2]).toEqual('/cordova/plugins');
                 });
                 it('should not call graftXML for a config munge that already exists from
another plugin', function() {
                     shell.cp('-rf', configplugin, plugins_dir);
@@ -276,7 +270,7 @@ describe('config-changes module', function() {
 
                     var spy = spyOn(xml_helpers, 'graftXML').andReturn(true);
                     configChanges.process(plugins_dir, temp, 'android');
-                    expect(spy.calls.length).toEqual(2);
+                    expect(spy.calls.length).toEqual(1);
                 });
                 it('should not call graftXML for a config munge targeting a config file that
does not exist', function() {
                     configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin',
'android', {});
@@ -389,12 +383,11 @@ describe('config-changes module', function() {
                 configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin',
'android');
                 var spy = spyOn(xml_helpers, 'pruneXML').andReturn(true);
                 configChanges.process(plugins_dir, temp, 'android');
-                expect(spy.calls.length).toEqual(5);
+                expect(spy.calls.length).toEqual(4);
                 expect(spy.argsForCall[0][2]).toEqual('/*');
                 expect(spy.argsForCall[1][2]).toEqual('/*');
-                expect(spy.argsForCall[2][2]).toEqual('/widget/plugins');
-                expect(spy.argsForCall[3][2]).toEqual('/manifest/application');
-                expect(spy.argsForCall[4][2]).toEqual('/widget/plugins');
+                expect(spy.argsForCall[2][2]).toEqual('/manifest/application');
+                expect(spy.argsForCall[3][2]).toEqual('/cordova/plugins');
             });
             it('should generate a config munge that interpolates variables into config changes,
if applicable', function() {
                 shell.cp('-rf', android_two_project, temp);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/spec/util/xml-helpers.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/xml-helpers.spec.js b/spec/util/xml-helpers.spec.js
index 30173e0..5def06e 100644
--- a/spec/util/xml-helpers.spec.js
+++ b/spec/util/xml-helpers.spec.js
@@ -76,7 +76,7 @@ describe('xml-helpers', function(){
         var config_xml;
 
         beforeEach(function() {
-            config_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '..', 'projects',
'ios-config-xml', 'SampleApp', 'config.xml'));
+            config_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '..', 'projects',
'android_two', 'res', 'xml', 'config.xml'));
         });
 
         it('should remove any children that match the specified selector', function() {
@@ -87,11 +87,11 @@ describe('xml-helpers', function(){
         it('should do nothing if the children cannot be found', function() {
             var children = [title];
             xml_helpers.pruneXML(config_xml, children, 'plugins');
-            expect(config_xml.find('plugins').getchildren().length).toEqual(19);
+            expect(config_xml.find('plugins').getchildren().length).toEqual(17);
         });
         it('should be able to handle absolute selectors', function() {
             var children = config_xml.findall('plugins/plugin');
-            xml_helpers.pruneXML(config_xml, children, '/widget/plugins');
+            xml_helpers.pruneXML(config_xml, children, '/cordova/plugins');
             expect(config_xml.find('plugins').getchildren().length).toEqual(0);
         });
         it('should be able to handle absolute selectors with wildcards', function() {
@@ -111,12 +111,12 @@ describe('xml-helpers', function(){
 
         it('should add children to the specified selector', function() {
             var children = plugin_xml.find('config-file').getchildren();
-            xml_helpers.graftXML(config_xml, children, 'test');
-            expect(config_xml.find('test').getchildren().length).toEqual(2);
+            xml_helpers.graftXML(config_xml, children, 'plugins');
+            expect(config_xml.find('plugins').getchildren().length).toEqual(19);
         });
         it('should be able to handle absolute selectors', function() {
             var children = plugin_xml.find('config-file').getchildren();
-            xml_helpers.graftXML(config_xml, children, '/widget');
+            xml_helpers.graftXML(config_xml, children, '/cordova');
             expect(config_xml.findall('access').length).toEqual(3);
         });
         it('should be able to handle absolute selectors with wildcards', function() {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a2389296/src/util/config-changes.js
----------------------------------------------------------------------
diff --git a/src/util/config-changes.js b/src/util/config-changes.js
index d388686..0239b61 100644
--- a/src/util/config-changes.js
+++ b/src/util/config-changes.js
@@ -142,11 +142,8 @@ module.exports = {
             });
         }
 
-        // <config-file> tags without a target attribute are targeting the main config.xml.
-        // These changes get put on the 'config.xml' key, which gets special processing to
handle
-        // platform differences.
         changes.forEach(function(change) {
-            var target = change.attrib['target'] || 'config.xml';
+            var target = change.attrib['target'];
             var parent = change.attrib['parent'];
             if (!munge[target]) {
                 munge[target] = {};
@@ -170,12 +167,6 @@ module.exports = {
                 munge[target][parent][stringified] += 1;
             });
         });
-
-        // Add the <plugin> tag to the <plugins> list.
-        if (!munge['config.xml']) munge['config.xml'] = {};
-        if (!munge['config.xml']['/widget/plugins']) munge['config.xml']['/widget/plugins']
= {};
-        var pluginTag = '<plugin id="' + plugin_xml.getroot().attrib.id + '" version="'
+ plugin_xml.getroot().attrib.version + '" />';
-        munge['config.xml']['/widget/plugins'][pluginTag] = 1;
         return munge;
     },
 


Mime
View raw message