cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [4/8] cordova-lib git commit: CB-8007 Two cordova plugins modifying “*-Info.plist” CFBundleURLTypes
Date Thu, 04 Jun 2015 17:36:20 GMT
CB-8007 Two cordova plugins modifying “*-Info.plist” CFBundleURLTypes

When 2 cordova plugins are modifying the same property, only the first added plugin is getting
the changes applied


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

Branch: refs/heads/5.1.x
Commit: d26a3cf138f5cf7cf117dd198b2242ced16cbd0f
Parents: 5f8049b
Author: Brett Rudd <goya@apache.org>
Authored: Fri May 29 16:07:41 2015 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Thu Jun 4 10:24:05 2015 -0700

----------------------------------------------------------------------
 .../spec-plugman/plugins/org.apache.plist/plugin.xml      |  7 +++++++
 .../ios-config-xml/SampleApp/SampleApp-Info.plist         |  4 ++++
 cordova-lib/spec-plugman/util/config-changes.spec.js      |  7 +++----
 cordova-lib/src/plugman/util/plist-helpers.js             | 10 +++++-----
 4 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d26a3cf1/cordova-lib/spec-plugman/plugins/org.apache.plist/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.apache.plist/plugin.xml b/cordova-lib/spec-plugman/plugins/org.apache.plist/plugin.xml
index 064f72e..b7d5439 100644
--- a/cordova-lib/spec-plugman/plugins/org.apache.plist/plugin.xml
+++ b/cordova-lib/spec-plugman/plugins/org.apache.plist/plugin.xml
@@ -43,5 +43,12 @@
         </dict>
         </dict>
         </config-file>
+
+        <config-file target="*-Info.plist" parent="CFValidSchemas">
+        <array>
+            <string>schema-a</string>
+            <string>schema-b</string>
+        </array>
+        </config-file>
     </platform>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d26a3cf1/cordova-lib/spec-plugman/projects/ios-config-xml/SampleApp/SampleApp-Info.plist
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/ios-config-xml/SampleApp/SampleApp-Info.plist
b/cordova-lib/spec-plugman/projects/ios-config-xml/SampleApp/SampleApp-Info.plist
index 6010b61..1edf010 100644
--- a/cordova-lib/spec-plugman/projects/ios-config-xml/SampleApp/SampleApp-Info.plist
+++ b/cordova-lib/spec-plugman/projects/ios-config-xml/SampleApp/SampleApp-Info.plist
@@ -48,6 +48,10 @@
 	<array>
 		<string>UIInterfaceOrientationPortrait</string>
 	</array>
+	<key>CFValidSchemas</key>
+	<array>
+		<string>schema-a</string>
+	</array>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>English</string>
 	<key>CFBundleDisplayName</key>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d26a3cf1/cordova-lib/spec-plugman/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/config-changes.spec.js b/cordova-lib/spec-plugman/util/config-changes.spec.js
index 898392c..136f51f 100644
--- a/cordova-lib/spec-plugman/util/config-changes.spec.js
+++ b/cordova-lib/spec-plugman/util/config-changes.spec.js
@@ -311,16 +311,15 @@ describe('config-changes module', function() {
                     configChanges.process(plugins_dir, temp, 'ios', platformJson, pluginInfoProvider);
                     expect(fs.readFileSync(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'),
'utf-8')).toMatch(/<key>APluginNode<\/key>\n    <string><\/string>/m);
                 });
-            });
-            describe('plist merge dictionaries', function() {
-                it('should write empty string nodes with no whitespace', function() {
+                it('should merge dictionaries and arrays, removing duplicates', function()
{
                     shell.cp('-rf', ios_config_xml, temp);
                     shell.cp('-rf', plistplugin, plugins_dir);
                     var platformJson = PlatformJson.load(plugins_dir, 'ios');
                     platformJson.addInstalledPluginToPrepareQueue('org.apache.plist', {});
                     configChanges.process(plugins_dir, temp, 'ios', platformJson, pluginInfoProvider);
-
                     expect(fs.readFileSync(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'),
'utf-8')).toMatch(/<key>UINewsstandIcon<\/key>[\s\S]*<key>CFBundlePrimaryIcon<\/key>/);
+                    expect(fs.readFileSync(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'),
'utf-8')).toMatch(/<string>schema-b<\/string>/);
+                    expect(fs.readFileSync(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'),
'utf-8')).not.toMatch(/(<string>schema-a<\/string>[^]*){2,}/);
                 });
             });
             describe('of pbxproject framework files', function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d26a3cf1/cordova-lib/src/plugman/util/plist-helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/plist-helpers.js b/cordova-lib/src/plugman/util/plist-helpers.js
index 1f5cf17..8278e9f 100644
--- a/cordova-lib/src/plugman/util/plist-helpers.js
+++ b/cordova-lib/src/plugman/util/plist-helpers.js
@@ -28,12 +28,12 @@ function graftPLIST(doc, xml, selector) {
 
     var node = doc[selector];
     if (node && Array.isArray(node) && Array.isArray(obj)){
-        node.concat(obj);
+        node = node.concat(obj);
         for (var i =0;i<node.length; i++){
-          for (var j=i+1; j<node.length; ++j) {
-            if (node[i] === node[j])
-              node.splice(j--,1);
-          }
+            for (var j=i+1; j<node.length; ++j) {
+                if (node[i] === node[j])
+                    node.splice(j--,1);
+            }
         }
         doc[selector] = node;
     } else {


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


Mime
View raw message