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/14 19:28:15 UTC
[cordova-windows] 05/11: move filterSupportedTargets from build.js
to MSBuildTools.js
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 6295571a79e083409e840b1bcfeaa341bdf9f536
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