microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
improve-configuration

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/services/validationService/checks/emulator.ts

65lines · modeblame

c7856462Heniker4 years ago1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
09f6024fHeniker4 years ago4import * as nls from "vscode-nls";
c7856462Heniker4 years ago5import {
948a0d44Heniker4 years ago6basicCheck,
c7856462Heniker4 years ago7createNotFoundMessage,
8createVersionErrorMessage,
948a0d44Heniker4 years ago9parseVersion,
c7856462Heniker4 years ago10} from "../util";
11import { ValidationCategoryE, IValidation, ValidationResultT } from "./types";
12
13nls.config({
14messageFormat: nls.MessageFormat.bundle,
15bundleFormat: nls.BundleFormat.standalone,
16})();
17
18const toLocale = nls.loadMessageBundle();
19
20const label = "Android Emulator";
21
22async function test(): Promise<ValidationResultT> {
948a0d44Heniker4 years ago23const result = await basicCheck({
24command: "emulator",
25versionRange: "30.0.0",
26getVersion: parseVersion.bind(null, "emulator -version", /version (.*?)( |$)/gi),
27});
28
29if (!result.exists) {
c7856462Heniker4 years ago30return {
31status: "failure",
32comment: createNotFoundMessage(label),
33};
34}
35
948a0d44Heniker4 years ago36if (result.versionCompare === undefined) {
c7856462Heniker4 years ago37return {
38status: "failure",
39comment: createVersionErrorMessage(label),
40};
41}
42
948a0d44Heniker4 years ago43if (result.versionCompare === -1) {
44return {
45status: "partial-success",
46comment:
47"Detected version is older than 30.0.0. " +
48"Please update SDK tools in case of errors",
49};
50}
c7856462Heniker4 years ago51
948a0d44Heniker4 years ago52return { status: "success" };
c7856462Heniker4 years ago53}
54
55const main: IValidation = {
56label,
57description: toLocale(
58"EmulatorCheckDescription",
59"Required for working with Android emulators",
60),
61category: ValidationCategoryE.Android,
62exec: test,
63};
64
65export default main;