@@ -19,6 +19,11 @@ const VsYearVersion = {
1919 '2013' : '12.0' ,
2020}
2121
22+ /**
23+ * Convert the vs version (e.g. 2022) or year (e.g. 17.0) to the version number (e.g. 17.0)
24+ * @param {string } vsversion the year (e.g. 2022) or version number (e.g. 17.0)
25+ * @returns {string } the version number (e.g. 17.0)
26+ */
2227function vsversion_to_versionnumber ( vsversion ) {
2328 if ( Object . values ( VsYearVersion ) . includes ( vsversion ) ) {
2429 return vsversion
@@ -31,6 +36,11 @@ function vsversion_to_versionnumber(vsversion) {
3136}
3237exports . vsversion_to_versionnumber = vsversion_to_versionnumber
3338
39+ /**
40+ * Convert the vs version (e.g. 17.0) or year (e.g. 2022) to the year (e.g. 2022)
41+ * @param {string } vsversion the version number (e.g. 17.0) or year (e.g. 2022)
42+ * @returns {string } the year (e.g. 2022)
43+ */
3444function vsversion_to_year ( vsversion ) {
3545 if ( Object . keys ( VsYearVersion ) . includes ( vsversion ) ) {
3646 return vsversion
@@ -47,6 +57,12 @@ exports.vsversion_to_year = vsversion_to_year
4757
4858const VSWHERE_PATH = `${ PROGRAM_FILES_X86 } \\Microsoft Visual Studio\\Installer`
4959
60+ /**
61+ * Find MSVC tools with vswhere
62+ * @param {string } pattern the pattern to search for
63+ * @param {string } version_pattern the version pattern to search for
64+ * @returns {string | null } the path to the found MSVC tools
65+ */
5066function findWithVswhere ( pattern , version_pattern ) {
5167 try {
5268 let installationPath = child_process . execSync ( `vswhere -products * ${ version_pattern } -prerelease -property installationPath` ) . toString ( ) . trim ( )
@@ -58,6 +74,11 @@ function findWithVswhere(pattern, version_pattern) {
5874}
5975exports . findWithVswhere = findWithVswhere
6076
77+ /**
78+ * Find the vcvarsall.bat file for the given Visual Studio version
79+ * @param {string } vsversion the version of Visual Studio to find (year or version number)
80+ * @returns {string } the path to the vcvarsall.bat file
81+ */
6182function findVcvarsall ( vsversion ) {
6283 const vsversion_number = vsversion_to_versionnumber ( vsversion )
6384 let version_pattern
@@ -120,7 +141,15 @@ function filterPathValue(path) {
120141 return paths . filter ( unique ) . join ( ';' )
121142}
122143
123- /** See https://github.com/ilammy/msvc-dev-cmd#inputs */
144+ /**
145+ * Setup MSVC Developer Command Prompt
146+ * @param {string } arch - Target architecture
147+ * @param {string } sdk - Windows SDK number to build for
148+ * @param {string } toolset - VC++ compiler toolset version
149+ * @param {'true' | 'false' } uwp - Build for Universal Windows Platform
150+ * @param {'true' | 'false' } spectre - Enable Spectre mitigations
151+ * @param {string } vsversion - The Visual Studio version to use. This can be the version number (e.g. 16.0 for 2019) or the year (e.g. "2019").
152+ */
124153function setupMSVCDevCmd ( arch , sdk , toolset , uwp , spectre , vsversion ) {
125154 if ( process . platform != 'win32' ) {
126155 core . info ( 'This is not a Windows virtual environment, bye!' )
0 commit comments