Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

vs_BuildTools 2019 #224

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
18 changes: 18 additions & 0 deletions __tests__/utils/get-build-tools-installer-path-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,22 @@ describe('getBuildToolsInstallerPath', () => {

delete process.env.npm_config_vs2017;
});

it('gets the correct information (2019)', () => {
process.env.npm_config_vs2019 = 'true';

jest.resetModules();

const { getBuildToolsInstallerPath } = require('../../src/utils/get-build-tools-installer-path');

expect(getBuildToolsInstallerPath()).toEqual({
directory: 'C:\\workDir',
fileName: 'vs_BuildTools.exe',
logPath: null,
path: 'C:\\workDir\\vs_BuildTools.exe',
url: 'https://download.visualstudio.microsoft.com/download/pr/befdb1f9-8676-4693-b031-65ee44835915/fc7680c10773759e4522f5c1ca2ce07fd01f61d7b9efa68b346c0b0da6a0b125/vs_BuildTools.exe',
});

delete process.env.npm_config_vs2017;
});
});
4 changes: 4 additions & 0 deletions __tests__/utils/installation-success-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,9 @@ describe('installation-success', () => {
it('VS2017 successful intallation', () => {
testLog('vs2017-success', 75, true, 2017);
});

it('VS2019 successful intallation', () => {
testLog('vs2019-success', 75, true, 2019);
});
});
});
3 changes: 2 additions & 1 deletion ps1/launch-installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function runInstaller {

cd $BuildToolsInstallerPath

if ($VisualStudioVersion -eq "2017") {
$WillowVS2017OrLater = "2017", "2019"
if ( $WillowVS2017OrLater -contains $VisualStudioVersion) {
$params = "--norestart", "--quiet", "--includeRecommended", "--add", "Microsoft.VisualStudio.Workload.VCTools"
./vs_BuildTools.exe $params
} else {
Expand Down
12 changes: 10 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export const PYTHON = process.arch === 'x64'

export const BUILD_TOOLS = getBuildTools();
function getBuildTools() {
const vs2019 = {
installerName: 'vs_BuildTools.exe',
// tslint:disable-next-line
installerUrl: 'https://download.visualstudio.microsoft.com/download/pr/befdb1f9-8676-4693-b031-65ee44835915/fc7680c10773759e4522f5c1ca2ce07fd01f61d7b9efa68b346c0b0da6a0b125/vs_BuildTools.exe',
logName: null,
version: 2019
};
const vs2017 = {
installerName: 'vs_BuildTools.exe',
installerUrl: 'https://download.visualstudio.microsoft.com/download/pr/11503713/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe',
Expand All @@ -45,8 +52,9 @@ function getBuildTools() {
logName: 'build-tools-log.txt',
version: 2015
};

if (process.env.npm_config_vs2017) {
if (process.env.npm_config_vs2019) {
return vs2019;
} else if (process.env.npm_config_vs2017) {
return vs2017;
} else if (process.env.npm_config_vs2015) {
return vs2015;
Expand Down
3 changes: 2 additions & 1 deletion src/utils/get-build-tools-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export function getBuildToolsExtraParameters() {
}
}

if (!!process.env.npm_config_include_arm64_tools && BUILD_TOOLS.version === 2017) {
const WillowVS2017OrLater = [2017, 2019];
if (!!process.env.npm_config_include_arm64_tools && WillowVS2017OrLater.includes(BUILD_TOOLS.version)) {
extraArgs += ' --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64';
}

Expand Down