Skip to content

Commit d84108e

Browse files
author
Tsvetan Raikov
committed
Fixed: TNS run command broken with using --watch
1 parent 85d7c78 commit d84108e

File tree

14 files changed

+130
-199
lines changed

14 files changed

+130
-199
lines changed

bin/nativescript.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
"use strict";
4+
require("../lib/nativescript-cli.js");

lib/commands/appstore-upload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class PublishIOS implements ICommand {
6565
};
6666
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
6767
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
68-
this.$platformService.prepareAndBuild(platform, iOSBuildConfig, true).wait();
68+
this.$platformService.buildPlatform(platform, iOSBuildConfig, true).wait();
6969
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
7070
} else {
7171
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");

lib/commands/build.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ export class BuildCommandBase {
22
constructor(protected $options: IOptions,
33
private $platformService: IPlatformService) { }
44

5-
executeCore(args: string[], buildConfig?: IBuildConfig): IFuture<void> {
5+
executeCore(args: string[]): IFuture<void> {
66
return (() => {
77
let platform = args[0].toLowerCase();
8-
this.$platformService.preparePlatform(platform, true).wait();
9-
this.$platformService.buildPlatform(platform, buildConfig).wait();
8+
this.$platformService.buildPlatform(platform, null, true).wait();
109
if(this.$options.copyTo) {
1110
this.$platformService.copyLastOutput(platform, this.$options.copyTo, {isForDevice: this.$options.forDevice}).wait();
1211
}

lib/commands/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class DeployOnDeviceCommand implements ICommand {
66
private $mobileHelper: Mobile.IMobileHelper) { }
77

88
execute(args: string[]): IFuture<void> {
9-
return this.$platformService.deployOnDevice(args[0]);
9+
return this.$platformService.deployPlatform(args[0]);
1010
}
1111

1212
public canExecute(args: string[]): IFuture<boolean> {

lib/commands/emulate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export class EmulateCommandBase {
22
constructor(private $platformService: IPlatformService) { }
33

44
executeCore(args: string[]): IFuture<void> {
5-
return this.$platformService.deployOnEmulator(args[0]);
5+
return this.$platformService.emulatePlatform(args[0]);
66
}
77
}
88

lib/commands/run.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ export class RunCommandBase {
33
private $usbLiveSyncService: ILiveSyncService,
44
protected $options: IOptions) { }
55

6-
public executeCore(args: string[], buildConfig?: IBuildConfig): IFuture<void> {
6+
public executeCore(args: string[]): IFuture<void> {
77
if (this.$options.watch) {
8+
this.$platformService.deployPlatform(args[0]).wait();
89
return this.$usbLiveSyncService.liveSync(args[0]);
910
} else {
10-
return this.$platformService.runPlatform(args[0], buildConfig);
11+
return this.$platformService.runPlatform(args[0]);
1112
}
1213
}
1314
}

lib/definitions/platform.d.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ interface IPlatformService {
55
getPreparedPlatforms(): IFuture<string[]>;
66
removePlatforms(platforms: string[]): IFuture<void>;
77
updatePlatforms(platforms: string[]): IFuture<void>;
8-
runPlatform(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
98
preparePlatform(platform: string, force?: boolean, skipModulesAndResources?: boolean): IFuture<boolean>;
9+
buildPlatform(platform: string, buildConfig?: IBuildConfig, forceBuild?: boolean): IFuture<void>;
10+
deployPlatform(platform: string): IFuture<void>;
11+
runPlatform(platform: string): IFuture<void>;
12+
emulatePlatform(platform: string): IFuture<void>;
1013
cleanDestinationApp(platform: string): IFuture<void>;
11-
buildPlatform(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
12-
buildForDeploy(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
13-
installOnDevice(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
14-
deployOnDevice(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
15-
startOnDevice(platform: string): IFuture<void>;
16-
deployOnEmulator(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
1714
validatePlatformInstalled(platform: string): void;
1815
validatePlatform(platform: string): void;
1916

@@ -22,8 +19,6 @@ interface IPlatformService {
2219
copyLastOutput(platform: string, targetPath: string, settings: {isForDevice: boolean}): IFuture<void>;
2320
lastOutputPath(platform: string, settings: { isForDevice: boolean }): string;
2421
ensurePlatformInstalled(platform: string): IFuture<void>;
25-
26-
prepareAndBuild(platform: string, buildConfig?: IBuildConfig, forceBuild?: boolean): IFuture<void>;
2722
}
2823

2924
interface IPlatformData {

lib/definitions/project.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ interface IPlatformProjectService {
6868
interpolateConfigurationFile(configurationFilePath?: string): IFuture<void>;
6969
afterCreateProject(projectRoot: string): IFuture<void>;
7070
buildProject(projectRoot: string, buildConfig?: IBuildConfig): IFuture<void>;
71-
buildForDeploy(projectRoot: string, buildConfig?: IBuildConfig): IFuture<void>;
7271
prepareProject(): IFuture<void>;
7372
prepareAppResources(appResourcesDirectoryPath: string): IFuture<void>;
7473
isPlatformPrepared(projectRoot: string): IFuture<boolean>;

lib/providers/livesync-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class LiveSyncProvider implements ILiveSyncProvider {
5757

5858
public buildForDevice(device: Mobile.IDevice): IFuture<string> {
5959
return (() => {
60-
this.$platformService.buildForDeploy(device.deviceInfo.platform, {buildForDevice: !device.isEmulator}).wait();
60+
this.$platformService.buildPlatform(device.deviceInfo.platform, {buildForDevice: !device.isEmulator}).wait();
6161
let platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform);
6262
if (device.isEmulator) {
6363
return this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait().packageName;

lib/services/android-debug-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AndroidDebugService implements IDebugService {
4242

4343
private debugOnEmulator(): IFuture<void> {
4444
return (() => {
45-
this.$platformService.deployOnEmulator(this.platform).wait();
45+
this.$platformService.deployPlatform(this.platform).wait();
4646
// Assure we've detected the emulator as device
4747
// For example in case deployOnEmulator had stated new emulator instance
4848
// we need some time to detect it. Let's force detection.
@@ -111,7 +111,7 @@ class AndroidDebugService implements IDebugService {
111111
let cachedDeviceOption = this.$options.forDevice;
112112
this.$options.forDevice = true;
113113
if (this.$options.rebuild) {
114-
this.$platformService.prepareAndBuild(this.platform).wait();
114+
this.$platformService.buildPlatform(this.platform).wait();
115115
}
116116
this.$options.forDevice = !!cachedDeviceOption;
117117

0 commit comments

Comments
 (0)