You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/02/15 14:45:52 UTC

[cordova-windows] branch janpio-msbuild_cleanup updated (77c111f -> b389cfa)

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a change to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git.


    omit 77c111f  console.log msbuild command and params that are used to build
    omit a4ad1a9  avoid crosspolution in tests that rely on ENV vars (uh, ugly)
    omit 8f93821  Use MSBUILDDIR on AppVeyor
    omit 73f7ef9  Change order of builds on AppVeyor
    omit a61dc6e  MSBUILDDIR for MSBuild selection
    omit 0326134  TODO comment for future functionality
    omit f8c5ace  fix eslint
    omit 102571a  re-enable tests (but 3)
    omit d5f0c75  fix comments
    omit f835d08  switch Error to CordovaError
    omit 8e6bfaf  move method
    omit 28ed907  move filterSupportedTargets into getLatestMatchingMSBuild
    omit 920b0f4  disable some unit tests
    omit 691156a  fix eslint
    omit 55639d8  better logging for checkMSBuildVersion future method preparation
    omit eaa1a34  Visual Studio 15.5 is a thing the script should know about
    omit cca9e19  fix eslint
    omit 3d8bcee  move method
    omit c7126a4  now also remove filterSupportedTargets from build.js
    omit 0b7dd3e  restructure getLatestMSBuild to get the list of available MSBuilds itself restructure usage of MSBuildTools in build.js to that new reality (get builtTargets earlier, get msBuild instead of list, use both to filter buildTargets earlier)
    omit 6295571  move filterSupportedTargets from build.js to MSBuildTools.js
    omit 933d2f2  move method
    omit 8e7087e  clearer comment
    omit 949a609  temporary logging
    omit bd550ef  move method
    omit e2673e7  new script `check_all` that does the same thing as `cordova requirements` but can be called from the command line
    omit 8d08de2  comments in MSBuildTools.js
    omit f3eaf83  default script `check_reqs` to building 10.0 apps so it can actually return something instead of crashing
    omit d862c01  better output in `cordova requirements` when VS is chosen because of VSINSTALLDIR
     add 5c63161  CB-13877 more env information about msbuild and visual studio on appveyor (#257)
     add dccdab9  CB-13870 Improve check_reqs (#258)
     new ddcd3c0  comments in MSBuildTools.js
     new d1052f6  move method
     new b0ccae8  temporary logging
     new fd61087  clearer comment
     new 4a4e63c  move method
     new 4d912c6  move filterSupportedTargets from build.js to MSBuildTools.js
     new b00e60b  restructure getLatestMSBuild to get the list of available MSBuilds itself restructure usage of MSBuildTools in build.js to that new reality (get builtTargets earlier, get msBuild instead of list, use both to filter buildTargets earlier)
     new fee9259  now also remove filterSupportedTargets from build.js
     new d6a8e7b  move method
     new 4854849  fix eslint
     new 411e19e  Visual Studio 15.5 is a thing the script should know about
     new 50f9cab  better logging for checkMSBuildVersion future method preparation
     new 835b478  fix eslint
     new b436a4a  disable some unit tests
     new 630e076  move filterSupportedTargets into getLatestMatchingMSBuild
     new f54e360  move method
     new 3b8e013  switch Error to CordovaError
     new 918d230  fix comments
     new d20ee29  re-enable tests (but 3)
     new 60b2d9b  fix eslint
     new 6e3748b  TODO comment for future functionality
     new 79d6a0d  MSBUILDDIR for MSBuild selection
     new 5e2e523  Change order of builds on AppVeyor
     new 0fd950d  Use MSBUILDDIR on AppVeyor
     new 54fd1d1  avoid crosspolution in tests that rely on ENV vars (uh, ugly)
     new b389cfa  console.log msbuild command and params that are used to build

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (77c111f)
            \
             N -- N -- N   refs/heads/janpio-msbuild_cleanup (b389cfa)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 26 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 appveyor.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 11/26: Visual Studio 15.5 is a thing the script should know about

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 411e19e6b89ef412e22c26f4751fa678febd6911
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 20:01:03 2018 +0100

    Visual Studio 15.5 is a thing the script should know about
---
 template/cordova/lib/MSBuildTools.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 43fcb6d..3cacc3b 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -75,12 +75,12 @@ MSBuildTools.prototype.buildProject = function (projFile, buildType, buildarch,
 // returns full path to msbuild tools required to build the project and tools version
 // check_reqs.js -> run()
 module.exports.findAvailableVersion = function () {
-    var versions = ['15.0', '14.0', '12.0', '4.0'];
+    var versions = ['15.5', '15.0', '14.0', '12.0', '4.0'];
 
     return Q.all(versions.map(checkMSBuildVersion)).then(function (versions) {
         console.log('findAvailableVersion', versions);
         // select first msbuild version available, and resolve promise with it
-        var msbuildTools = versions[0] || versions[1] || versions[2] || versions[3];
+        var msbuildTools = versions[0] || versions[1] || versions[2] || versions[3] || versions[4];
 
         return msbuildTools ? Q.resolve(msbuildTools) : Q.reject('MSBuild tools not found');
     });
@@ -106,9 +106,9 @@ module.exports.findAllAvailableVersions = function () {
 };
 
 function findAllAvailableVersionsFallBack () {
-    var versions = ['15.0', '14.0', '12.0', '4.0'];
     console.log('findAllAvailableVersionsFALLBACK');
 
+    var versions = ['15.5', '15.0', '14.0', '12.0', '4.0'];
     events.emit('verbose', 'Searching for available MSBuild versions...');
 
     return Q.all(versions.map(checkMSBuildVersion)).then(function (unprocessedResults) {

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 22/26: MSBUILDDIR for MSBuild selection

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 79d6a0d5b0c6c42c07d9d8fee62f46eb2742c818
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 12:48:33 2018 +0100

    MSBUILDDIR for MSBuild selection
---
 spec/unit/build.spec.js              | 26 +++++++++++++++++++++++++-
 template/cordova/lib/MSBuildTools.js | 21 ++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index 81b2ada..ad25c99 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -371,7 +371,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.14 should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
+    it('spec.14a should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
         var customMSBuildPath = '/some/path';
         var msBuildBinPath = path.join(customMSBuildPath, 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
@@ -396,6 +396,30 @@ describe('run method', function () {
             });
     });
 
+    it('spec.14b should use user-specified msbuild if MSBUILDDIR variable is set', function (done) {
+        var msBuildBinPath = path.join('/some/path', 'MSBuild/15.0/Bin');
+        var customMSBuildVersion = '15.0';
+        process.env.MSBUILDDIR = msBuildBinPath;
+
+        spyOn(MSBuildTools, 'getMSBuildToolsAt')
+            .and.returnValue(Q({
+                path: msBuildBinPath,
+                version: customMSBuildVersion,
+                buildProject: jasmine.createSpy('buildProject').and.returnValue(Q())
+            }));
+
+        var fail = jasmine.createSpy('fail');
+
+        build.run({})
+            .fail(fail)
+            .finally(function () {
+                expect(fail).not.toHaveBeenCalled();
+                expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
+                delete process.env.MSBUILDDIR;
+                done();
+            });
+    });
+
     it('spec.15a should choose latest version if there are multiple versions available with minor version difference', function (done) {
         var fail = jasmine.createSpy('fail');
         var buildTools14 = { version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index b694fe9..2384242 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -75,9 +75,28 @@ MSBuildTools.prototype.buildProject = function (projFile, buildType, buildarch,
 // check_reqs.js -> checkMSBuild()
 module.exports.findAllAvailableVersions = function () {
     console.log('findAllAvailableVersions');
+
+    var msBuildPath = '';
+
+    // Use MSBUILDDIR environment variable if defined to find MSBuild.
+    // MSBUILDDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
+    // MSBUILDDIR = C:\Program Files (x86)\MSBuild\14.0\bin\
+    if (process.env.MSBUILDDIR) {
+        console.log('ENV var MSBUILDDIR is set', process.env.MSBUILDDIR);
+        msBuildPath = process.env.MSBUILDDIR;
+        return module.exports.getMSBuildToolsAt(msBuildPath)
+            .then(function (msBuildTools) {
+                return [msBuildTools];
+            })
+            // If MSBUILDDIR is not specified or doesn't contain a valid MSBuild
+            // - fall back to default discovery mechanism.
+            .catch(findAllAvailableVersionsFallBack);
+    }
+
     // CB-11548 use VSINSTALLDIR environment if defined to find MSBuild.
     if (process.env.VSINSTALLDIR) {
-        var msBuildPath = path.join(process.env.VSINSTALLDIR, 'MSBuild/15.0/Bin');
+        console.log('ENV var VSINSTALLDIR is set', process.env.VSINSTALLDIR);
+        msBuildPath = path.join(process.env.VSINSTALLDIR, 'MSBuild/15.0/Bin');
         return module.exports.getMSBuildToolsAt(msBuildPath)
             .then(function (msBuildTools) {
                 return [msBuildTools];

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 26/26: console.log msbuild command and params that are used to build

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit b389cfae4cc66349a91baae7c1d6e35414da134f
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 15:33:26 2018 +0100

    console.log msbuild command and params that are used to build
---
 template/cordova/lib/MSBuildTools.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 2384242..2bd4a54 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -68,6 +68,7 @@ MSBuildTools.prototype.buildProject = function (projFile, buildType, buildarch,
     }
 
     return promise.then(function () {
+        console.log('buildProject spawn:', path.join(that.path, 'msbuild'), [projFile].concat(args), { stdio: 'inherit' });
         return spawn(path.join(that.path, 'msbuild'), [projFile].concat(args), { stdio: 'inherit' });
     });
 };

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 01/26: comments in MSBuildTools.js

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit ddcd3c0dad4392d8d5c8856f5b20ffcf5af92d9b
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 18:49:43 2018 +0100

    comments in MSBuildTools.js
---
 template/cordova/lib/MSBuildTools.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index eb9d7f0..cfbf4e0 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -37,18 +37,20 @@ MSBuildTools.prototype.buildProject = function (projFile, buildType, buildarch,
     events.emit('log', '\tBuildflags    : ' + buildFlags);
     events.emit('log', '\tMSBuildTools  : ' + this.path);
 
+    // Additional requirement checks
     var checkWinSDK = function (target_platform) {
         return require('./check_reqs').isWinSDKPresent(target_platform);
     };
-
     var checkPhoneSDK = function () {
         return require('./check_reqs').isPhoneSDKPresent();
     };
 
+    // default build args
     var args = ['/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal', '/nologo',
         '/p:Configuration=' + buildType,
         '/p:Platform=' + buildarch];
 
+    // add buildFlags if present
     if (buildFlags) {
         args = args.concat(buildFlags);
     }
@@ -140,6 +142,8 @@ function checkMSBuildVersion (version) {
             return module.exports.getMSBuildToolsAt(toolsPath);
         }
     }
+
+    // older vs versions that were registered in registry
     return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\' + version, '/v', 'MSBuildToolsPath'])
         .then(function (output) {
             // fetch msbuild path from 'reg' output

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 20/26: fix eslint

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 60b2d9bc96e692b0e2c1cf759f1130bb82810eec
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 12:01:58 2018 +0100

    fix eslint
---
 template/cordova/lib/MSBuildTools.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 4c8016d..b85d711 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -189,7 +189,7 @@ module.exports.getLatestMatchingMSBuild = function (selectedBuildTargets) {
     events.emit('verbose', 'getLatestMatchingMSBuild');
     console.log('getLatestMatchingMSBuild', selectedBuildTargets);
     return this.getLatestMSBuild()
-        .then(function(msbuild) {
+        .then(function (msbuild) {
             // filter targets to make sure they are supported on this development machine
             var myBuildTargets = filterSupportedTargets(selectedBuildTargets, msbuild);
             return [msbuild, myBuildTargets];
@@ -287,7 +287,7 @@ function filterSupportedTargets (targets, msbuild) {
             'or Visual Studio 2013 Update 2 for Windows 8.1.');
     }
     return supportedTargets;
-};
+}
 
 /**
  * Lists all VS 2017+ instances dirs in ProgramData

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 19/26: re-enable tests (but 3)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit d20ee296eab41051e36dc26c48a753bfbb7e46a0
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 11:54:50 2018 +0100

    re-enable tests (but 3)
---
 spec/unit/build.spec.js | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index da35402..81b2ada 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -145,7 +145,7 @@ describe('run method', function () {
         }).toThrow();
     });
 
-    xit('should respect build configuration from \'buildConfig\' option', function (done) {
+    it('should respect build configuration from \'buildConfig\' option', function (done) {
 
         createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: jasmine.createSpy(), path: testPath }]);
         var buildConfigPath = path.resolve(__dirname, 'fixtures/fakeBuildConfig.json');
@@ -170,7 +170,7 @@ describe('run method', function () {
             });
     }, 20000);
 
-    xit('spec.4 should call buildProject of MSBuildTools with buildType = "release" if called with --release argument', function (done) {
+    it('spec.4 should call buildProject of MSBuildTools with buildType = "release" if called with --release argument', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             expect(buildType).toBe('release');
         });
@@ -184,7 +184,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.5 should call buildProject of MSBuildTools with buildType = "debug" if called without arguments', function (done) {
+    it('spec.5 should call buildProject of MSBuildTools with buildType = "debug" if called without arguments', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             expect(buildType).toBe('debug');
         });
@@ -198,7 +198,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.6 should call buildProject of MSBuildTools with buildArch = "arm" if called with --archs="arm" argument', function (done) {
+    it('spec.6 should call buildProject of MSBuildTools with buildArch = "arm" if called with --archs="arm" argument', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             expect(buildArch).toBe('arm');
         });
@@ -212,7 +212,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.7 should call buildProject of MSBuildTools once for all architectures if called with --archs="arm x86 x64 anycpu" argument', function (done) {
+    it('spec.7 should call buildProject of MSBuildTools once for all architectures if called with --archs="arm x86 x64 anycpu" argument', function (done) {
         var armBuild = jasmine.createSpy();
         var x86Build = jasmine.createSpy();
         var x64Build = jasmine.createSpy();
@@ -273,7 +273,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.9 should call buildProject of MSBuildTools if built for windows 8.1', function (done) {
+    it('spec.9 should call buildProject of MSBuildTools if built for windows 8.1', function (done) {
         var buildSpy = jasmine.createSpy();
 
         createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
@@ -305,7 +305,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.11 should call buildProject of MSBuildTools if built for windows phone 8.1', function (done) {
+    it('spec.11 should call buildProject of MSBuildTools if built for windows phone 8.1', function (done) {
         var buildSpy = jasmine.createSpy();
 
         createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
@@ -337,7 +337,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.13a should be able to override target via --appx parameter', function (done) {
+    it('spec.13a should be able to override target via --appx parameter', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             // check that we build Windows 10 and not Windows 8.1
             expect(solutionFile.toLowerCase()).toMatch('cordovaapp.windows10.jsproj');
@@ -354,7 +354,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.13b should be able to override target via --appx parameter', function (done) {
+    it('spec.13b should be able to override target via --appx parameter', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             // check that we build Windows 10 and not Windows 8.1
             expect(solutionFile.toLowerCase()).toMatch('cordovaapp.windows10.jsproj');
@@ -371,7 +371,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.14 should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
+    it('spec.14 should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
         var customMSBuildPath = '/some/path';
         var msBuildBinPath = path.join(customMSBuildPath, 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
@@ -396,7 +396,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.15a should choose latest version if there are multiple versions available with minor version difference', function (done) {
+    it('spec.15a should choose latest version if there are multiple versions available with minor version difference', function (done) {
         var fail = jasmine.createSpy('fail');
         var buildTools14 = { version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
         var buildTools15 = { version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
@@ -413,7 +413,7 @@ describe('run method', function () {
             });
     });
 
-    xit('spec.15b should choose latest version if there are multiple versions available with minor version difference', function (done) {
+    it('spec.15b should choose latest version if there are multiple versions available with minor version difference', function (done) {
         var fail = jasmine.createSpy('fail');
         var buildTools14 = { version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
         var buildTools15 = { version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
@@ -470,7 +470,7 @@ describe('buildFlags', function () {
             });
         });
 
-        xit('should pass buildFlags directly to MSBuild', function (done) {
+        it('should pass buildFlags directly to MSBuild', function (done) {
             var fail = jasmine.createSpy('fail');
             var buildTools = { version: '14.0', buildProject: jasmine.createSpy('buildProject').and.returnValue(Q()), path: testPath };
             var buildOptions = {

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 06/26: move filterSupportedTargets from build.js to MSBuildTools.js

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 4d912c692481e4f673781c52e26b135d447c452b
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:19:48 2018 +0100

    move filterSupportedTargets from build.js to MSBuildTools.js
---
 template/cordova/lib/MSBuildTools.js | 60 ++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index adb2676..80a9fcf 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -236,6 +236,66 @@ module.exports.getLatestMSBuild = function (allMsBuildVersions) {
         return availableVersions[0];
     }
 };
+var projFiles = {
+    phone: 'CordovaApp.Phone.jsproj',
+    win: 'CordovaApp.Windows.jsproj',
+    win10: 'CordovaApp.Windows10.jsproj'
+};
+
+// TODO: Fix this so that it outlines supported versions based on version criteria:
+// - v14: Windows 8.1, Windows 10
+// - v12: Windows 8.1
+function msBuild12TargetsFilter (target) {
+    return target === projFiles.win || target === projFiles.phone;
+}
+
+function msBuild14TargetsFilter (target) {
+    return target === projFiles.win || target === projFiles.phone || target === projFiles.win10;
+}
+
+function msBuild15TargetsFilter (target) {
+    return target === projFiles.win || target === projFiles.phone || target === projFiles.win10;
+}
+
+function msBuild155TargetsFilter (target) {
+    return target === projFiles.win10;
+}
+
+MSBuildTools.prototype.filterSupportedTargets = function(targets) {
+    var msbuild = this;
+    console.log('MSBuildTools->filterSupportedTargets', targets, msbuild);
+    if (!targets || targets.length === 0) {
+        events.emit('warn', 'No build targets specified');
+        return [];
+    }
+
+    var targetFilters = {
+        '12.0': msBuild12TargetsFilter,
+        '14.0': msBuild14TargetsFilter,
+        '15.x': msBuild15TargetsFilter,
+        '15.5': msBuild155TargetsFilter,
+        get: function (version) {
+            // Apart from exact match also try to get filter for version range
+            // so we can find for example targets for version '15.1'
+            return this[version] || this[version.replace(/\.\d+$/, '.x')];
+        }
+    };
+
+    var filter = targetFilters.get(msbuild.version);
+    if (!filter) {
+        events.emit('warn', 'MSBuild v' + msbuild.version + ' is not supported, aborting.');
+        return [];
+    }
+
+    var supportedTargets = targets.filter(filter);
+    // unsupported targets have been detected
+    if (supportedTargets.length !== targets.length) {
+        events.emit('warn', 'Not all desired build targets are compatible with the current build environment. ' +
+            'Please install Visual Studio 2015 for Windows 8.1 and Windows 10, ' +
+            'or Visual Studio 2013 Update 2 for Windows 8.1.');
+    }
+    return supportedTargets;
+}
 
 /**
  * Lists all VS 2017+ instances dirs in ProgramData

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 25/26: avoid crosspolution in tests that rely on ENV vars (uh, ugly)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 54fd1d12350b76a60e670cec6980b51e178de537
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 13:00:38 2018 +0100

    avoid crosspolution in tests that rely on ENV vars (uh, ugly)
---
 spec/unit/build.spec.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index ad25c99..f9f55fa 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -376,6 +376,9 @@ describe('run method', function () {
         var msBuildBinPath = path.join(customMSBuildPath, 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
         process.env.VSINSTALLDIR = customMSBuildPath;
+        // avoid crosspollution with MSBUILDDIR
+        var backupMSBUILDDIR = process.env.MSBUILDDIR;
+        delete process.env.MSBUILDDIR;
 
         spyOn(MSBuildTools, 'getMSBuildToolsAt')
             .and.returnValue(Q({
@@ -392,6 +395,7 @@ describe('run method', function () {
                 expect(fail).not.toHaveBeenCalled();
                 expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
                 delete process.env.VSINSTALLDIR;
+                process.env.MSBUILDDIR = backupMSBUILDDIR;
                 done();
             });
     });
@@ -400,6 +404,9 @@ describe('run method', function () {
         var msBuildBinPath = path.join('/some/path', 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
         process.env.MSBUILDDIR = msBuildBinPath;
+        // avoid crosspollution with VSINSTALLDIR
+        var backupVSINSTALLDIR = process.env.VSINSTALLDIR;
+        delete process.env.VSINSTALLDIR;
 
         spyOn(MSBuildTools, 'getMSBuildToolsAt')
             .and.returnValue(Q({
@@ -416,6 +423,7 @@ describe('run method', function () {
                 expect(fail).not.toHaveBeenCalled();
                 expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
                 delete process.env.MSBUILDDIR;
+                process.env.VSINSTALLDIR = backupVSINSTALLDIR;
                 done();
             });
     });

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 04/26: clearer comment

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit fd610872a3515e7b4cd99597f06d0a16bc103a18
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:15:20 2018 +0100

    clearer comment
---
 template/cordova/lib/MSBuildTools.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 261aa72..fa4ca38 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -89,16 +89,17 @@ module.exports.findAvailableVersion = function () {
 // build.js -> run()
 // check_reqs.js -> checkMSBuild()
 module.exports.findAllAvailableVersions = function () {
-    // CB-11548 use VSINSTALLDIR environment if defined to find MSBuild. If VSINSTALLDIR
-    // is not specified or doesn't contain the MSBuild path we are looking for - fall back
-    // to default discovery mechanism.
     console.log('findAllAvailableVersions');
+    // CB-11548 use VSINSTALLDIR environment if defined to find MSBuild. 
     if (process.env.VSINSTALLDIR) {
         var msBuildPath = path.join(process.env.VSINSTALLDIR, 'MSBuild/15.0/Bin');
         return module.exports.getMSBuildToolsAt(msBuildPath)
             .then(function (msBuildTools) {
                 return [msBuildTools];
-            }).catch(findAllAvailableVersionsFallBack);
+            })
+            // If VSINSTALLDIR is not specified or doesn't contain the MSBuild path we are 
+            // looking for - fall back to default discovery mechanism.
+            .catch(findAllAvailableVersionsFallBack);
     }
 
     return findAllAvailableVersionsFallBack();

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 15/26: move filterSupportedTargets into getLatestMatchingMSBuild

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 630e076bcecb862274f42dc77e01caf7fe2e7a71
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 00:03:12 2018 +0100

    move filterSupportedTargets into getLatestMatchingMSBuild
---
 template/cordova/lib/MSBuildTools.js | 12 +++++++-----
 template/cordova/lib/build.js        |  6 +++---
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index b8f7ea5..8fc16c3 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -188,9 +188,12 @@ function checkMSBuildVersion (version) {
 module.exports.getLatestMatchingMSBuild = function (selectedBuildTargets) {
     events.emit('verbose', 'getLatestMatchingMSBuild');
     console.log('getLatestMatchingMSBuild', selectedBuildTargets);
-    var msbuild = this.getLatestMSBuild();
-    // we don't do anything with selectedBuildTargets yet, but could theoretically nope out if this msbuild doesn't work for that target
-    return msbuild;
+    return this.getLatestMSBuild()
+        .then(function(msbuild) {
+            // filter targets to make sure they are supported on this development machine
+            var myBuildTargets = filterSupportedTargets(selectedBuildTargets, msbuild);
+            return [msbuild, myBuildTargets];
+        });
 };
 
 // gets the latest MSBuild version from a list of versions
@@ -251,8 +254,7 @@ function msBuild155TargetsFilter (target) {
     return target === projFiles.win10;
 }
 
-MSBuildTools.prototype.filterSupportedTargets = function (targets) {
-    var msbuild = this;
+function filterSupportedTargets (targets, msbuild) {
     console.log('MSBuildTools->filterSupportedTargets', targets, msbuild);
     if (!targets || targets.length === 0) {
         events.emit('warn', 'No build targets specified');
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index d06c8ec..ea92dde 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -61,10 +61,10 @@ module.exports.run = function run (buildOptions) {
     var selectedBuildTargets = getBuildTargets(buildConfig.win, buildConfig.phone, buildConfig.projVerOverride, buildConfig);
 
     return MSBuildTools.getLatestMatchingMSBuild(selectedBuildTargets) // get latest msbuild tools
-        .then(function (msbuild) {
+        .then(function (result) {
 
-            // filter targets to make sure they are supported on this development machine
-            var myBuildTargets = msbuild.filterSupportedTargets(selectedBuildTargets);
+            var msbuild = result[0];
+            var myBuildTargets = result[1];
 
             // Apply build related configs
             prepare.updateBuildConfig(buildConfig);

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 21/26: TODO comment for future functionality

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 6e3748b3ef8146fbf78d2b6811ed4c6eec07e710
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 12:42:24 2018 +0100

    TODO comment for future functionality
---
 template/cordova/lib/MSBuildTools.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index b85d711..b694fe9 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -188,6 +188,10 @@ function checkMSBuildVersion (version) {
 module.exports.getLatestMatchingMSBuild = function (selectedBuildTargets) {
     events.emit('verbose', 'getLatestMatchingMSBuild');
     console.log('getLatestMatchingMSBuild', selectedBuildTargets);
+    // TODO
+    // 1. findAllAvailableVersions
+    // 2. filter down to versions that can build all selectedBuildTargets
+    // 3. filter for latest one of those
     return this.getLatestMSBuild()
         .then(function (msbuild) {
             // filter targets to make sure they are supported on this development machine

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 05/26: move method

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 4a4e63c55457a7a919f6dcec0a6f7438839406ae
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:17:05 2018 +0100

    move method
---
 template/cordova/lib/MSBuildTools.js | 54 ++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index fa4ca38..adb2676 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -210,6 +210,33 @@ module.exports.getAvailableUAPVersions = function () {
     return result;
 };
 
+// gets the latest MSBuild version from a list of versions
+module.exports.getLatestMSBuild = function (allMsBuildVersions) {
+    events.emit('verbose', 'getLatestMSBuild');
+
+    var availableVersions = allMsBuildVersions
+        .filter(function (buildTools) {
+            // Sanitize input - filter out tools w/ invalid versions
+            return Version.tryParse(buildTools.version);
+        }).sort(function (a, b) {
+            // Sort tools list - use parsed Version objects for that
+            // to respect both major and minor versions segments
+            var parsedA = Version.fromString(a.version);
+            var parsedB = Version.fromString(b.version);
+
+            if (parsedA.gt(parsedB)) return -1;
+            if (parsedA.eq(parsedB)) return 0;
+            return 1;
+        });
+
+    console.log('availableVersions', availableVersions);
+
+    if (availableVersions.length > 0) {
+        // After sorting the first item will be the highest version available
+        return availableVersions[0];
+    }
+};
+
 /**
  * Lists all VS 2017+ instances dirs in ProgramData
  *
@@ -259,30 +286,3 @@ module.exports.getWillowInstallations = function () {
     });
     return installations;
 };
-
-// gets the latest MSBuild version from a list of versions
-module.exports.getLatestMSBuild = function (allMsBuildVersions) {
-    events.emit('verbose', 'getLatestMSBuild');
-
-    var availableVersions = allMsBuildVersions
-        .filter(function (buildTools) {
-            // Sanitize input - filter out tools w/ invalid versions
-            return Version.tryParse(buildTools.version);
-        }).sort(function (a, b) {
-            // Sort tools list - use parsed Version objects for that
-            // to respect both major and minor versions segments
-            var parsedA = Version.fromString(a.version);
-            var parsedB = Version.fromString(b.version);
-
-            if (parsedA.gt(parsedB)) return -1;
-            if (parsedA.eq(parsedB)) return 0;
-            return 1;
-        });
-
-    console.log('availableVersions', availableVersions);
-
-    if (availableVersions.length > 0) {
-        // After sorting the first item will be the highest version available
-        return availableVersions[0];
-    }
-};

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 03/26: temporary logging

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit b0ccae81dfcfd3d5d86ba582cb6ef4dc966e269e
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:11:21 2018 +0100

    temporary logging
---
 template/cordova/lib/MSBuildTools.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 0444ba3..261aa72 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -78,6 +78,7 @@ module.exports.findAvailableVersion = function () {
     var versions = ['15.0', '14.0', '12.0', '4.0'];
 
     return Q.all(versions.map(checkMSBuildVersion)).then(function (versions) {
+        console.log('findAvailableVersion', versions);
         // select first msbuild version available, and resolve promise with it
         var msbuildTools = versions[0] || versions[1] || versions[2] || versions[3];
 
@@ -91,6 +92,7 @@ module.exports.findAllAvailableVersions = function () {
     // CB-11548 use VSINSTALLDIR environment if defined to find MSBuild. If VSINSTALLDIR
     // is not specified or doesn't contain the MSBuild path we are looking for - fall back
     // to default discovery mechanism.
+    console.log('findAllAvailableVersions');
     if (process.env.VSINSTALLDIR) {
         var msBuildPath = path.join(process.env.VSINSTALLDIR, 'MSBuild/15.0/Bin');
         return module.exports.getMSBuildToolsAt(msBuildPath)
@@ -104,6 +106,8 @@ module.exports.findAllAvailableVersions = function () {
 
 function findAllAvailableVersionsFallBack () {
     var versions = ['15.0', '14.0', '12.0', '4.0'];
+    console.log('findAllAvailableVersionsFALLBACK');
+
     events.emit('verbose', 'Searching for available MSBuild versions...');
 
     return Q.all(versions.map(checkMSBuildVersion)).then(function (unprocessedResults) {
@@ -120,6 +124,7 @@ function findAllAvailableVersionsFallBack () {
  * @returns  Promise<MSBuildTools>  The MSBuildTools instance at specified location
  */
 module.exports.getMSBuildToolsAt = function (location) {
+    console.log('getMSBuildToolsAt', location);
     var msbuildExe = path.resolve(location, 'msbuild');
 
     // TODO: can we account on these params availability and printed version format?
@@ -127,18 +132,31 @@ module.exports.getMSBuildToolsAt = function (location) {
         .then(function (output) {
             // MSBuild prints its' version as 14.0.25123.0, so we pick only first 2 segments
             var version = output.match(/^(\d+\.\d+)/)[1];
+            console.log('return new MSBuildTools', version, location)
             return new MSBuildTools(version, location);
         });
 };
 
 function checkMSBuildVersion (version) {
+    console.log('checkMSBuildVersion', version);
+    
     // first, check if we have a VS 2017+ with such a version
-    var correspondingWillow = module.exports.getWillowInstallations().filter(function (inst) {
+    var willows = module.exports.getWillowInstallations();
+    console.log('willows', willows);
+    var correspondingWillows = willows.filter(function (inst) {
+        console.log('correspondingWillow', inst.version === version);
         return inst.version === version;
-    })[0];
+    });
+    console.log('correspondingWillows', correspondingWillows);
+    var correspondingWillow = correspondingWillows[1];
     if (correspondingWillow) {
+        // TODO adapt for 15.5=>15.0 case
+        version = '15.0';
         var toolsPath = path.join(correspondingWillow.path, 'MSBuild', version, 'Bin');
+        console.log('correspondingWillow:', toolsPath);
         if (shell.test('-e', toolsPath)) {
+            console.log('correspondingWillow:', toolsPath, module.exports.getMSBuildToolsAt(toolsPath));
+            // TODO check for JavaScript folder
             return module.exports.getMSBuildToolsAt(toolsPath);
         }
     }
@@ -146,6 +164,7 @@ function checkMSBuildVersion (version) {
     // older vs versions that were registered in registry
     return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\' + version, '/v', 'MSBuildToolsPath'])
         .then(function (output) {
+            console.log('spawn', output);
             // fetch msbuild path from 'reg' output
             var toolsPath = /MSBuildToolsPath\s+REG_SZ\s+(.*)/i.exec(output);
             if (toolsPath) {
@@ -159,6 +178,7 @@ function checkMSBuildVersion (version) {
                 return new MSBuildTools(version, toolsPath);
             }
         }).catch(function (err) { /* eslint handle-callback-err : 0 */
+            console.log('no reg result', version, err);
             // if 'reg' exits with error, assume that registry key not found
         });
 }

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 23/26: Change order of builds on AppVeyor

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 5e2e523733c6b614a519802c764971cb8ad29c61
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 12:49:24 2018 +0100

    Change order of builds on AppVeyor
---
 appveyor.yml | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 382664e..28247ec 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -19,13 +19,19 @@
 # appveyor file
 # http://www.appveyor.com/docs/appveyor-yml
 
-image:
-- Visual Studio 2015
-- Visual Studio 2017
 environment:
   matrix:
-    - nodejs_version: "4"
     - nodejs_version: "6"
+      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+
+    - nodejs_version: "6"
+      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+
+    - nodejs_version: "4"
+      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+
+    - nodejs_version: "4"
+      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
 
 install:
   - ps: Install-Product node $env:nodejs_version

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 14/26: disable some unit tests

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit b436a4a8f3046508e6543e96ffe4bca2e8396f42
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 22:31:26 2018 +0100

    disable some unit tests
---
 spec/unit/build.spec.js | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index b3a9351..da35402 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -145,7 +145,7 @@ describe('run method', function () {
         }).toThrow();
     });
 
-    it('should respect build configuration from \'buildConfig\' option', function (done) {
+    xit('should respect build configuration from \'buildConfig\' option', function (done) {
 
         createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: jasmine.createSpy(), path: testPath }]);
         var buildConfigPath = path.resolve(__dirname, 'fixtures/fakeBuildConfig.json');
@@ -170,7 +170,7 @@ describe('run method', function () {
             });
     }, 20000);
 
-    it('spec.4 should call buildProject of MSBuildTools with buildType = "release" if called with --release argument', function (done) {
+    xit('spec.4 should call buildProject of MSBuildTools with buildType = "release" if called with --release argument', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             expect(buildType).toBe('release');
         });
@@ -184,7 +184,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.5 should call buildProject of MSBuildTools with buildType = "debug" if called without arguments', function (done) {
+    xit('spec.5 should call buildProject of MSBuildTools with buildType = "debug" if called without arguments', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             expect(buildType).toBe('debug');
         });
@@ -198,7 +198,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.6 should call buildProject of MSBuildTools with buildArch = "arm" if called with --archs="arm" argument', function (done) {
+    xit('spec.6 should call buildProject of MSBuildTools with buildArch = "arm" if called with --archs="arm" argument', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             expect(buildArch).toBe('arm');
         });
@@ -212,7 +212,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.7 should call buildProject of MSBuildTools once for all architectures if called with --archs="arm x86 x64 anycpu" argument', function (done) {
+    xit('spec.7 should call buildProject of MSBuildTools once for all architectures if called with --archs="arm x86 x64 anycpu" argument', function (done) {
         var armBuild = jasmine.createSpy();
         var x86Build = jasmine.createSpy();
         var x64Build = jasmine.createSpy();
@@ -254,7 +254,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.8 should fail buildProject if built with MSBuildTools version 4.0', function (done) {
+    xit('spec.8 should fail buildProject if built with MSBuildTools version 4.0', function (done) {
         var buildSpy = jasmine.createSpy();
         var errorSpy = jasmine.createSpy();
 
@@ -273,7 +273,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.9 should call buildProject of MSBuildTools if built for windows 8.1', function (done) {
+    xit('spec.9 should call buildProject of MSBuildTools if built for windows 8.1', function (done) {
         var buildSpy = jasmine.createSpy();
 
         createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
@@ -286,7 +286,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.10 should throw an error if windows-target-version has unsupported value', function (done) {
+    xit('spec.10 should throw an error if windows-target-version has unsupported value', function (done) {
         var buildSpy = jasmine.createSpy();
         var errorSpy = jasmine.createSpy();
 
@@ -305,7 +305,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.11 should call buildProject of MSBuildTools if built for windows phone 8.1', function (done) {
+    xit('spec.11 should call buildProject of MSBuildTools if built for windows phone 8.1', function (done) {
         var buildSpy = jasmine.createSpy();
 
         createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
@@ -318,7 +318,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.12 should throw an error if windows-phone-target-version has unsupported value', function (done) {
+    xit('spec.12 should throw an error if windows-phone-target-version has unsupported value', function (done) {
         var buildSpy = jasmine.createSpy();
         var errorSpy = jasmine.createSpy();
 
@@ -337,7 +337,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.13a should be able to override target via --appx parameter', function (done) {
+    xit('spec.13a should be able to override target via --appx parameter', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             // check that we build Windows 10 and not Windows 8.1
             expect(solutionFile.toLowerCase()).toMatch('cordovaapp.windows10.jsproj');
@@ -354,7 +354,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.13b should be able to override target via --appx parameter', function (done) {
+    xit('spec.13b should be able to override target via --appx parameter', function (done) {
         var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
             // check that we build Windows 10 and not Windows 8.1
             expect(solutionFile.toLowerCase()).toMatch('cordovaapp.windows10.jsproj');
@@ -371,7 +371,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.14 should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
+    xit('spec.14 should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
         var customMSBuildPath = '/some/path';
         var msBuildBinPath = path.join(customMSBuildPath, 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
@@ -396,7 +396,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.15a should choose latest version if there are multiple versions available with minor version difference', function (done) {
+    xit('spec.15a should choose latest version if there are multiple versions available with minor version difference', function (done) {
         var fail = jasmine.createSpy('fail');
         var buildTools14 = { version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
         var buildTools15 = { version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
@@ -413,7 +413,7 @@ describe('run method', function () {
             });
     });
 
-    it('spec.15b should choose latest version if there are multiple versions available with minor version difference', function (done) {
+    xit('spec.15b should choose latest version if there are multiple versions available with minor version difference', function (done) {
         var fail = jasmine.createSpy('fail');
         var buildTools14 = { version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
         var buildTools15 = { version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
@@ -470,7 +470,7 @@ describe('buildFlags', function () {
             });
         });
 
-        it('should pass buildFlags directly to MSBuild', function (done) {
+        xit('should pass buildFlags directly to MSBuild', function (done) {
             var fail = jasmine.createSpy('fail');
             var buildTools = { version: '14.0', buildProject: jasmine.createSpy('buildProject').and.returnValue(Q()), path: testPath };
             var buildOptions = {

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 08/26: now also remove filterSupportedTargets from build.js

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit fee9259129d89d4d0890683ffa68e3ccf620e6bc
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:26:23 2018 +0100

    now also remove filterSupportedTargets from build.js
---
 template/cordova/lib/build.js | 48 -------------------------------------------
 1 file changed, 48 deletions(-)

diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index 0b09d32..efbf22b 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -438,54 +438,6 @@ function clearIntermediatesAndGetPackage (bundleTerms, config, hasAnyCpu) {
     return pckage.getPackageFileInfo(finalFile);
 }
 
-// TODO: Fix this so that it outlines supported versions based on version criteria:
-// - v14: Windows 8.1, Windows 10
-// - v12: Windows 8.1
-function msBuild12TargetsFilter (target) {
-    return target === projFiles.win || target === projFiles.phone;
-}
-
-function msBuild14TargetsFilter (target) {
-    return target === projFiles.win || target === projFiles.phone || target === projFiles.win10;
-}
-
-function msBuild15TargetsFilter (target) {
-    return target === projFiles.win || target === projFiles.phone || target === projFiles.win10;
-}
-
-function filterSupportedTargets (targets, msbuild) {
-    if (!targets || targets.length === 0) {
-        events.emit('warn', 'No build targets specified');
-        return [];
-    }
-
-    var targetFilters = {
-        '12.0': msBuild12TargetsFilter,
-        '14.0': msBuild14TargetsFilter,
-        '15.x': msBuild15TargetsFilter,
-        get: function (version) {
-            // Apart from exact match also try to get filter for version range
-            // so we can find for example targets for version '15.1'
-            return this[version] || this[version.replace(/\.\d+$/, '.x')];
-        }
-    };
-
-    var filter = targetFilters.get(msbuild.version);
-    if (!filter) {
-        events.emit('warn', 'MSBuild v' + msbuild.version + ' is not supported, aborting.');
-        return [];
-    }
-
-    var supportedTargets = targets.filter(filter);
-    // unsupported targets have been detected
-    if (supportedTargets.length !== targets.length) {
-        events.emit('warn', 'Not all desired build targets are compatible with the current build environment. ' +
-            'Please install Visual Studio 2015 for Windows 8.1 and Windows 10, ' +
-            'or Visual Studio 2013 Update 2 for Windows 8.1.');
-    }
-    return supportedTargets;
-}
-
 function cleanIntermediates () {
     var buildPath = path.join(ROOT, 'build');
     if (shell.test('-e', buildPath)) {

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 17/26: switch Error to CordovaError

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 3b8e0133f6d453f16aab3bb5d127490b43720d3b
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 11:53:47 2018 +0100

    switch Error to CordovaError
---
 template/cordova/lib/build.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index ea92dde..d172736 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -130,7 +130,7 @@ function getBuildTargets (isWinSwitch, isPhoneSwitch, projOverride, buildConfig)
             }
             break;
         default:
-            throw new Error('Unsupported windows-phone-target-version value: ' + windowsPhoneTargetVersion);
+            throw new CordovaError('Unsupported windows-phone-target-version value: ' + windowsPhoneTargetVersion);
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 16/26: move method

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit f54e3607b42526dc8d2c8adda177b5572523933f
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 00:47:40 2018 +0100

    move method
---
 template/cordova/lib/MSBuildTools.js | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 8fc16c3..53e2c20 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -72,20 +72,6 @@ MSBuildTools.prototype.buildProject = function (projFile, buildType, buildarch,
     });
 };
 
-// returns full path to msbuild tools required to build the project and tools version
-// check_reqs.js -> run()
-module.exports.findAvailableVersion = function () {
-    var versions = ['15.5', '15.0', '14.0', '12.0', '4.0'];
-
-    return Q.all(versions.map(checkMSBuildVersion)).then(function (versions) {
-        console.log('findAvailableVersion', versions);
-        // select first msbuild version available, and resolve promise with it
-        var msbuildTools = versions[0] || versions[1] || versions[2] || versions[3] || versions[4];
-
-        return msbuildTools ? Q.resolve(msbuildTools) : Q.reject('MSBuild tools not found');
-    });
-};
-
 // build.js -> run()
 // check_reqs.js -> checkMSBuild()
 module.exports.findAllAvailableVersions = function () {
@@ -118,6 +104,20 @@ function findAllAvailableVersionsFallBack () {
     });
 }
 
+// returns full path to msbuild tools required to build the project and tools version
+// check_reqs.js -> run()
+module.exports.findAvailableVersion = function () {
+    var versions = ['15.5', '15.0', '14.0', '12.0', '4.0'];
+
+    return Q.all(versions.map(checkMSBuildVersion)).then(function (versions) {
+        console.log('findAvailableVersion', versions);
+        // select first msbuild version available, and resolve promise with it
+        var msbuildTools = versions[0] || versions[1] || versions[2] || versions[3] || versions[4];
+
+        return msbuildTools ? Q.resolve(msbuildTools) : Q.reject('MSBuild tools not found');
+    });
+};
+
 /**
  * Gets MSBuildTools instance for user-specified location
  *

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 13/26: fix eslint

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 835b478be28fe1a1ef6c7db4e3e32f26114723d5
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 20:37:31 2018 +0100

    fix eslint
---
 template/cordova/lib/MSBuildTools.js | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index cc86d9f..b8f7ea5 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -143,12 +143,12 @@ function checkMSBuildVersion (version) {
 
     // first, check if we have a VS 2017+ with such a version
     var willows = module.exports.getWillowInstallations();
-    //console.log('willows', willows);
+    // console.log('willows', willows);
     var correspondingWillows = willows.filter(function (inst) {
-        //console.log('willows.filter', inst.version, version, inst.version === version);
+        // console.log('willows.filter', inst.version, version, inst.version === version);
         return inst.version === version;
     });
-    //console.log('correspondingWillows', correspondingWillows);
+    // console.log('correspondingWillows', correspondingWillows);
     var correspondingWillow = correspondingWillows[0]; // TODO Do not only handle one!
     if (correspondingWillow) {
         version = '15.0';
@@ -157,7 +157,7 @@ function checkMSBuildVersion (version) {
         console.log('from list of VS installations: ', correspondingWillows);
         if (shell.test('-e', toolsPath)) {
             var msbuild = module.exports.getMSBuildToolsAt(toolsPath);
-            console.log('selected VS exists:', toolsPath, );
+            console.log('selected VS exists:', toolsPath);
             // TODO check for JavaScript folder
             return msbuild;
         }
@@ -183,8 +183,6 @@ function checkMSBuildVersion (version) {
             console.log('no registry result for version ' + version);
             // if 'reg' exits with error, assume that registry key not found
         });
-
-    console.log('no msbuild found with version ', version);
 }
 
 module.exports.getLatestMatchingMSBuild = function (selectedBuildTargets) {

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 18/26: fix comments

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 918d2303eef2aee145d3696b5a1d9b71df30b973
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 11:54:18 2018 +0100

    fix comments
---
 template/cordova/lib/MSBuildTools.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 53e2c20..4c8016d 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -72,7 +72,6 @@ MSBuildTools.prototype.buildProject = function (projFile, buildType, buildarch,
     });
 };
 
-// build.js -> run()
 // check_reqs.js -> checkMSBuild()
 module.exports.findAllAvailableVersions = function () {
     console.log('findAllAvailableVersions');
@@ -185,6 +184,7 @@ function checkMSBuildVersion (version) {
         });
 }
 
+// build.js -> run()
 module.exports.getLatestMatchingMSBuild = function (selectedBuildTargets) {
     events.emit('verbose', 'getLatestMatchingMSBuild');
     console.log('getLatestMatchingMSBuild', selectedBuildTargets);

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 09/26: move method

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit d6a8e7b11ceba7b2b82c27ba4bbe6c8ba94d3078
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:30:31 2018 +0100

    move method
---
 template/cordova/lib/MSBuildTools.js | 51 ++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 5d9fe2c..43dcf25 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -184,31 +184,6 @@ function checkMSBuildVersion (version) {
         });
 }
 
-// returns an array of available UAP Versions
-// prepare.js
-module.exports.getAvailableUAPVersions = function () {
-    var programFilesFolder = process.env['ProgramFiles(x86)'] || process.env['ProgramFiles'];
-    // No Program Files folder found, so we won't be able to find UAP SDK
-    if (!programFilesFolder) return [];
-
-    var uapFolderPath = path.join(programFilesFolder, 'Windows Kits', '10', 'Platforms', 'UAP');
-    if (!shell.test('-e', uapFolderPath)) {
-        return []; // No UAP SDK exists on this machine
-    }
-
-    var result = [];
-    shell.ls(uapFolderPath).filter(function (uapDir) {
-        return shell.test('-d', path.join(uapFolderPath, uapDir));
-    }).map(function (folder) {
-        return Version.tryParse(folder);
-    }).forEach(function (version, index) {
-        if (version) {
-            result.push(version);
-        }
-    });
-
-    return result;
-};
 
 // gets the latest MSBuild version from a list of versions
 module.exports.getLatestMSBuild = function () {
@@ -354,3 +329,29 @@ module.exports.getWillowInstallations = function () {
     });
     return installations;
 };
+
+// returns an array of available UAP Versions
+// prepare.js
+module.exports.getAvailableUAPVersions = function () {
+    var programFilesFolder = process.env['ProgramFiles(x86)'] || process.env['ProgramFiles'];
+    // No Program Files folder found, so we won't be able to find UAP SDK
+    if (!programFilesFolder) return [];
+
+    var uapFolderPath = path.join(programFilesFolder, 'Windows Kits', '10', 'Platforms', 'UAP');
+    if (!shell.test('-e', uapFolderPath)) {
+        return []; // No UAP SDK exists on this machine
+    }
+
+    var result = [];
+    shell.ls(uapFolderPath).filter(function (uapDir) {
+        return shell.test('-d', path.join(uapFolderPath, uapDir));
+    }).map(function (folder) {
+        return Version.tryParse(folder);
+    }).forEach(function (version, index) {
+        if (version) {
+            result.push(version);
+        }
+    });
+
+    return result;
+};
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 07/26: restructure getLatestMSBuild to get the list of available MSBuilds itself restructure usage of MSBuildTools in build.js to that new reality (get builtTargets earlier, get msBuild instead of list, use both to filter buildTargets earlier)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit b00e60b4ac747bb3e7b332131b5d6d08854a2fc9
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:26:04 2018 +0100

    restructure getLatestMSBuild to get the list of available MSBuilds itself
    restructure usage of MSBuildTools in build.js to that new reality (get builtTargets earlier, get msBuild instead of list, use both to filter buildTargets earlier)
---
 template/cordova/lib/MSBuildTools.js | 50 +++++++++++++++++++++---------------
 template/cordova/lib/build.js        | 33 ++++++++++++------------
 2 files changed, 45 insertions(+), 38 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 80a9fcf..5d9fe2c 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -211,31 +211,39 @@ module.exports.getAvailableUAPVersions = function () {
 };
 
 // gets the latest MSBuild version from a list of versions
-module.exports.getLatestMSBuild = function (allMsBuildVersions) {
+module.exports.getLatestMSBuild = function () {
     events.emit('verbose', 'getLatestMSBuild');
 
-    var availableVersions = allMsBuildVersions
-        .filter(function (buildTools) {
-            // Sanitize input - filter out tools w/ invalid versions
-            return Version.tryParse(buildTools.version);
-        }).sort(function (a, b) {
-            // Sort tools list - use parsed Version objects for that
-            // to respect both major and minor versions segments
-            var parsedA = Version.fromString(a.version);
-            var parsedB = Version.fromString(b.version);
-
-            if (parsedA.gt(parsedB)) return -1;
-            if (parsedA.eq(parsedB)) return 0;
-            return 1;
-        });
+    return this.findAllAvailableVersions()
+        .then(function (allMsBuildVersions) {
+
+            var availableVersions = allMsBuildVersions
+                .filter(function (buildTools) {
+                    // Sanitize input - filter out tools w/ invalid versions
+                    return Version.tryParse(buildTools.version);
+                }).sort(function (a, b) {
+                    // Sort tools list - use parsed Version objects for that
+                    // to respect both major and minor versions segments
+                    var parsedA = Version.fromString(a.version);
+                    var parsedB = Version.fromString(b.version);
+
+                    if (parsedA.gt(parsedB)) return -1;
+                    if (parsedA.eq(parsedB)) return 0;
+                    return 1;
+                });
+
+            console.log('availableVersions', availableVersions);
+
+            if (availableVersions.length > 0) {
+                // After sorting the first item will be the highest version available
+                msbuild = availableVersions[0];
+                events.emit('verbose', 'Using MSBuild v' + msbuild.version + ' from ' + msbuild.path);
+                return msbuild;
+            }
+    });
+};
 
-    console.log('availableVersions', availableVersions);
 
-    if (availableVersions.length > 0) {
-        // After sorting the first item will be the highest version available
-        return availableVersions[0];
-    }
-};
 var projFiles = {
     phone: 'CordovaApp.Phone.jsproj',
     win: 'CordovaApp.Windows.jsproj',
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index 3006972..0b09d32 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -57,20 +57,30 @@ module.exports.run = function run (buildOptions) {
 
     var buildConfig = parseAndValidateArgs(buildOptions);
 
-    return MSBuildTools.findAllAvailableVersions()
-        .then(function (msbuildTools) {
+    // get build targets
+    var selectedBuildTargets = getBuildTargets(buildConfig.win, buildConfig.phone, buildConfig.projVerOverride, buildConfig);
+
+    return MSBuildTools.getLatestMSBuild() // get latest msbuild tools
+        .then(function (msbuild) {
+
+            // filter targets to make sure they are supported on this development machine
+            var myBuildTargets = msbuild.filterSupportedTargets(selectedBuildTargets);
+
             // Apply build related configs
             prepare.updateBuildConfig(buildConfig);
 
             if (buildConfig.publisherId) {
-                updateManifestWithPublisher(msbuildTools, buildConfig);
+                updateManifestWithPublisher(buildConfig, myBuildTargets);
             }
 
             cleanIntermediates();
-            return buildTargets(msbuildTools, buildConfig);
+            // build!
+            return buildTargets(buildConfig, myBuildTargets, msbuild);
         }).then(function (pkg) {
             events.emit('verbose', ' BUILD OUTPUT: ' + pkg.appx);
             return pkg;
+        }).catch(function (error) {
+            return Q.reject(new CordovaError('No valid MSBuild was detected for the selected target: ' + error, error));
         });
 };
 
@@ -303,12 +313,9 @@ function parseBuildConfig (buildConfigPath, buildType) {
 
 // Note: This function is very narrow and only writes to the app manifest if an update is done.  See CB-9450 for the
 // reasoning of why this is the case.
-function updateManifestWithPublisher (allMsBuildVersions, config) {
+function updateManifestWithPublisher (config, myBuildTargets) {
     if (!config.publisherId) return;
 
-    var selectedBuildTargets = getBuildTargets(config.win, config.phone, config.projVerOverride, config);
-    var msbuild = MSBuildTools.getLatestMSBuild(allMsBuildVersions);
-    var myBuildTargets = filterSupportedTargets(selectedBuildTargets, msbuild);
     var manifestFiles = myBuildTargets.map(function (proj) {
         return projFilesToManifests[proj];
     });
@@ -319,15 +326,7 @@ function updateManifestWithPublisher (allMsBuildVersions, config) {
     });
 }
 
-function buildTargets (allMsBuildVersions, config) {
-    // filter targets to make sure they are supported on this development machine
-    var selectedBuildTargets = getBuildTargets(config.win, config.phone, config.projVerOverride, config);
-    var msbuild = MSBuildTools.getLatestMSBuild(allMsBuildVersions);
-    if (!msbuild) {
-        return Q.reject(new CordovaError('No valid MSBuild was detected for the selected target.'));
-    }
-    events.emit('verbose', 'Using MSBuild v' + msbuild.version + ' from ' + msbuild.path);
-    var myBuildTargets = filterSupportedTargets(selectedBuildTargets, msbuild);
+function buildTargets (config, myBuildTargets, msbuild) {
 
     var buildConfigs = [];
     var bundleTerms = '';

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 24/26: Use MSBUILDDIR on AppVeyor

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 0fd950df5c598a788f5fae93f64255b9a4ca1a97
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 12:49:35 2018 +0100

    Use MSBUILDDIR on AppVeyor
---
 appveyor.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/appveyor.yml b/appveyor.yml
index 28247ec..19e7f28 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -25,6 +25,10 @@ environment:
       APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
 
     - nodejs_version: "6"
+      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+      MSBUILDDIR: "C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\"
+
+    - nodejs_version: "6"
       APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
 
     - nodejs_version: "4"

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 10/26: fix eslint

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 4854849e2cc07e772a5c45ee73bfed6a1b174f45
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 20:00:20 2018 +0100

    fix eslint
---
 template/cordova/lib/MSBuildTools.js | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 43dcf25..43fcb6d 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -90,14 +90,14 @@ module.exports.findAvailableVersion = function () {
 // check_reqs.js -> checkMSBuild()
 module.exports.findAllAvailableVersions = function () {
     console.log('findAllAvailableVersions');
-    // CB-11548 use VSINSTALLDIR environment if defined to find MSBuild. 
+    // CB-11548 use VSINSTALLDIR environment if defined to find MSBuild.
     if (process.env.VSINSTALLDIR) {
         var msBuildPath = path.join(process.env.VSINSTALLDIR, 'MSBuild/15.0/Bin');
         return module.exports.getMSBuildToolsAt(msBuildPath)
             .then(function (msBuildTools) {
                 return [msBuildTools];
             })
-            // If VSINSTALLDIR is not specified or doesn't contain the MSBuild path we are 
+            // If VSINSTALLDIR is not specified or doesn't contain the MSBuild path we are
             // looking for - fall back to default discovery mechanism.
             .catch(findAllAvailableVersionsFallBack);
     }
@@ -133,14 +133,14 @@ module.exports.getMSBuildToolsAt = function (location) {
         .then(function (output) {
             // MSBuild prints its' version as 14.0.25123.0, so we pick only first 2 segments
             var version = output.match(/^(\d+\.\d+)/)[1];
-            console.log('return new MSBuildTools', version, location)
+            console.log('return new MSBuildTools', version, location);
             return new MSBuildTools(version, location);
         });
 };
 
 function checkMSBuildVersion (version) {
     console.log('checkMSBuildVersion', version);
-    
+
     // first, check if we have a VS 2017+ with such a version
     var willows = module.exports.getWillowInstallations();
     console.log('willows', willows);
@@ -211,14 +211,13 @@ module.exports.getLatestMSBuild = function () {
 
             if (availableVersions.length > 0) {
                 // After sorting the first item will be the highest version available
-                msbuild = availableVersions[0];
+                var msbuild = availableVersions[0];
                 events.emit('verbose', 'Using MSBuild v' + msbuild.version + ' from ' + msbuild.path);
                 return msbuild;
             }
-    });
+        });
 };
 
-
 var projFiles = {
     phone: 'CordovaApp.Phone.jsproj',
     win: 'CordovaApp.Windows.jsproj',
@@ -244,7 +243,7 @@ function msBuild155TargetsFilter (target) {
     return target === projFiles.win10;
 }
 
-MSBuildTools.prototype.filterSupportedTargets = function(targets) {
+MSBuildTools.prototype.filterSupportedTargets = function (targets) {
     var msbuild = this;
     console.log('MSBuildTools->filterSupportedTargets', targets, msbuild);
     if (!targets || targets.length === 0) {
@@ -278,7 +277,7 @@ MSBuildTools.prototype.filterSupportedTargets = function(targets) {
             'or Visual Studio 2013 Update 2 for Windows 8.1.');
     }
     return supportedTargets;
-}
+};
 
 /**
  * Lists all VS 2017+ instances dirs in ProgramData
@@ -354,4 +353,4 @@ module.exports.getAvailableUAPVersions = function () {
     });
 
     return result;
-};
\ No newline at end of file
+};

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 12/26: better logging for checkMSBuildVersion future method preparation

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 50f9cab2ccb1dc46839b4b9ada4294b6b421a2d0
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 20:28:00 2018 +0100

    better logging for checkMSBuildVersion
    future method preparation
---
 template/cordova/lib/MSBuildTools.js | 28 +++++++++++++++++++---------
 template/cordova/lib/build.js        |  2 +-
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 3cacc3b..cc86d9f 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -143,22 +143,23 @@ function checkMSBuildVersion (version) {
 
     // first, check if we have a VS 2017+ with such a version
     var willows = module.exports.getWillowInstallations();
-    console.log('willows', willows);
+    //console.log('willows', willows);
     var correspondingWillows = willows.filter(function (inst) {
-        console.log('correspondingWillow', inst.version === version);
+        //console.log('willows.filter', inst.version, version, inst.version === version);
         return inst.version === version;
     });
-    console.log('correspondingWillows', correspondingWillows);
-    var correspondingWillow = correspondingWillows[1];
+    //console.log('correspondingWillows', correspondingWillows);
+    var correspondingWillow = correspondingWillows[0]; // TODO Do not only handle one!
     if (correspondingWillow) {
-        // TODO adapt for 15.5=>15.0 case
         version = '15.0';
         var toolsPath = path.join(correspondingWillow.path, 'MSBuild', version, 'Bin');
-        console.log('correspondingWillow:', toolsPath);
+        console.log('matching VS:', version, toolsPath);
+        console.log('from list of VS installations: ', correspondingWillows);
         if (shell.test('-e', toolsPath)) {
-            console.log('correspondingWillow:', toolsPath, module.exports.getMSBuildToolsAt(toolsPath));
+            var msbuild = module.exports.getMSBuildToolsAt(toolsPath);
+            console.log('selected VS exists:', toolsPath, );
             // TODO check for JavaScript folder
-            return module.exports.getMSBuildToolsAt(toolsPath);
+            return msbuild;
         }
     }
 
@@ -179,11 +180,20 @@ function checkMSBuildVersion (version) {
                 return new MSBuildTools(version, toolsPath);
             }
         }).catch(function (err) { /* eslint handle-callback-err : 0 */
-            console.log('no reg result', version, err);
+            console.log('no registry result for version ' + version);
             // if 'reg' exits with error, assume that registry key not found
         });
+
+    console.log('no msbuild found with version ', version);
 }
 
+module.exports.getLatestMatchingMSBuild = function (selectedBuildTargets) {
+    events.emit('verbose', 'getLatestMatchingMSBuild');
+    console.log('getLatestMatchingMSBuild', selectedBuildTargets);
+    var msbuild = this.getLatestMSBuild();
+    // we don't do anything with selectedBuildTargets yet, but could theoretically nope out if this msbuild doesn't work for that target
+    return msbuild;
+};
 
 // gets the latest MSBuild version from a list of versions
 module.exports.getLatestMSBuild = function () {
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index efbf22b..d06c8ec 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -60,7 +60,7 @@ module.exports.run = function run (buildOptions) {
     // get build targets
     var selectedBuildTargets = getBuildTargets(buildConfig.win, buildConfig.phone, buildConfig.projVerOverride, buildConfig);
 
-    return MSBuildTools.getLatestMSBuild() // get latest msbuild tools
+    return MSBuildTools.getLatestMatchingMSBuild(selectedBuildTargets) // get latest msbuild tools
         .then(function (msbuild) {
 
             // filter targets to make sure they are supported on this development machine

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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


[cordova-windows] 02/26: move method

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit d1052f6d13b8271cd700e6e70d18a53f4183d19e
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Wed Feb 14 19:09:40 2018 +0100

    move method
---
 template/cordova/lib/MSBuildTools.js | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index cfbf4e0..0444ba3 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -85,17 +85,6 @@ module.exports.findAvailableVersion = function () {
     });
 };
 
-function findAllAvailableVersionsFallBack () {
-    var versions = ['15.0', '14.0', '12.0', '4.0'];
-    events.emit('verbose', 'Searching for available MSBuild versions...');
-
-    return Q.all(versions.map(checkMSBuildVersion)).then(function (unprocessedResults) {
-        return unprocessedResults.filter(function (item) {
-            return !!item;
-        });
-    });
-}
-
 // build.js -> run()
 // check_reqs.js -> checkMSBuild()
 module.exports.findAllAvailableVersions = function () {
@@ -113,6 +102,17 @@ module.exports.findAllAvailableVersions = function () {
     return findAllAvailableVersionsFallBack();
 };
 
+function findAllAvailableVersionsFallBack () {
+    var versions = ['15.0', '14.0', '12.0', '4.0'];
+    events.emit('verbose', 'Searching for available MSBuild versions...');
+
+    return Q.all(versions.map(checkMSBuildVersion)).then(function (unprocessedResults) {
+        return unprocessedResults.filter(function (item) {
+            return !!item;
+        });
+    });
+}
+
 /**
  * Gets MSBuildTools instance for user-specified location
  *

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

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