Skip to content

Commit b1c79a4

Browse files
committed
Expose emulator api
1 parent cff6778 commit b1c79a4

16 files changed

+18
-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

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ interface IDebugOptions {
8686
* Defines if should print all availableDevices
8787
*/
8888
availableDevices?: boolean;
89+
90+
sdk?: string;
91+
timeout?: string;
8992
}
9093

9194
/**

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
@@ -26,7 +26,8 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
2626
platform: platform,
2727
emulator: this.$options.emulator,
2828
skipDeviceDetectionInterval: true,
29-
skipInferPlatform: !platform
29+
skipInferPlatform: !platform,
30+
sdk: this.$options.sdk
3031
});
3132

3233
await this.$devicesService.detectCurrentlyAttachedDevices({ shouldReturnImmediateResult: false, platform: platform });

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
@@ -40,7 +40,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
4040
private $cocoapodsService: ICocoaPodsService,
4141
private $errors: IErrors,
4242
private $logger: ILogger,
43-
private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices,
4443
private $injector: IInjector,
4544
$projectDataService: IProjectDataService,
4645
private $prompter: IPrompter,
@@ -77,7 +76,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
7776
normalizedPlatformName: "iOS",
7877
appDestinationDirectoryPath: path.join(projectRoot, projectData.projectName),
7978
platformProjectService: this,
80-
emulatorServices: this.$iOSEmulatorServices,
8179
projectRoot: projectRoot,
8280
deviceBuildOutputPath: path.join(projectRoot, constants.BUILD_DIR, "device"),
8381
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
@@ -87,7 +87,6 @@ function createTestInjector() {
8787
});
8888
testInjector.register("childProcess", ChildProcessLib.ChildProcess);
8989
testInjector.register("projectChangesService", ProjectChangesLib.ProjectChangesService);
90-
testInjector.register("emulatorPlatformService", stubs.EmulatorPlatformService);
9190
testInjector.register("analyticsService", {
9291
track: async (): Promise<any[]> => undefined,
9392
trackEventActionInGoogleAnalytics: () => Promise.resolve()

test/stubs.ts

-24
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ export class PlatformProjectServiceStub extends EventEmitter implements IPlatfor
308308
frameworkPackageName: "",
309309
normalizedPlatformName: "",
310310
platformProjectService: this,
311-
emulatorServices: undefined,
312311
projectRoot: "",
313312
deviceBuildOutputPath: "",
314313
getValidBuildOutputData: (buildOptions: IBuildOutputOptions) => ({ packageNames: [] }),
@@ -423,7 +422,6 @@ export class PlatformsDataStub extends EventEmitter implements IPlatformsData {
423422
return {
424423
frameworkPackageName: "",
425424
platformProjectService: new PlatformProjectServiceStub(),
426-
emulatorServices: undefined,
427425
projectRoot: "",
428426
normalizedPlatformName: "",
429427
appDestinationDirectoryPath: "",
@@ -818,28 +816,6 @@ export class PlatformServiceStub extends EventEmitter implements IPlatformServic
818816
}
819817
}
820818

821-
export class EmulatorPlatformService implements IEmulatorPlatformService {
822-
public listAvailableEmulators(platform: string): Promise<void> {
823-
return Promise.resolve();
824-
}
825-
826-
public getEmulatorInfo(platform: string, nameOfId: string): Promise<IEmulatorInfo> {
827-
return Promise.resolve(null);
828-
}
829-
830-
public getiOSEmulators(): Promise<IEmulatorInfo[]> {
831-
return Promise.resolve(null);
832-
}
833-
834-
public getAndroidEmulators(): IEmulatorInfo[] {
835-
return null;
836-
}
837-
838-
public startEmulator(info: IEmulatorInfo): Promise<void> {
839-
return Promise.resolve();
840-
}
841-
}
842-
843819
export class AndroidResourcesMigrationServiceStub implements IAndroidResourcesMigrationService {
844820
canMigrate(platformString: string): boolean {
845821
return true;

0 commit comments

Comments
 (0)