Skip to content

Commit

Permalink
Add windows build dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoH2O1999 committed Jan 10, 2023
1 parent 6225835 commit 02fb238
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/builder/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {vsInstallerPath, windowsBuildDependencies} from '../constants';
import Builder from './builder';
import fs from 'fs';
import path from 'path';
Expand Down Expand Up @@ -91,7 +92,7 @@ export default class WindowsBuilder extends Builder {
}
}
if (candidates.length !== 1) {
throw new Error(`Expected only one candidate, got ${candidates}`);
throw new Error(`Expected one candidate, got ${candidates}`);
}
const installer = path.join(buildPath, candidates[0]);
core.info(`Installer: ${installer}`);
Expand Down Expand Up @@ -163,6 +164,15 @@ export default class WindowsBuilder extends Builder {
core.info('Temporarily adding as environment variable...');
core.exportVariable('MSBUILD', msBuildPath);
core.endGroup();

// Installing dependencies
core.startGroup('Installing dependencies');
for (const dependency of windowsBuildDependencies) {
await exec.exec(
`${vsInstallerPath} modify --add ${dependency} --passive`
);
}
core.endGroup();
}

async cleanEnvironment(): Promise<void> {
Expand All @@ -171,6 +181,12 @@ export default class WindowsBuilder extends Builder {
core.info('Cleaning temp MSBUILD variable...');
core.exportVariable('MSBUILD', this.MSBUILD);

for (const dependency of windowsBuildDependencies) {
await exec.exec(
`${vsInstallerPath} modify --add ${dependency} --passive`
);
}

core.endGroup();
}
}
7 changes: 7 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ export {defaultPyPy2, defaultPyPy3};
const warnRateLimitThreshold = 200;

export {warnRateLimitThreshold};

const windowsBuildDependencies = ['Microsoft.VisualStudio.Component.VC.140'];

const vsInstallerPath =
'"C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installer.exe"';

export {windowsBuildDependencies, vsInstallerPath};

0 comments on commit 02fb238

Please sign in to comment.