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

Set default architecture of msbuild to x64 if running on 64bit machine #112

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ inputs:
description: 'Enable searching for pre-release versions of Visual Studio/MSBuild'
required: false
msbuild-architecture:
description: 'The preferred processor architecture of MSBuild. Can be either "x86", "x64", or "arm64". "x64" is only available from Visual Studio version 17.0 and later.'
description: 'The preferred processor architecture of MSBuild. Can be either "x86", "x64", or "arm64". "x64" is only available from Visual Studio version 17.0 and later. If empty, it will be auto-detected'
required: false
default: 'x86'
outputs:
msbuildPath:
description: 'The resulting location of msbuild for your inputs'
Expand Down
11 changes: 10 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1642,17 +1642,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const exec = __importStar(__webpack_require__(986));
const fs = __importStar(__webpack_require__(747));
const path = __importStar(__webpack_require__(622));
const io = __importStar(__webpack_require__(1));
const os_1 = __importDefault(__webpack_require__(87));
const IS_WINDOWS = process.platform === 'win32';
const VS_VERSION = core.getInput('vs-version') || 'latest';
const VSWHERE_PATH = core.getInput('vswhere-path');
const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false';
let MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86';
function is64Bit() {
// as of writing, these architectures returned by os.arch are 64bit
return ['arm64', 'ppc64', 'x64', 's390x'].includes(os_1.default.arch());
}
let DEFAULT_ARCH = is64Bit() ? 'x64' : 'x86';
let MSBUILD_ARCH = core.getInput('msbuild-architecture') || DEFAULT_ARCH;
// if a specific version of VS is requested
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ';
if (ALLOW_PRERELEASE === 'true') {
Expand Down
17 changes: 14 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.3",
"@actions/tool-cache": "^1.3.0"
"@actions/tool-cache": "^1.3.0",
"os": "^0.1.2"
},
"devDependencies": {
"@types/jest": "^24.0.23",
Expand Down
10 changes: 9 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ import * as exec from '@actions/exec'
import * as fs from 'fs'
import * as path from 'path'
import * as io from '@actions/io'
import Os from 'os'
import {ExecOptions} from '@actions/exec/lib/interfaces'

const IS_WINDOWS = process.platform === 'win32'
const VS_VERSION = core.getInput('vs-version') || 'latest'
const VSWHERE_PATH = core.getInput('vswhere-path')
const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false'
let MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86'

function is64Bit() {
// as of writing, these architectures returned by os.arch are 64bit
return ['arm64', 'ppc64', 'x64', 's390x'].includes(Os.arch())
}

let DEFAULT_ARCH = is64Bit() ? 'x64' : 'x86';
let MSBUILD_ARCH = core.getInput('msbuild-architecture') || DEFAULT_ARCH

// if a specific version of VS is requested
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '
Expand Down