Skip to content

Commit 00b80f7

Browse files
Fix several issues in @next version (#2591)
* Fix adding of invalid platform When user tries to add invalid platform, CLI should prints user-friendly message. Instead it fails that cannot read `getPlatformData` of `undefined`. The reason is a change in platforms-data `getPlatformsData` method. Fix it to return undefined when there's no platform specific data. This way the code will detect the invalid platform and will fail with user-friendly message. * Fix specifiying --sdk on platform add During adding of Android platform, users can specify targetSdk via `--sdk` command line option. This has been broken in previous commit. As our services should not rely on `$options`, sdk must be passed as parameter whenever it could be used. It turns out some common methods (addPlatform, preparePlatform) rely on platform specific data - sdk, provision, etc. In order to handle this without adding new arguments, introudce IPlatformSpecificData interface and use it in al methods where we have to pass some of the platform specific data required for preparing of the project. * Pass android specific options for emulate command In case you want to use `tns emulate android --release`, several android specific options should be passed and used by the service. Even when they are passed on the command line, we did not pass them to the service. Pass required options, so the release build will be successfully signed. * Fix livesync watch operations LiveSync provider that detects how to process the files, needs the projectData. However we had not passed it and the code fails. Pass the data wherever its needed. This fixes livesync operations.
1 parent 8f9c273 commit 00b80f7

28 files changed

+127
-105
lines changed

lib/commands/add-platform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class AddPlatformCommand implements ICommand {
99
}
1010

1111
public async execute(args: string[]): Promise<void> {
12-
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData);
12+
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
1313
}
1414

1515
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/appstore-upload.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ export class PublishIOS implements ICommand {
7171
};
7272
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
7373
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
74-
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
74+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
7575
await this.$platformService.buildPlatform(platform, iOSBuildConfig, this.$projectData);
7676
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice }, this.$projectData);
7777
} else {
7878
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.");
79-
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
79+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
8080

8181
let platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
8282
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;

lib/commands/build.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ export class BuildCommandBase {
33
protected $projectData: IProjectData,
44
protected $platformsData: IPlatformsData,
55
protected $platformService: IPlatformService) {
6-
this.$projectData.initializeProjectData();
7-
}
6+
this.$projectData.initializeProjectData();
7+
}
88

99
public async executeCore(args: string[]): Promise<void> {
1010
let platform = args[0].toLowerCase();
1111
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
12-
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
12+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
1313
this.$options.clean = true;
1414
const buildConfig: IiOSBuildConfig = {
1515
buildForDevice: this.$options.forDevice,

lib/commands/clean-app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class CleanAppCommandBase {
88
public async execute(args: string[]): Promise<void> {
99
let platform = args[0].toLowerCase();
1010
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
11-
return this.$platformService.cleanDestinationApp(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData);
11+
return this.$platformService.cleanDestinationApp(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
1212
}
1313
}
1414

lib/commands/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
provision: this.$options.provision,
3232
teamId: this.$options.teamId
3333
};
34-
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
34+
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
3535
this.$config.debugLivesync = true;
3636
let applicationReloadAction = async (deviceAppData: Mobile.IDeviceAppData): Promise<void> => {
3737
let projectData: IProjectData = this.$injector.resolve("projectData");

lib/commands/deploy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export class DeployOnDeviceCommand implements ICommand {
77
private $projectData: IProjectData,
88
private $errors: IErrors,
99
private $mobileHelper: Mobile.IMobileHelper) {
10-
this.$projectData.initializeProjectData();
11-
}
10+
this.$projectData.initializeProjectData();
11+
}
1212

1313
public async execute(args: string[]): Promise<void> {
1414
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
@@ -27,7 +27,7 @@ export class DeployOnDeviceCommand implements ICommand {
2727
keyStorePassword: this.$options.keyStorePassword,
2828
keyStorePath: this.$options.keyStorePath
2929
};
30-
return this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
30+
return this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
3131
}
3232

3333
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/emulate.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ export class EmulateCommandBase {
1919
availableDevices: this.$options.availableDevices,
2020
platformTemplate: this.$options.platformTemplate,
2121
provision: this.$options.provision,
22-
teamId: this.$options.teamId
22+
teamId: this.$options.teamId,
23+
keyStoreAlias: this.$options.keyStoreAlias,
24+
keyStoreAliasPassword: this.$options.keyStoreAliasPassword,
25+
keyStorePassword: this.$options.keyStorePassword,
26+
keyStorePath: this.$options.keyStorePath
2327
};
24-
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, this.$options.provision);
28+
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
2529
}
2630
}
2731

lib/commands/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class InstallCommand implements ICommand {
3131
const frameworkPackageData = this.$projectDataService.getNSValue(this.$projectData.projectDir, platformData.frameworkPackageName);
3232
if (frameworkPackageData && frameworkPackageData.version) {
3333
try {
34-
await this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`], this.$options.platformTemplate, this.$projectData);
34+
await this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`], this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
3535
} catch (err) {
3636
error = `${error}${EOL}${err}`;
3737
}

lib/commands/livesync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class LivesyncCommand implements ICommand {
2828
teamId: this.$options.teamId
2929
};
3030

31-
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
31+
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
3232
return this.$usbLiveSyncService.liveSync(args[0], this.$projectData);
3333
}
3434

lib/commands/platform-clean.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class CleanCommand implements ICommand {
1010

1111
public async execute(args: string[]): Promise<void> {
1212
await this.$platformService.removePlatforms(args, this.$projectData);
13-
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData);
13+
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
1414
}
1515

1616
public async canExecute(args: string[]): Promise<boolean> {

0 commit comments

Comments
 (0)