cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jan...@apache.org
Subject [cordova-windows] 15/26: move filterSupportedTargets into getLatestMatchingMSBuild
Date Thu, 15 Feb 2018 14:46:07 GMT
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 <piotrowski@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


Mime
View raw message