Skip to content

Fix several issues in @next version #2591

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 4 commits into from
Mar 8, 2017
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/commands/add-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class AddPlatformCommand implements ICommand {
}

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

public async canExecute(args: string[]): Promise<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/appstore-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export class PublishIOS implements ICommand {
};
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
await this.$platformService.buildPlatform(platform, iOSBuildConfig, this.$projectData);
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice }, this.$projectData);
} else {
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.");
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });

let platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ export class BuildCommandBase {
protected $projectData: IProjectData,
protected $platformsData: IPlatformsData,
protected $platformService: IPlatformService) {
this.$projectData.initializeProjectData();
}
this.$projectData.initializeProjectData();
}

public async executeCore(args: string[]): Promise<void> {
let platform = args[0].toLowerCase();
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
this.$options.clean = true;
const buildConfig: IiOSBuildConfig = {
buildForDevice: this.$options.forDevice,
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/clean-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class CleanAppCommandBase {
public async execute(args: string[]): Promise<void> {
let platform = args[0].toLowerCase();
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
return this.$platformService.cleanDestinationApp(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData);
return this.$platformService.cleanDestinationApp(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
provision: this.$options.provision,
teamId: this.$options.teamId
};
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
this.$config.debugLivesync = true;
let applicationReloadAction = async (deviceAppData: Mobile.IDeviceAppData): Promise<void> => {
let projectData: IProjectData = this.$injector.resolve("projectData");
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export class DeployOnDeviceCommand implements ICommand {
private $projectData: IProjectData,
private $errors: IErrors,
private $mobileHelper: Mobile.IMobileHelper) {
this.$projectData.initializeProjectData();
}
this.$projectData.initializeProjectData();
}

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

public async canExecute(args: string[]): Promise<boolean> {
Expand Down
8 changes: 6 additions & 2 deletions lib/commands/emulate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ export class EmulateCommandBase {
availableDevices: this.$options.availableDevices,
platformTemplate: this.$options.platformTemplate,
provision: this.$options.provision,
teamId: this.$options.teamId
teamId: this.$options.teamId,
keyStoreAlias: this.$options.keyStoreAlias,
keyStoreAliasPassword: this.$options.keyStoreAliasPassword,
keyStorePassword: this.$options.keyStorePassword,
keyStorePath: this.$options.keyStorePath
};
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, this.$options.provision);
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class InstallCommand implements ICommand {
const frameworkPackageData = this.$projectDataService.getNSValue(this.$projectData.projectDir, platformData.frameworkPackageName);
if (frameworkPackageData && frameworkPackageData.version) {
try {
await this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`], this.$options.platformTemplate, this.$projectData);
await this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`], this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
} catch (err) {
error = `${error}${EOL}${err}`;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/livesync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class LivesyncCommand implements ICommand {
teamId: this.$options.teamId
};

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

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/platform-clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class CleanCommand implements ICommand {

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

public async canExecute(args: string[]): Promise<boolean> {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class PrepareCommand implements ICommand {

public async execute(args: string[]): Promise<void> {
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
await this.$platformService.preparePlatform(args[0], appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
await this.$platformService.preparePlatform(args[0], appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
}

public async canExecute(args: string[]): Promise<boolean> {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class RunCommandBase {
keyStorePassword: this.$options.keyStorePassword,
keyStorePath: this.$options.keyStorePath
};
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });

if (this.$options.bundle) {
this.$options.watch = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/update-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class UpdatePlatformCommand implements ICommand {
}

public async execute(args: string[]): Promise<void> {
await this.$platformService.updatePlatforms(args, this.$options.platformTemplate, this.$projectData);
await this.$platformService.updatePlatforms(args, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
}

public async canExecute(args: string[]): Promise<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ export class UpdateCommand implements ICommand {
platforms = platforms.concat(packagePlatforms);
if (args.length === 1) {
for (let platform of platforms) {
await this.$platformService.addPlatforms([platform + "@" + args[0]], this.$options.platformTemplate, this.$projectData);
await this.$platformService.addPlatforms([platform + "@" + args[0]], this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
}

await this.$pluginsService.add("tns-core-modules@" + args[0], this.$projectData);
} else {
await this.$platformService.addPlatforms(platforms, this.$options.platformTemplate, this.$projectData);
await this.$platformService.addPlatforms(platforms, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
await this.$pluginsService.add("tns-core-modules", this.$projectData);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ interface INativeScriptDeviceLiveSyncService extends IDeviceLiveSyncServiceBase
* @param {Mobile.IDeviceAppData} deviceAppData Information about the application and the device.
* @param {Mobile.ILocalToDevicePathData[]} localToDevicePaths Object containing a mapping of file paths from the system to the device.
* @param {boolean} forceExecuteFullSync If this is passed a full LiveSync is performed instead of an incremental one.
* @param {string} projectId Project identifier - for example org.nativescript.livesync.
* @param {IProjectData} projectData Project data.
* @return {Promise<void>}
*/
refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectId: string): Promise<void>;
refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectData: IProjectData): Promise<void>;
/**
* Removes specified files from a connected device
* @param {string} appIdentifier Application identifier.
Expand All @@ -78,7 +78,7 @@ interface INativeScriptDeviceLiveSyncService extends IDeviceLiveSyncServiceBase
interface IPlatformLiveSyncService {
fullSync(projectData: IProjectData, postAction?: (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => Promise<void>): Promise<void>;
partialSync(event: string, filePath: string, dispatcher: IFutureDispatcher, afterFileSyncAction: (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => Promise<void>, projectData: IProjectData): Promise<void>;
refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], isFullSync: boolean, projectId: string): Promise<void>;
refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], isFullSync: boolean, projectData: IProjectData): Promise<void>;
}

interface IBundle {
Expand Down
33 changes: 24 additions & 9 deletions lib/definitions/platform.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
interface IPlatformService extends NodeJS.EventEmitter {
addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData): Promise<void>;
addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, frameworkPath?: string): Promise<void>;

/**
* Gets list of all installed platforms (the ones for which <project dir>/platforms/<platform> exists).
Expand Down Expand Up @@ -30,7 +30,7 @@ interface IPlatformService extends NodeJS.EventEmitter {
*/
removePlatforms(platforms: string[], projectData: IProjectData): Promise<void>;

updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData): Promise<void>;
updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;

/**
* Ensures that the specified platform and its dependencies are installed.
Expand All @@ -41,10 +41,10 @@ interface IPlatformService extends NodeJS.EventEmitter {
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
* @param {string} platformTemplate The name of the platform template.
* @param {IProjectData} projectData DTO with information about the project.
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
* @param {IPlatformSpecificData} platformSpecificData Platform specific data required for project preparation.
* @returns {boolean} true indicates that the platform was prepared.
*/
preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, provision: any): Promise<boolean>;
preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<boolean>;

/**
* Determines whether a build is necessary. A build is necessary when one of the following is true:
Expand Down Expand Up @@ -103,10 +103,10 @@ interface IPlatformService extends NodeJS.EventEmitter {
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
* @param {IDeployPlatformOptions} deployOptions Various options that can manage the deploy operation.
* @param {IProjectData} projectData DTO with information about the project.
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
* @param {any} platformSpecificData Platform specific data required for project preparation.
* @returns {void}
*/
deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, provision: any): Promise<void>;
deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;

/**
* Runs the application on specified platform. Assumes that the application is already build and installed. Fails if this is not true.
Expand All @@ -123,12 +123,12 @@ interface IPlatformService extends NodeJS.EventEmitter {
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
* @param {IEmulatePlatformOptions} emulateOptions Various options that can manage the emulate operation.
* @param {IProjectData} projectData DTO with information about the project.
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
* @param {any} platformSpecificData Platform specific data required for project preparation.
* @returns {void}
*/
emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, provision: any): Promise<void>;
emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;

cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData): Promise<void>;
cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
validatePlatformInstalled(platform: string, projectData: IProjectData): void;
validatePlatform(platform: string, projectData: IProjectData): void;

Expand Down Expand Up @@ -177,6 +177,21 @@ interface IPlatformService extends NodeJS.EventEmitter {
trackProjectType(projectData: IProjectData): Promise<void>;
}

/**
* Platform specific data required for project preparation.
*/
interface IPlatformSpecificData {
/**
* UUID of the provisioning profile used in iOS project preparation.
*/
provision: any;

/**
* Target SDK for Android.s
*/
sdk: string;
}

interface IPlatformData {
frameworkPackageName: string;
platformProjectService: IPlatformProjectService;
Expand Down
8 changes: 4 additions & 4 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ interface IPlatformProjectService extends NodeJS.EventEmitter {
getPlatformData(projectData: IProjectData): IPlatformData;
validate(projectData: IProjectData): Promise<void>;
createProject(frameworkDir: string, frameworkVersion: string, projectData: IProjectData, pathToTemplate?: string): Promise<void>;
interpolateData(projectData: IProjectData): Promise<void>;
interpolateConfigurationFile(projectData: IProjectData, sdk?: string): Promise<void>;
interpolateData(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
interpolateConfigurationFile(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;

/**
* Executes additional actions after native project is created.
Expand All @@ -176,10 +176,10 @@ interface IPlatformProjectService extends NodeJS.EventEmitter {
/**
* Prepares images in Native project (for iOS).
* @param {IProjectData} projectData DTO with information about the project.
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
* @param {any} platformSpecificData Platform specific data required for project preparation.
* @returns {void}
*/
prepareProject(projectData: IProjectData, provision: any): Promise<void>;
prepareProject(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;

/**
* Prepares App_Resources in the native project by clearing data from other platform and applying platform specific rules.
Expand Down
2 changes: 1 addition & 1 deletion lib/platforms-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class PlatformsData implements IPlatformsData {
}

public getPlatformData(platform: string, projectData: IProjectData): IPlatformData {
return this.platformsData[platform.toLowerCase()].getPlatformData(projectData);
return this.platformsData[platform.toLowerCase()] && this.platformsData[platform.toLowerCase()].getPlatformData(projectData);
}

public get availablePlatforms(): any {
Expand Down
Loading