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 55639d8e9a4a4a12e1d3308d479769d690fa81d5
Author: Jan Piotrowski <piotrow...@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
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