Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25077] Unable to compile with VS2017 #200

Merged
merged 1 commit into from Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 28 additions & 13 deletions windows/plugins/hooks/hyperloop.js
Expand Up @@ -5,6 +5,10 @@ var spawn = require('child_process').spawn,
ejs = require('ejs'),
appc = require('node-appc');

function isVS2017(data) {
return /^Visual Studio \w+ 2017/.test(data.windowsInfo.selectedVisualStudio.version);
}

exports.cliVersion = ">=3.2";
exports.init = function(logger, config, cli, nodeappc) {
/*
Expand All @@ -21,19 +25,27 @@ exports.init = function(logger, config, cli, nodeappc) {
function(next) {
runCmake(data, 'WindowsStore', 'ARM', '10.0', next);
},
function(next) {
];

var w81support = !isVS2017(data);

// Visual Studio 2017 doesn't support Windows/Phone 8.1 project anymore
if (w81support) {
tasks.push(function(next) {
runCmake(data, 'WindowsPhone', 'Win32', '8.1', next);
},
function(next) {
});
tasks.push(function(next) {
runCmake(data, 'WindowsPhone', 'ARM', '8.1', next);
},
function(next) {
});
tasks.push(function(next) {
runCmake(data, 'WindowsStore', 'Win32', '8.1', next);
},
];
});
}

var archs = w81support ? ['phone', 'store', 'win10'] : ['win10'];

var csharp_dest = path.join(data.projectDir, 'reflection', 'HyperloopInvocation');
['phone', 'store', 'win10'].forEach(function(platform) {
archs.forEach(function(platform) {
['Debug', 'Release'].forEach(function(buildConfig) {
tasks.push(
function(next) {
Expand All @@ -53,7 +65,10 @@ exports.init = function(logger, config, cli, nodeappc) {
* Copy dependencies
*/
cli.on('build.module.pre.package', function (data, callback) {
['phone', 'store', 'win10'].forEach(function(platform){
var w81support = !isVS2017(data),
archs = w81support ? ['phone', 'store', 'win10'] : ['win10'];

archs.forEach(function(platform){
['ARM', 'x86'].forEach(function(arch){
var from = path.join(data.projectDir, 'reflection', 'HyperloopInvocation', 'bin', platform, 'Release'),
to = path.join(data.projectDir, 'build', 'Hyperloop', data.manifest.version, platform, arch);
Expand Down Expand Up @@ -97,7 +112,7 @@ function generateCMakeList(data, next) {

function runCmake(data, platform, arch, sdkVersion, next) {
var logger = data.logger,
generatorName = 'Visual Studio 14 2015' + (arch==='ARM' ? ' ARM' : ''),
generatorName = (isVS2017(data) ? 'Visual Studio 15 2017' : 'Visual Studio 14 2015') + (arch==='ARM' ? ' ARM' : ''),
cmakeProjectName = (sdkVersion === '10.0' ? 'Windows10' : platform) + '.' + arch,
cmakeWorkDir = path.resolve(__dirname,'..','..',cmakeProjectName);

Expand Down Expand Up @@ -184,9 +199,9 @@ function runMSBuild(data, slnFile, buildConfig, callback) {
logger.debug('Running MSBuild on solution: ' + slnFile);

// Use spawn directly so we can pipe output as we go
var p = spawn(vsInfo.vcvarsall, [
'&&', 'MSBuild', '/p:Platform=Any CPU', '/p:Configuration=' + buildConfig, slnFile
]);
var p = spawn((process.env.comspec || 'cmd.exe'), ['/S', '/C', '"', vsInfo.vsDevCmd.replace(/[ \(\)\&]/g, '^$&') +
' && MSBuild /p:Platform="Any CPU" /p:Configuration=' + buildConfig + ' ' + slnFile + '"'
], {windowsVerbatimArguments: true});
p.stdout.on('data', function (data) {
var line = data.toString().trim();
if (line.indexOf('error ') >= 0) {
Expand Down
6 changes: 3 additions & 3 deletions windows/sdk_plugins/windows/hyperloop.js
Expand Up @@ -318,9 +318,9 @@ exports.cliVersion = '>=3.2';
logger.debug('Running MSBuild on solution: ' + slnFile + ' for ' + buildConfiguration);

// Use spawn directly so we can pipe output as we go
var p = spawn(vsInfo.vcvarsall, [
'&&', 'MSBuild', '/p:Platform=Any CPU', '/p:Configuration=' + buildConfiguration, slnFile
]);
var p = spawn((process.env.comspec || 'cmd.exe'), ['/S', '/C', '"', vsInfo.vsDevCmd.replace(/[ \(\)\&]/g, '^$&') +
' && MSBuild /p:Platform="Any CPU" /p:Configuration=' + buildConfiguration + ' ' + slnFile + '"'
], {windowsVerbatimArguments: true});
p.stdout.on('data', function (data) {
var line = data.toString().trim();
if (line.indexOf('error ') >= 0) {
Expand Down