Skip to content

chore: fix console.log regression after introducing ios-sim async api #3722

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
Jul 4, 2018
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
4 changes: 2 additions & 2 deletions lib/definitions/ios-debugger-port-service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface IIOSDebuggerPortService {
* In case when STARTING_IOS_APPLICATION event is emitted, sets the port to null and add timeout for 5000 miliseconds which checks if port is null and prints a warning.
* @param {Mobile.IDevice} device - Describes the device which logs should be parsed.
* @param {IProjectDir} data - Object that has a projectDir property.
* @returns {void}
* @returns {Promise<void>}
*/
attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): void;
attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): Promise<void>;
}
2 changes: 1 addition & 1 deletion lib/definitions/ios-log-parser-service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ interface IIOSLogParserService extends NodeJS.EventEmitter {
* Starts looking for debugger port. Attaches on device logs and processes them. In case when port is found, DEBUGGER_PORT_FOUND event is emitted.
* @param {Mobile.IDevice} device - Describes the device which logs will be processed.
*/
startParsingLog(device: Mobile.IDevice, data: IProjectName): void;
startParsingLog(device: Mobile.IDevice, data: IProjectName): Promise<void>;
}
2 changes: 1 addition & 1 deletion lib/definitions/livesync.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ interface IPlatformLiveSyncService {
fullSync(syncInfo: IFullSyncInfo): Promise<ILiveSyncResultInfo>;
liveSyncWatchAction(device: Mobile.IDevice, liveSyncInfo: ILiveSyncWatchInfo): Promise<ILiveSyncResultInfo>;
refreshApplication(projectData: IProjectData, liveSyncInfo: ILiveSyncResultInfo): Promise<void>;
prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): void;
prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): Promise<void>;
}

interface INativeScriptDeviceLiveSyncService extends IDeviceLiveSyncServiceBase {
Expand Down
2 changes: 1 addition & 1 deletion lib/services/ios-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
await this.device.openDeviceLogStream();
}

this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(this.device, debugData);
await this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(this.device, debugData);

if (debugOptions.emulator) {
if (debugOptions.start) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/ios-debugger-port-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class IOSDebuggerPortService implements IIOSDebuggerPortService {
});
}

public attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): void {
public async attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): Promise<void> {
const projectData = this.$projectDataService.getProjectData(data && data.projectDir);
if (!this.canStartLookingForDebuggerPort(projectData)) {
return;
Expand All @@ -45,7 +45,7 @@ export class IOSDebuggerPortService implements IIOSDebuggerPortService {
this.attachToDebuggerPortFoundEventCore();
this.attachToAttachRequestEvent(device);

this.$iOSLogParserService.startParsingLog(device, projectData);
await this.$iOSLogParserService.startParsingLog(device, projectData);
}

private canStartLookingForDebuggerPort(data: IProjectDir): boolean {
Expand Down
6 changes: 3 additions & 3 deletions lib/services/ios-log-parser-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export class IOSLogParserService extends EventEmitter implements IIOSLogParserSe
super();
}

public startParsingLog(device: Mobile.IDevice, data: IProjectName): void {
public async startParsingLog(device: Mobile.IDevice, data: IProjectName): Promise<void> {
this.$deviceLogProvider.setProjectNameForDevice(device.deviceInfo.identifier, data.projectName);

if (!this.startedDeviceLogInstances[device.deviceInfo.identifier]) {
this.startParsingLogCore(device);
this.startLogProcess(device);
await this.startLogProcess(device);
this.startedDeviceLogInstances[device.deviceInfo.identifier] = true;
}
}
Expand All @@ -41,7 +41,7 @@ export class IOSLogParserService extends EventEmitter implements IIOSLogParserSe
}
}

private startLogProcess(device: Mobile.IDevice): void {
private async startLogProcess(device: Mobile.IDevice): Promise<void> {
if (device.isEmulator) {
return this.$iOSSimulatorLogProvider.startNewMutedLogProcess(device.deviceInfo.identifier);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/services/livesync/android-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export class AndroidLiveSyncService extends PlatformLiveSyncServiceBase implemen
return service;
}

public prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir): void { /* */ }
public async prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir): Promise<void> { /* */ }
}
$injector.register("androidLiveSyncService", AndroidLiveSyncService);
4 changes: 2 additions & 2 deletions lib/services/livesync/ios-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ export class IOSLiveSyncService extends PlatformLiveSyncServiceBase implements I
}
}

public prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): void {
public async prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): Promise<void> {
if (!liveSyncInfo.skipWatcher) {
this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, data);
return this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, data);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/services/livesync/livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
const platformLiveSyncService = this.getLiveSyncService(platform);
const deviceBuildInfoDescriptor = _.find(deviceDescriptors, dd => dd.identifier === device.deviceInfo.identifier);

platformLiveSyncService.prepareForLiveSync(device, projectData, liveSyncData);
await platformLiveSyncService.prepareForLiveSync(device, projectData, liveSyncData);

await this.ensureLatestAppPackageIsInstalledOnDevice({
device,
Expand Down
4 changes: 2 additions & 2 deletions test/services/ios-debugger-port-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe("iOSDebuggerPortService", () => {

_.each(testCases, testCase => {
it(testCase.name, async () => {
iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
await iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
if (testCase.emitStartingIOSApplicationEvent) {
emitStartingIOSApplicationEvent();
}
Expand All @@ -162,7 +162,7 @@ describe("iOSDebuggerPortService", () => {
assert.deepEqual(port, testCase.emittedPort);
});
it(`${testCase.name} for multiline debugger port message.`, async () => {
iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
await iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
if (testCase.emitStartingIOSApplicationEvent) {
emitStartingIOSApplicationEvent();
}
Expand Down