Repository: cordova-windows
Updated Branches:
  refs/heads/master e6016147a -> 2222535b8


CB-10193 Add BOM to www files at build stage instead of prepare


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

Branch: refs/heads/master
Commit: 2222535b83589e71681a459b7d9d31ed177bc215
Parents: e601614
Author: Vladimir Kotikov <[email protected]>
Authored: Sat Dec 12 12:02:38 2015 +0300
Committer: Vladimir Kotikov <[email protected]>
Committed: Wed Jan 6 17:51:07 2016 +0300

----------------------------------------------------------------------
 spec/unit/build.spec.js         | 9 +++++++++
 template/cordova/lib/build.js   | 5 +++++
 template/cordova/lib/prepare.js | 4 ++--
 3 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/2222535b/spec/unit/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index 5638d63..28b4b2f 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -22,6 +22,7 @@ var Q = require('q'),
     platformRoot = '../../template',
     testPath = 'testpath',
     buildPath = path.join(platformRoot, 'cordova', 'build'),
+    prepare = require(platformRoot + '/cordova/lib/prepare.js'),
     build = rewire(platformRoot + '/cordova/lib/build.js');
 
 function createFindAvailableVersionMock(version, path, buildSpy) {
@@ -90,6 +91,14 @@ describe('run method', function() {
         findAvailableVersionOriginal = 
build.__get__('MSBuildTools.findAvailableVersion');
         applyPlatformConfigOriginal = 
build.__get__('prepare.applyPlatformConfig');
         configParserOriginal = build.__get__('ConfigParser');
+
+        var originalBuildMethod = build.run;
+        spyOn(build, 'run').andCallFake(function () {
+            // Bind original build to custom 'this' object to mock platform's 
locations property
+            return originalBuildMethod.apply({locations: {www: 'some/path'}}, 
arguments);
+        });
+
+        spyOn(prepare, 'addBOMSignature');
     });
 
     afterEach(function() {

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/2222535b/template/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index 1a268f5..9335223 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -51,6 +51,7 @@ var ROOT = path.resolve(__dirname, '../..');
 // See 'help' function for args list
 module.exports.run = function run (buildOptions) {
 
+    var that = this;
     ROOT = this.root || ROOT;
 
     if (!utils.isCordovaProject(this.root)){
@@ -63,6 +64,10 @@ module.exports.run = function run (buildOptions) {
     .then(function(msbuildTools) {
         // Apply build related configs
         prepare.updateBuildConfig(buildConfig);
+        // CB-5421 Add BOM to all html, js, css files
+        // to ensure app can pass Windows Store Certification
+        prepare.addBOMSignature(that.locations.www);
+
         if (buildConfig.publisherId) {
             updateManifestWithPublisher(msbuildTools, buildConfig);
         }

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/2222535b/template/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/prepare.js b/template/cordova/lib/prepare.js
index 9b04483..a4ef655 100644
--- a/template/cordova/lib/prepare.js
+++ b/template/cordova/lib/prepare.js
@@ -416,8 +416,6 @@ module.exports.prepare = function (cordovaProject) {
     })
     .then(function () {
         copyImages(cordovaProject.projectConfig, self.root);
-        // CB-5421 Add BOM to all html, js, css files to ensure app can pass 
Windows Store Certification
-        addBOMSignature(self.locations.www);
     })
     .then(function () {
         self.events.emit('verbose', 'Updated project successfully');
@@ -451,6 +449,8 @@ function addBOMSignature(directory) {
     });
 }
 
+module.exports.addBOMSignature = addBOMSignature;
+
 /**
  * Updates config files in project based on app's config.xml and config munge,
  *   generated by plugins.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to