Skip to content

Commit a7f0a9d

Browse files
Cache instances of "base" commands in debug and run
1 parent 2ca30c1 commit a7f0a9d

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/commands/debug.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CONNECTED_STATUS } from "../common/constants";
22
import { isInteractive } from "../common/helpers";
3+
import { cache } from "../common/decorators";
34
import { DebugCommandErrors } from "../constants";
45

56
export class DebugPlatformCommand implements ICommand {
@@ -117,6 +118,8 @@ export class DebugPlatformCommand implements ICommand {
117118
}
118119

119120
export class DebugIOSCommand implements ICommand {
121+
122+
@cache()
120123
private get debugPlatformCommand(): DebugPlatformCommand {
121124
return this.$injector.resolve<DebugPlatformCommand>(DebugPlatformCommand, { debugService: this.$iOSDebugService, platform: this.platform });
122125
}
@@ -158,6 +161,8 @@ export class DebugIOSCommand implements ICommand {
158161
$injector.registerCommand("debug|ios", DebugIOSCommand);
159162

160163
export class DebugAndroidCommand implements ICommand {
164+
165+
@cache()
161166
private get debugPlatformCommand(): DebugPlatformCommand {
162167
return this.$injector.resolve<DebugPlatformCommand>(DebugPlatformCommand, { debugService: this.$androidDebugService, platform: this.platform });
163168
}

lib/commands/run.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ERROR_NO_VALID_SUBCOMMAND_FORMAT } from "../common/constants";
2+
import { cache } from "../common/decorators";
23

34
export class RunCommandBase implements ICommand {
45
protected platform: string;
@@ -66,6 +67,8 @@ export class RunCommandBase implements ICommand {
6667
$injector.registerCommand("run|*all", RunCommandBase);
6768

6869
export class RunIosCommand implements ICommand {
70+
71+
@cache()
6972
private get runCommand(): RunCommandBase {
7073
return this.$injector.resolve<RunCommandBase>(RunCommandBase);
7174
}
@@ -100,6 +103,8 @@ export class RunIosCommand implements ICommand {
100103
$injector.registerCommand("run|ios", RunIosCommand);
101104

102105
export class RunAndroidCommand implements ICommand {
106+
107+
@cache()
103108
private get runCommand(): RunCommandBase {
104109
return this.$injector.resolve<RunCommandBase>(RunCommandBase);
105110
}

lib/services/project-changes-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class ProjectChangesService implements IProjectChangesService {
147147
}
148148
}
149149

150-
public ensurePrepareInfo(platform: string, projectData: IProjectData, projectChangesOptions: IProjectChangesOptions): boolean {
150+
private ensurePrepareInfo(platform: string, projectData: IProjectData, projectChangesOptions: IProjectChangesOptions): boolean {
151151
this._prepareInfo = this.getPrepareInfo(platform, projectData);
152152
if (this._prepareInfo) {
153153
this._prepareInfo.nativePlatformStatus = this._prepareInfo.nativePlatformStatus && this._prepareInfo.nativePlatformStatus < projectChangesOptions.nativePlatformStatus ?

0 commit comments

Comments
 (0)