Skip to content

Commit 64e33d2

Browse files
authored
feat: check for prelrease vscode version if no stable version is found (#27)
1 parent 6ea8e6c commit 64e33d2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/src/native_toolchain/msvc.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,22 @@ class VisualStudioResolver implements ToolResolver {
255255

256256
final result = <ToolInstance>[];
257257
for (final vswhereInstance in vswhereInstances.take(1)) {
258+
final arguments = ['-format', 'json', '-utf8', '-products', '*'];
258259
final vswhereResult = await runProcess(
259260
executable: vswhereInstance.uri,
260-
arguments: ['-format', 'json', '-utf8', '-products', '*'],
261+
arguments: arguments,
261262
logger: logger,
262263
);
263-
final toolInfos = json.decode(vswhereResult.stdout) as List;
264+
var toolInfos = json.decode(vswhereResult.stdout) as List;
265+
// Try again including prerelease versions if no stable versions found.
266+
if (toolInfos.isEmpty) {
267+
final vswhereResult = await runProcess(
268+
executable: vswhereInstance.uri,
269+
arguments: [...arguments, '-prerelease'],
270+
logger: logger,
271+
);
272+
toolInfos = json.decode(vswhereResult.stdout) as List;
273+
}
264274
for (final toolInfo in toolInfos) {
265275
final toolInfoParsed = toolInfo;
266276
assert(toolInfoParsed['installationPath'] != null);

0 commit comments

Comments
 (0)