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


The following commit(s) were added to refs/heads/janpio-msbuild_cleanup by this 
push:
     new 28ed907  move filterSupportedTargets into getLatestMatchingMSBuild
28ed907 is described below

commit 28ed907515a6f34aeb67ae51aa9ae1c886afea66
Author: Jan Piotrowski <piotrow...@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
jan...@apache.org.

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

Reply via email to