@@ -73,9 +73,12 @@ Library that helps identifying if the environment can be used for development of
73
73
* Module ` sysInfo ` :
74
74
- Usage:
75
75
```TypeScript
76
- import { sysInfo } from "nativescript-doctor";
76
+ import { sysInfo, setShouldCacheSysInfo } from "nativescript-doctor";
77
77
78
78
async function main() {
79
+ // The default value is true. If set to false the result of each check for each element
80
+ // of the sys info will not be cached.
81
+ setShouldCacheSysInfo(false);
79
82
const javaVersion = await sysInfo.getJavaVersion();
80
83
console.log("java: ", javaVersion);
81
84
@@ -252,11 +255,24 @@ Library that helps identifying if the environment can be used for development of
252
255
*/
253
256
isCocoaPodsUpdateRequired(): Promise<boolean>;
254
257
258
+ /**
259
+ * Checks if the Android SDK Tools are installed and configured correctly.
260
+ * @return {Promise<boolean>} true if the Android SDK Tools are installed and configured correctly.
261
+ */
262
+ isAndroidSdkConfiguredCorrectly(): Promise<boolean>;
263
+
255
264
/**
256
265
* Returns the whole system information.
257
266
* @return {Promise<ISysInfoData>} The system information.
258
267
*/
259
268
getSysInfo(): Promise<ISysInfoData>;
269
+
270
+ /**
271
+ * If set to true each method will cache it's result. The default value is true.
272
+ * @param {boolean} shouldCache The cache switch.
273
+ * @return {void}
274
+ */
275
+ setShouldCacheSysInfo(shouldCache: boolean): void;
260
276
}
261
277
262
278
interface ISysInfoData {
@@ -393,12 +409,18 @@ Library that helps identifying if the environment can be used for development of
393
409
* Information about xcproj.
394
410
* @type {string}
395
411
*/
396
- xcprojInfo: IXcprojInfo
412
+ xcprojInfo: IXcprojInfo;
397
413
398
414
/**
399
415
* true if the system requires xcproj to build projects successfully and the CocoaPods version is not compatible with the Xcode.
400
416
*/
401
417
isCocoaPodsUpdateRequired: boolean;
418
+
419
+ /**
420
+ * true if the Android SDK Tools are installed and configured correctly.
421
+ * @type {boolean}
422
+ */
423
+ isAndroidSdkConfiguredCorrectly: boolean;
402
424
}
403
425
404
426
/**
@@ -417,6 +439,91 @@ Library that helps identifying if the environment can be used for development of
417
439
}
418
440
```
419
441
442
+ * Module ` androidToolsInfo ` :
443
+ - Usage:
444
+ ```TypeScript
445
+ import { androidToolsInfo } from "nativescript-doctor"
446
+
447
+ function main() {
448
+ console.log("path to adb from android home: ", await androidToolsInfo.getPathToAdbFromAndroidHome());
449
+ console.log("path to emulator executable: ", androidToolsInfo.getPathToEmulatorExecutable());
450
+ console.log("android tools info: ", androidToolsInfo.getToolsInfo());
451
+ console.log("ANROID_HOME validation errors: ", await androidToolsInfo.validateAndroidHomeEnvVariable());
452
+ console.log("android tools info validation errors: ", await androidToolsInfo.validateInfo());
453
+ console.log("javac validation errors: ", await androidToolsInfo.validateJavacVersion(await sysInfo.getJavaCompilerVersion()));
454
+ }
455
+
456
+ main();
457
+ ```
458
+ - Interfaces:
459
+ /**
460
+ * Describes methods for getting and validating Android tools.
461
+ */
462
+ interface IAndroidToolsInfo {
463
+ /**
464
+ * Returns the Android tools info.
465
+ * @return {NativeScriptDoctor.IAndroidToolsInfoData} returns the Android tools info.
466
+ */
467
+ getToolsInfo(): NativeScriptDoctor.IAndroidToolsInfoData;
468
+
469
+ /**
470
+ * Checks if the Android tools are valid.
471
+ * @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
472
+ */
473
+ validateInfo(): NativeScriptDoctor.IWarning[];
474
+
475
+ /**
476
+ * Checks if the current javac version is valid.
477
+ * @param {string} installedJavaVersion The version of javac to check.
478
+ * @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
479
+ */
480
+ validateJavacVersion(installedJavaVersion: string): NativeScriptDoctor.IWarning[];
481
+
482
+ /**
483
+ * Returns the path to the adb which is located in ANDROID_HOME.
484
+ * @return {Promise<string>} Path to the adb which is located in ANDROID_HOME.
485
+ */
486
+ getPathToAdbFromAndroidHome(): Promise<string>;
487
+
488
+ /**
489
+ * Checks if the ANDROID_HOME variable is set to the correct folder.
490
+ * @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
491
+ */
492
+ validateAndroidHomeEnvVariable(): NativeScriptDoctor.IWarning[];
493
+
494
+ /**
495
+ * Returns the path to the emulator executable.
496
+ * @return {string} The path to the emulator executable.
497
+ */
498
+ getPathToEmulatorExecutable(): string;
499
+ }
500
+
501
+ /**
502
+ * Describes information about installed Android tools and SDKs.
503
+ */
504
+ interface IAndroidToolsInfoData {
505
+ /**
506
+ * The value of ANDROID_HOME environment variable.
507
+ */
508
+ androidHomeEnvVar: string;
509
+
510
+ /**
511
+ * The latest installed version of Android Build Tools that satisfies CLI's requirements.
512
+ */
513
+ buildToolsVersion: string;
514
+
515
+ /**
516
+ * The latest installed version of Android SDK that satisfies CLI's requirements.
517
+ */
518
+ compileSdkVersion: number;
519
+
520
+ /**
521
+ * The latest installed version of Android Support Repository that satisfies CLI's requirements.
522
+ */
523
+ supportRepositoryVersion: string;
524
+ }
525
+ ```
526
+
420
527
* Module ` constants ` :
421
528
- Usage:
422
529
```TypeScript
0 commit comments