Skip to content

Commit d60f362

Browse files
Merge pull request #1678 from NativeScript/milanov/add-adb-errors-check
Add Android debug bridge result handler
2 parents 881f2af + fa290bd commit d60f362

File tree

9 files changed

+64
-59
lines changed

9 files changed

+64
-59
lines changed

lib/android-tools-info.ts

Lines changed: 50 additions & 49 deletions
Large diffs are not rendered by default.

lib/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class StaticConfig extends StaticConfigBase implements IStaticConfig {
4646

4747
public get SYS_REQUIREMENTS_LINK(): string {
4848
let linkToSysRequirements: string;
49-
switch(process.platform) {
49+
switch (process.platform) {
5050
case "linux":
5151
linkToSysRequirements = "http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-linux.html#system-requirements";
5252
break;
@@ -77,13 +77,13 @@ export class StaticConfig extends StaticConfigBase implements IStaticConfig {
7777
return path.join(__dirname, "..", "package.json");
7878
}
7979

80-
public get PATH_TO_BOOTSTRAP() : string {
80+
public get PATH_TO_BOOTSTRAP(): string {
8181
return path.join(__dirname, "bootstrap");
8282
}
8383

8484
public getAdbFilePath(): IFuture<string> {
8585
return (() => {
86-
if(!this._adbFilePath) {
86+
if (!this._adbFilePath) {
8787
let androidToolsInfo: IAndroidToolsInfo = this.$injector.resolve("androidToolsInfo");
8888
this._adbFilePath = androidToolsInfo.getPathToAdbFromAndroidHome().wait() || super.getAdbFilePath().wait();
8989
}

lib/providers/device-app-data-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as deviceAppDataBaseLib from "../common/mobile/device-app-data/device-a
44
import Future = require("fibers/future");
55
import * as path from "path";
66
import {AndroidDeviceHashService} from "../common/mobile/android/android-device-hash-service";
7-
import {AndroidDebugBridge} from "../common/mobile/android/android-debug-bridge";
7+
import {DeviceAndroidDebugBridge} from "../common/mobile/android/device-android-debug-bridge";
88

99
const SYNC_DIR_NAME = "sync";
1010
const FULLSYNC_DIR_NAME = "fullsync";
@@ -64,7 +64,7 @@ export class AndroidAppIdentifier extends deviceAppDataBaseLib.DeviceAppDataBase
6464

6565
private getSyncFolderName(): IFuture<string> {
6666
return ((): string =>{
67-
let adb = this.$injector.resolve(AndroidDebugBridge, { identifier: this.device.deviceInfo.identifier });
67+
let adb = this.$injector.resolve(DeviceAndroidDebugBridge, { identifier: this.device.deviceInfo.identifier });
6868
let deviceHashService = this.$injector.resolve(AndroidDeviceHashService, {adb: adb, appIdentifier: this.appIdentifier});
6969
let hashFile = this.$options.force ? null : deviceHashService.doesShasumFileExistsOnDevice().wait();
7070
return this.$options.watch || hashFile ? SYNC_DIR_NAME : FULLSYNC_DIR_NAME;

lib/services/android-project-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Future = require("fibers/future");
66
import * as constants from "../constants";
77
import * as semver from "semver";
88
import * as projectServiceBaseLib from "./platform-project-service-base";
9-
import * as androidDebugBridgePath from "../common/mobile/android/android-debug-bridge";
9+
import {DeviceAndroidDebugBridge} from "../common/mobile/android/device-android-debug-bridge";
1010
import {AndroidDeviceHashService} from "../common/mobile/android/android-device-hash-service";
1111
import {EOL} from "os";
1212
import { createGUID } from "../common/helpers";
@@ -393,7 +393,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
393393

394394
public deploy(deviceIdentifier: string): IFuture<void> {
395395
return (() => {
396-
let adb = this.$injector.resolve(androidDebugBridgePath.AndroidDebugBridge, { identifier: deviceIdentifier });
396+
let adb = this.$injector.resolve(DeviceAndroidDebugBridge, { identifier: deviceIdentifier });
397397
let deviceRootPath = `/data/local/tmp/${this.$projectData.projectId}`;
398398
adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"),
399399
this.$mobileHelper.buildDevicePath(deviceRootPath, "sync"),

lib/services/livesync/android-livesync-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path="../../.d.ts"/>
22
"use strict";
33

4-
import {AndroidDebugBridge} from "../../common/mobile/android/android-debug-bridge";
4+
import {DeviceAndroidDebugBridge} from "../../common/mobile/android/device-android-debug-bridge";
55
import {AndroidDeviceHashService} from "../../common/mobile/android/android-device-hash-service";
66
import Future = require("fibers/future");
77
import * as helpers from "../../common/helpers";
@@ -102,7 +102,7 @@ class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<
102102
private _deviceHashService: Mobile.IAndroidDeviceHashService;
103103
private get deviceHashService(): Mobile.IAndroidDeviceHashService {
104104
if (!this._deviceHashService) {
105-
let adb = this.$injector.resolve(AndroidDebugBridge, { identifier: this.device.deviceInfo.identifier });
105+
let adb = this.$injector.resolve(DeviceAndroidDebugBridge, { identifier: this.device.deviceInfo.identifier });
106106
this._deviceHashService = this.$injector.resolve(AndroidDeviceHashService, { adb: adb, appIdentifier: this.$projectData.projectId });
107107
}
108108

test/ios-project-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function createTestInjector(projectPath: string, projectName: string): IInjector
4545
testInjector.register("config", ConfigLib.Configuration);
4646
testInjector.register("errors", ErrorsLib.Errors);
4747
testInjector.register("fs", FileSystemLib.FileSystem);
48+
testInjector.register("adb", {});
4849
testInjector.register("hostInfo", HostInfoLib.HostInfo);
4950
testInjector.register("injector", testInjector);
5051
testInjector.register("iOSEmulatorServices", {});

test/npm-support.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ let assert = require("chai").assert;
4141
function createTestInjector(): IInjector {
4242
let testInjector = new yok.Yok();
4343
testInjector.register("fs", FsLib.FileSystem);
44+
testInjector.register("adb", {});
4445
testInjector.register("options", OptionsLib.Options);
4546
testInjector.register("errors", ErrorsLib.Errors);
4647
testInjector.register("staticConfig", StaticConfigLib.StaticConfig);

test/plugins-service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function createTestInjector() {
4747
testInjector.register("messagesService", MessagesService);
4848
testInjector.register("npm", NodePackageManager);
4949
testInjector.register("fs", FileSystem);
50+
testInjector.register("adb", {});
51+
testInjector.register("androidDebugBridgeResultHandler", {});
5052
testInjector.register("projectData", ProjectData);
5153
testInjector.register("platforsmData", stubs.PlatformsDataStub);
5254
testInjector.register("childProcess", ChildProcess);

0 commit comments

Comments
 (0)