You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/11/27 23:27:29 UTC

[30/51] [abbrv] git commit: Merge branch 'Maxime/CB-5400' Version and Id is not set correctly in Windows 8 application project file

Merge branch 'Maxime/CB-5400' Version and Id is not set correctly in Windows 8 application project file

https://issues.apache.org/jira/browse/CB-5400


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

Branch: refs/heads/fireos
Commit: 6516fa7394cc0b01e8667654247cbff7eb21fea9
Parents: f725bd9 f810232
Author: sgrebnov <se...@gmail.com>
Authored: Mon Nov 25 14:24:27 2013 +0400
Committer: sgrebnov <se...@gmail.com>
Committed: Mon Nov 25 14:24:27 2013 +0400

----------------------------------------------------------------------
 src/config_parser.js            | 16 +++++++++
 src/metadata/windows8_parser.js | 64 +++++++++++++++++++++++++-----------
 2 files changed, 60 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6516fa73/src/metadata/windows8_parser.js
----------------------------------------------------------------------
diff --cc src/metadata/windows8_parser.js
index ea21c92,9e03486..751f54d
--- a/src/metadata/windows8_parser.js
+++ b/src/metadata/windows8_parser.js
@@@ -127,28 -127,25 +129,40 @@@ module.exports.prototype = 
                              ' with a <Application> node');
          }
  
+         // Update properties
+         var properties = manifest.find('.//Properties');
+         if (properties) {
+             var displayNameElement = properties.find('.//DisplayName');
+             if (displayNameElement && displayNameElement.text != name) {
+                 displayNameElement.text = name;
+             }
+ 
+             var publisherNameElement = properties.find('.//PublisherDisplayName');
+             if (publisherNameElement && publisherNameElement.text != author) {
+                 publisherNameElement.text = author;
+             }
+         }
+ 
 +        // sort Capability elements as per CB-5350 Windows8 build fails due to invalid 'Capabilities' definition
 +        // to sort elements we remove them and then add again in the appropriate order
 +        var capabilitiesRoot = manifest.find('.//Capabilities'),
 +            capabilities = capabilitiesRoot._children;
 +
 +        capabilities.forEach(function(elem){
 +            capabilitiesRoot.remove(0, elem);
 +        });
 +        capabilities.sort(function(a, b) {
 +            return (a.tag > b.tag)? 1: -1;
 +        });
 +        capabilities.forEach(function(elem){
 +            capabilitiesRoot.append(elem);
 +        });
 +
+         // Update content (start page) element
+         this.config.content(config.content());
  
- 
-          // Update content (start page) element
-          this.config.content(config.content());
- 
-          //Write out manifest
-          fs.writeFileSync(this.manifest_path, manifest.write({indent: 4}), 'utf-8');
+         //Write out manifest
+         fs.writeFileSync(this.manifest_path, manifest.write({indent: 4}), 'utf-8');
  
      },
      // Returns the platform-specific www directory.
@@@ -282,22 -276,21 +296,32 @@@
          return Q();
      },
  
-     // to ensure app pass windows store certification
 -    // Cordova default version format is not compatible with Windows 8
++    // Adjust version number as per CB-5337 Windows8 build fails due to invalid app version        
+     fixConfigVersion: function (version) {
 -        if (version.match(/^\d+$/)) {
 -            return version.concat(".0.0.0");
 -        }
 -        else if (version.match(/^\d+\.\d+$/)) {
 -            return version.concat(".0.0");
++        var numVersionComponents = version.match(/\./g).length + 1;
++        while (numVersionComponents++ < 4) {
++            version += '.0';
+         }
 -        else if (version.match(/^\d+\.\d+\.\d+$/)) {
 -            return version.concat(".0");
 -        }
 -        else if (version.match(/^\d+\.\d+\.\d+\.\d+$/)) {
 -            return version;
 -        }
 -        else
 -            throw new Error("This version format is not recognized !");
 -    }
++        return version;
++    },
++
++    // CB-5421 Add BOM to all html, js, css files to ensure app can pass Windows Store Certification
 +    add_bom: function () {
 +        var www = this.www_dir();
 +        var files = shell.ls('-R', www);
 +
 +        files.forEach(function (file) {
 +            if (!file.match(/\.(js|html|css|json)/)) {
 +                return;
 +            }
 +
 +            var filePath = path.join(www, file);
 +            var content = fs.readFileSync(filePath);
 +
 +            if (content[0] !== 0xEF && content[1] !== 0xBE && content[2] !== 0xBB) {
 +                fs.writeFileSync(filePath, '\ufeff' + content);
 +            }
 +        });
-     }
++  	}
++
  };