-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added env checks: DeveloperMode, .NET Core, LongPathSupport, Compilers, build tools, SDKs and Visual Studio, Windows Co-authored-by: AndreiLobanovich <andrei.lobanovich@akvelon.com> Co-authored-by: RedMickey <33267199+RedMickey@users.noreply.github.com> Co-authored-by: Heniker <Heniker@mail.ru>
- Loading branch information
1 parent
68c2947
commit 62af5fc
Showing
11 changed files
with
271 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/extension/services/validationService/checks/devmode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
import * as nls from "vscode-nls"; | ||
import { executeCommand } from "../util"; | ||
import { IValidation, ValidationCategoryE, ValidationResultT } from "./types"; | ||
|
||
nls.config({ | ||
messageFormat: nls.MessageFormat.bundle, | ||
bundleFormat: nls.BundleFormat.standalone, | ||
})(); | ||
const toLocale = nls.loadMessageBundle(); | ||
|
||
const label = "DeveloperMode"; | ||
|
||
async function test(): Promise<ValidationResultT> { | ||
const command = | ||
"reg query HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock /v AllowDevelopmentWithoutDevLicense"; | ||
const data = await executeCommand(command); | ||
if (data.stdout) { | ||
if (data.stdout.includes(" 0x1")) | ||
return { | ||
status: "success", | ||
}; | ||
} | ||
|
||
return { | ||
status: "failure", | ||
comment: "Developer mode is disabled", | ||
}; | ||
} | ||
|
||
const main: IValidation = { | ||
label, | ||
platform: ["win32"], | ||
description: toLocale( | ||
"DeveloperModeTestDescription", | ||
"Required for launching and debugging RNW apps", | ||
), | ||
category: ValidationCategoryE.Windows, | ||
exec: test, | ||
}; | ||
|
||
export default main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
import * as nls from "vscode-nls"; | ||
import { createNotFoundMessage, createVersionErrorMessage, executeCommand } from "../util"; | ||
import { IValidation, ValidationCategoryE, ValidationResultT } from "./types"; | ||
|
||
nls.config({ | ||
messageFormat: nls.MessageFormat.bundle, | ||
bundleFormat: nls.BundleFormat.standalone, | ||
})(); | ||
const toLocale = nls.loadMessageBundle(); | ||
|
||
const label = ".NET Core 3.1"; | ||
|
||
async function test(): Promise<ValidationResultT> { | ||
const command = "dotnet --info"; | ||
const data = await executeCommand(command); | ||
if (data.stdout) { | ||
if (data.stdout.includes("Microsoft.NETCore.App 3.1")) | ||
return { | ||
status: "success", | ||
}; | ||
return { | ||
status: "failure", | ||
comment: createVersionErrorMessage(label), | ||
}; | ||
} | ||
return { | ||
status: "failure", | ||
comment: createNotFoundMessage(label), | ||
}; | ||
} | ||
|
||
const main: IValidation = { | ||
label, | ||
platform: ["win32"], | ||
description: toLocale("DotNetTestDescription", "Required for building RNW apps"), | ||
category: ValidationCategoryE.Windows, | ||
exec: test, | ||
}; | ||
|
||
export default main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/extension/services/validationService/checks/longPath.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
import * as nls from "vscode-nls"; | ||
import { executeCommand } from "../util"; | ||
import { IValidation, ValidationCategoryE, ValidationResultT } from "./types"; | ||
|
||
nls.config({ | ||
messageFormat: nls.MessageFormat.bundle, | ||
bundleFormat: nls.BundleFormat.standalone, | ||
})(); | ||
const toLocale = nls.loadMessageBundle(); | ||
|
||
const label = "LongPathSupport"; | ||
|
||
async function test(): Promise<ValidationResultT> { | ||
const command = | ||
"reg query HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem /v LongPathsEnabled"; | ||
const data = await executeCommand(command); | ||
if (data.stdout) { | ||
if (data.stdout.includes(" 0x1")) | ||
return { | ||
status: "success", | ||
}; | ||
} | ||
return { | ||
status: "failure", | ||
comment: "Long path support is disabled", | ||
}; | ||
} | ||
|
||
const main: IValidation = { | ||
label, | ||
platform: ["win32"], | ||
description: toLocale("LongPathSupportTestDescription", "Required for building RNW apps"), | ||
category: ValidationCategoryE.Windows, | ||
exec: test, | ||
}; | ||
|
||
export default main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/extension/services/validationService/checks/visualStudio.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
import * as nls from "vscode-nls"; | ||
import * as semver from "semver"; | ||
import { createNotFoundMessage, executeCommand, normizeStr } from "../util"; | ||
import { IValidation, ValidationCategoryE, ValidationResultT } from "./types"; | ||
|
||
nls.config({ | ||
messageFormat: nls.MessageFormat.bundle, | ||
bundleFormat: nls.BundleFormat.standalone, | ||
})(); | ||
const toLocale = nls.loadMessageBundle(); | ||
|
||
const label = "Compilers, build tools, SDKs and Visual Studio"; | ||
|
||
async function test(): Promise<ValidationResultT> { | ||
let vswherePath = ``; | ||
if (process.env["ProgramFiles(x86)"]) { | ||
vswherePath = `"${process.env["ProgramFiles(x86)"]}\\Microsoft Visual Studio\\Installer\\vswhere.exe"`; | ||
} else { | ||
vswherePath = `"C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe"`; | ||
} | ||
const components = [ | ||
"Microsoft.Component.MSBuild", | ||
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64", | ||
"Microsoft.VisualStudio.ComponentGroup.UWP.Support", | ||
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", | ||
"Microsoft.VisualStudio.Component.Windows10SDK.19041", | ||
]; | ||
const command = `${vswherePath} -property catalog_productDisplayVersion`; | ||
const result = await executeCommand(command); | ||
if (result.stdout) { | ||
const versions = normizeStr(result.stdout).split("\n"); | ||
const valid = (version: string) => semver.gtr(version, "16.5"); | ||
if (versions.some(valid)) { | ||
for (const comp of components) { | ||
const pathToComponent = await executeCommand( | ||
`${vswherePath} -requires ${comp} -property productPath`, | ||
); | ||
if (!pathToComponent.stdout) { | ||
return { | ||
status: "failure", | ||
comment: `Please check if ${comp} is installed`, | ||
}; | ||
} | ||
} | ||
return { | ||
status: "success", | ||
}; | ||
} | ||
return { | ||
status: "partial-success", | ||
comment: | ||
"Detected version is older than 16.5. " + | ||
"Please update Visual Studio in case of errors", | ||
}; | ||
} | ||
return { | ||
status: "failure", | ||
comment: createNotFoundMessage(label), | ||
}; | ||
} | ||
|
||
const main: IValidation = { | ||
label, | ||
platform: ["win32"], | ||
description: toLocale("VisualStudioCheckDescription", "Required for building RNW apps"), | ||
category: ValidationCategoryE.Windows, | ||
exec: test, | ||
}; | ||
|
||
export default main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/extension/services/validationService/checks/windows.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
import * as os from "os"; | ||
import * as nls from "vscode-nls"; | ||
import * as semver from "semver"; | ||
import { IValidation, ValidationCategoryE, ValidationResultT } from "./types"; | ||
|
||
nls.config({ | ||
messageFormat: nls.MessageFormat.bundle, | ||
bundleFormat: nls.BundleFormat.standalone, | ||
})(); | ||
const toLocale = nls.loadMessageBundle(); | ||
|
||
const label = "Windows version > 10.0.16299.0"; | ||
|
||
async function test(): Promise<ValidationResultT> { | ||
const version = os.release(); | ||
|
||
if (semver.gte(version, "10.0.16299")) { | ||
return { | ||
status: "success", | ||
}; | ||
} | ||
return { | ||
status: "failure", | ||
comment: `Unsupported version of Windows detected - ${version}. Please, update Windows in case of errors.`, | ||
}; | ||
} | ||
|
||
const main: IValidation = { | ||
label, | ||
platform: ["win32"], | ||
description: toLocale("RNWBuildTestDescription", "Required for running RNW apps"), | ||
category: ValidationCategoryE.Windows, | ||
exec: test, | ||
}; | ||
|
||
export default main; |