Skip to content

Commit 6ce1cd8

Browse files
committed
Expose emulator api
1 parent f84897f commit 6ce1cd8

16 files changed

+16
-236
lines changed

lib/bootstrap.ts

-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ $injector.requireCommand("update", "./commands/update");
140140
$injector.require("iOSLogFilter", "./services/ios-log-filter");
141141
$injector.require("projectChangesService", "./services/project-changes-service");
142142

143-
$injector.require("emulatorPlatformService", "./services/emulator-platform-service");
144-
145143
$injector.require("pbxprojDomXcode", "./node/pbxproj-dom-xcode");
146144
$injector.require("xcode", "./node/xcode");
147145

lib/commands/run.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ export class RunAndroidCommand implements ICommand {
9494
private $injector: IInjector,
9595
private $platformService: IPlatformService,
9696
private $projectData: IProjectData,
97-
private $options: IOptions) {
98-
}
97+
private $options: IOptions) { }
9998

100-
public async execute(args: string[]): Promise<void> {
99+
public execute(args: string[]): Promise<void> {
101100
return this.runCommand.execute(args);
102101
}
103102

lib/definitions/debug.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ interface IDebugOptions {
9191
* If not provided, defaults to 10 seconds.
9292
*/
9393
timeout?: string;
94+
sdk?: string;
9495
}
9596

9697
/**

lib/definitions/emulator-platform-service.d.ts

-15
This file was deleted.

lib/definitions/platform.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ interface ITrackPlatformAction extends IPlatform {
264264
interface IPlatformData {
265265
frameworkPackageName: string;
266266
platformProjectService: IPlatformProjectService;
267-
emulatorServices: Mobile.IEmulatorPlatformServices;
268267
projectRoot: string;
269268
normalizedPlatformName: string;
270269
appDestinationDirectoryPath: string;

lib/helpers/livesync-command-helper.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
2727
platform,
2828
emulator,
2929
skipDeviceDetectionInterval: true,
30-
skipInferPlatform: !platform
30+
skipInferPlatform: !platform,
31+
sdk: this.$options.sdk
3132
});
3233

3334
const devices = this.$devicesService.getDeviceInstances()

lib/services/android-project-service.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
1717

1818
private isAndroidStudioTemplate: boolean;
1919

20-
constructor(private $androidEmulatorServices: Mobile.IEmulatorPlatformServices,
21-
private $androidToolsInfo: IAndroidToolsInfo,
20+
constructor(private $androidToolsInfo: IAndroidToolsInfo,
2221
private $childProcess: IChildProcess,
2322
private $errors: IErrors,
2423
$fs: IFileSystem,
@@ -72,7 +71,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
7271
normalizedPlatformName: "Android",
7372
appDestinationDirectoryPath: path.join(...appDestinationDirectoryArr),
7473
platformProjectService: this,
75-
emulatorServices: this.$androidEmulatorServices,
7674
projectRoot: projectRoot,
7775
deviceBuildOutputPath: path.join(...deviceBuildOutputArr),
7876
getValidBuildOutputData: (buildOptions: IBuildOutputOptions): IValidBuildOutputData => {

lib/services/emulator-platform-service.ts

-179
This file was deleted.

lib/services/ios-debug-service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
129129
args: args,
130130
appId: debugData.applicationIdentifier,
131131
skipInstall: true,
132-
device: debugData.deviceIdentifier
132+
device: debugData.deviceIdentifier,
133+
justlaunch: debugOptions.justlaunch,
134+
timeout: debugOptions.timeout,
135+
sdk: debugOptions.sdk
133136
});
134137

135138
const pid = getPidFromiOSSimulatorLogs(debugData.applicationIdentifier, launchResult);

lib/services/ios-project-service.ts

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
3939
private $cocoapodsService: ICocoaPodsService,
4040
private $errors: IErrors,
4141
private $logger: ILogger,
42-
private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices,
4342
private $injector: IInjector,
4443
$projectDataService: IProjectDataService,
4544
private $prompter: IPrompter,
@@ -76,7 +75,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
7675
normalizedPlatformName: "iOS",
7776
appDestinationDirectoryPath: path.join(projectRoot, projectData.projectName),
7877
platformProjectService: this,
79-
emulatorServices: this.$iOSEmulatorServices,
8078
projectRoot: projectRoot,
8179
deviceBuildOutputPath: path.join(projectRoot, constants.BUILD_DIR, "device"),
8280
emulatorBuildOutputPath: path.join(projectRoot, constants.BUILD_DIR, "emulator"),

test/ios-project-service.ts

+5
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ function createTestInjector(projectPath: string, projectName: string, xcode?: IX
121121
testInjector.register("httpClient", {});
122122
testInjector.register("platformEnvironmentRequirements", {});
123123
testInjector.register("plistParser", {});
124+
testInjector.register("androidEmulatorServices", {});
125+
testInjector.register("androidEmulatorDiscovery", {
126+
on: () => ({})
127+
});
128+
testInjector.register("emulatorHelper", {});
124129

125130
return testInjector;
126131
}

test/npm-support.ts

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ function createTestInjector(): IInjector {
8383
testInjector.register("xmlValidator", XmlValidator);
8484
testInjector.register("config", StaticConfigLib.Configuration);
8585
testInjector.register("projectChangesService", ProjectChangesLib.ProjectChangesService);
86-
testInjector.register("emulatorPlatformService", stubs.EmulatorPlatformService);
8786
testInjector.register("analyticsService", {
8887
track: async (): Promise<any> => undefined
8988
});

test/platform-commands.ts

-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class PlatformData implements IPlatformData {
3333
// intentionally left blank
3434
}
3535
};
36-
emulatorServices: Mobile.IEmulatorPlatformServices = null;
3736
projectRoot = "";
3837
deviceBuildOutputPath = "";
3938
getValidBuildOutputData = (buildOptions: IBuildOutputOptions) => ({ packageNames: [""] });
@@ -143,7 +142,6 @@ function createTestInjector() {
143142
testInjector.register("preparePlatformJSService", {});
144143
testInjector.register("childProcess", ChildProcessLib.ChildProcess);
145144
testInjector.register("projectChangesService", ProjectChangesLib.ProjectChangesService);
146-
testInjector.register("emulatorPlatformService", stubs.EmulatorPlatformService);
147145
testInjector.register("analyticsService", {
148146
track: async () => async (): Promise<any[]> => undefined
149147
});

test/platform-service.ts

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ function createTestInjector() {
9090
});
9191
testInjector.register("childProcess", ChildProcessLib.ChildProcess);
9292
testInjector.register("projectChangesService", ProjectChangesLib.ProjectChangesService);
93-
testInjector.register("emulatorPlatformService", stubs.EmulatorPlatformService);
9493
testInjector.register("analyticsService", {
9594
track: async (): Promise<any[]> => undefined,
9695
trackEventActionInGoogleAnalytics: () => Promise.resolve()

test/stubs.ts

-24
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ export class PlatformProjectServiceStub extends EventEmitter implements IPlatfor
309309
frameworkPackageName: "",
310310
normalizedPlatformName: "",
311311
platformProjectService: this,
312-
emulatorServices: undefined,
313312
projectRoot: "",
314313
deviceBuildOutputPath: "",
315314
getValidBuildOutputData: (buildOptions: IBuildOutputOptions) => ({ packageNames: [] }),
@@ -416,7 +415,6 @@ export class PlatformsDataStub extends EventEmitter implements IPlatformsData {
416415
return {
417416
frameworkPackageName: "",
418417
platformProjectService: new PlatformProjectServiceStub(),
419-
emulatorServices: undefined,
420418
projectRoot: "",
421419
normalizedPlatformName: "",
422420
appDestinationDirectoryPath: "",
@@ -811,28 +809,6 @@ export class PlatformServiceStub extends EventEmitter implements IPlatformServic
811809
}
812810
}
813811

814-
export class EmulatorPlatformService implements IEmulatorPlatformService {
815-
public listAvailableEmulators(platform: string): Promise<void> {
816-
return Promise.resolve();
817-
}
818-
819-
public getEmulatorInfo(platform: string, nameOfId: string): Promise<IEmulatorInfo> {
820-
return Promise.resolve(null);
821-
}
822-
823-
public getiOSEmulators(): Promise<IEmulatorInfo[]> {
824-
return Promise.resolve(null);
825-
}
826-
827-
public getAndroidEmulators(): IEmulatorInfo[] {
828-
return null;
829-
}
830-
831-
public startEmulator(info: IEmulatorInfo): Promise<void> {
832-
return Promise.resolve();
833-
}
834-
}
835-
836812
export class AndroidResourcesMigrationServiceStub implements IAndroidResourcesMigrationService {
837813
canMigrate(platformString: string): boolean {
838814
return true;

0 commit comments

Comments
 (0)