microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fix-ts-error1

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

75lines · 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
4import * as nls from "vscode-nls";
948a0d44Heniker4 years ago5import {
6basicCheck,
7createNotFoundMessage,
8createVersionErrorMessage,
9parseVersion,
10} from "../util";
09f6024fHeniker4 years ago11import { ValidationCategoryE, IValidation, ValidationResultT } from "./types";
c7856462Heniker4 years ago12
13nls.config({
14messageFormat: nls.MessageFormat.bundle,
15bundleFormat: nls.BundleFormat.standalone,
16})();
17
18const toLocale = nls.loadMessageBundle();
19
20const label = "ADB";
21
22async function test(): Promise<ValidationResultT> {
948a0d44Heniker4 years ago23const result = await basicCheck({
24command: "adb",
25versionRange: "30.0.0",
60d51474AndreiLobanovich4 years ago26getVersion: parseVersion.bind(null, "adb --version", /Version \d+\.\d+\.\d+/),
948a0d44Heniker4 years ago27});
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}
51
52return { status: "success" };
c7856462Heniker4 years ago53}
54
55const adbAndroid: IValidation = {
56label,
57description: toLocale(
58"AdbCheckAndroidDescription",
948a0d44Heniker4 years ago59"Required for app installation. Minimal version is 12",
c7856462Heniker4 years ago60),
61category: ValidationCategoryE.Android,
62exec: test,
63};
64
65const adbExpo: IValidation = {
66label,
67description: toLocale(
68"AdbCheckExpoDescription",
69"Required for correct extension integration with Expo",
70),
71category: ValidationCategoryE.Expo,
72exec: test,
73};
74
75export { adbAndroid, adbExpo };