@@ -19,6 +19,11 @@ const VsYearVersion = {
19
19
'2013' : '12.0' ,
20
20
}
21
21
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
+ */
22
27
function vsversion_to_versionnumber ( vsversion ) {
23
28
if ( Object . values ( VsYearVersion ) . includes ( vsversion ) ) {
24
29
return vsversion
@@ -31,6 +36,11 @@ function vsversion_to_versionnumber(vsversion) {
31
36
}
32
37
exports . vsversion_to_versionnumber = vsversion_to_versionnumber
33
38
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
+ */
34
44
function vsversion_to_year ( vsversion ) {
35
45
if ( Object . keys ( VsYearVersion ) . includes ( vsversion ) ) {
36
46
return vsversion
@@ -47,6 +57,12 @@ exports.vsversion_to_year = vsversion_to_year
47
57
48
58
const VSWHERE_PATH = `${ PROGRAM_FILES_X86 } \\Microsoft Visual Studio\\Installer`
49
59
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
+ */
50
66
function findWithVswhere ( pattern , version_pattern ) {
51
67
try {
52
68
let installationPath = child_process . execSync ( `vswhere -products * ${ version_pattern } -prerelease -property installationPath` ) . toString ( ) . trim ( )
@@ -58,6 +74,11 @@ function findWithVswhere(pattern, version_pattern) {
58
74
}
59
75
exports . findWithVswhere = findWithVswhere
60
76
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
+ */
61
82
function findVcvarsall ( vsversion ) {
62
83
const vsversion_number = vsversion_to_versionnumber ( vsversion )
63
84
let version_pattern
@@ -120,7 +141,15 @@ function filterPathValue(path) {
120
141
return paths . filter ( unique ) . join ( ';' )
121
142
}
122
143
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
+ */
124
153
function setupMSVCDevCmd ( arch , sdk , toolset , uwp , spectre , vsversion ) {
125
154
if ( process . platform != 'win32' ) {
126
155
core . info ( 'This is not a Windows virtual environment, bye!' )
0 commit comments