Skip to content

Fix emulate-livesync-emulate #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common
2 changes: 1 addition & 1 deletion lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface IPlatformProjectService {
removePluginNativeCode(pluginData: IPluginData): IFuture<void>;
afterPrepareAllPlugins(): IFuture<void>;
getAppResourcesDestinationDirectoryPath(): IFuture<string>;
deploy(device: Mobile.IDevice, appIdentifier: string): IFuture<void>;
deploy(deviceIdentifier: string): IFuture<void>;
}

interface IAndroidProjectPropertiesManager {
Expand Down
11 changes: 7 additions & 4 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Future = require("fibers/future");
import * as constants from "../constants";
import * as semver from "semver";
import * as projectServiceBaseLib from "./platform-project-service-base";
import * as androidDebugBridgePath from "../common/mobile/android/android-debug-bridge";

class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService {
private static VALUES_DIRNAME = "values";
Expand All @@ -28,7 +29,8 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
$projectData: IProjectData,
$projectDataService: IProjectDataService,
private $sysInfo: ISysInfo,
private $mobileHelper: Mobile.IMobileHelper) {
private $mobileHelper: Mobile.IMobileHelper,
private $injector: IInjector) {
super($fs, $projectData, $projectDataService);
this._androidProjectPropertiesManagers = Object.create(null);
}
Expand Down Expand Up @@ -285,10 +287,11 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
return Future.fromResult();
}

public deploy(device: Mobile.IAndroidDevice, appIdentifier: string): IFuture<void> {
public deploy(deviceIdentifier: string): IFuture<void> {
return (() => {
let deviceRootPath = `/data/local/tmp/${appIdentifier}`;
device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"),
let adb = this.$injector.resolve(androidDebugBridgePath.AndroidDebugBridge, { identifier: deviceIdentifier });
let deviceRootPath = `/data/local/tmp/${this.$projectData.projectId}`;
adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"),
this.$mobileHelper.buildDevicePath(deviceRootPath, "sync"),
this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync")]).wait();
}).future<void>()();
Expand Down
2 changes: 1 addition & 1 deletion lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
}).future<void>()();
}

public deploy(device: Mobile.IDevice, appIdentifier: string): IFuture<void> {
public deploy(deviceIdentifier: string): IFuture<void> {
return Future.fromResult();
}

Expand Down
5 changes: 4 additions & 1 deletion lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class PlatformService implements IPlatformService {
this.$devicesServices.initialize({platform: platform, deviceId: this.$options.device}).wait();
let action = (device: Mobile.IDevice): IFuture<void> => {
return (() => {
platformData.platformProjectService.deploy(device, this.$projectData.projectId).wait();
platformData.platformProjectService.deploy(device.deviceInfo.identifier).wait();
device.deploy(packageFile, this.$projectData.projectId).wait();

if (!this.$options.justlaunch) {
Expand All @@ -301,6 +301,9 @@ export class PlatformService implements IPlatformService {
emulatorServices.checkAvailability().wait();
emulatorServices.checkDependencies().wait();

let emulatorId = emulatorServices.getEmulatorId().wait();
platformData.platformProjectService.deploy(emulatorId).wait();

if(!this.$options.availableDevices) {
this.buildPlatform(platform, buildConfig).wait();

Expand Down
2 changes: 1 addition & 1 deletion test/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class PlatformProjectServiceStub implements IPlatformProjectService {
afterPrepareAllPlugins(): IFuture<void> {
return Future.fromResult();
}
deploy(device: Mobile.IAndroidDevice, appIdentifier: string): IFuture<void> {
deploy(deviceIdentifier: string): IFuture<void> {
return Future.fromResult();
}
}
Expand Down