diff --git a/lib/commands/add-platform.ts b/lib/commands/add-platform.ts index 5c15b254c5..b41fccf62c 100644 --- a/lib/commands/add-platform.ts +++ b/lib/commands/add-platform.ts @@ -9,7 +9,7 @@ export class AddPlatformCommand implements ICommand { } public async execute(args: string[]): Promise { - 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 { diff --git a/lib/commands/appstore-upload.ts b/lib/commands/appstore-upload.ts index 1022d2a045..56a3d41ba5 100644 --- a/lib/commands/appstore-upload.ts +++ b/lib/commands/appstore-upload.ts @@ -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 = platformData.platformProjectService; diff --git a/lib/commands/build.ts b/lib/commands/build.ts index db6361d0c6..b6a36d5288 100644 --- a/lib/commands/build.ts +++ b/lib/commands/build.ts @@ -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 { 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, diff --git a/lib/commands/clean-app.ts b/lib/commands/clean-app.ts index d11678ff3d..699846b120 100644 --- a/lib/commands/clean-app.ts +++ b/lib/commands/clean-app.ts @@ -8,7 +8,7 @@ export class CleanAppCommandBase { public async execute(args: string[]): Promise { 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 }); } } diff --git a/lib/commands/debug.ts b/lib/commands/debug.ts index 0e2e5359f5..d9388f8b77 100644 --- a/lib/commands/debug.ts +++ b/lib/commands/debug.ts @@ -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 => { let projectData: IProjectData = this.$injector.resolve("projectData"); diff --git a/lib/commands/deploy.ts b/lib/commands/deploy.ts index 18e6352391..66bb49355a 100644 --- a/lib/commands/deploy.ts +++ b/lib/commands/deploy.ts @@ -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 { const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release }; @@ -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 { diff --git a/lib/commands/emulate.ts b/lib/commands/emulate.ts index df7a04bb90..368bacc9f7 100644 --- a/lib/commands/emulate.ts +++ b/lib/commands/emulate.ts @@ -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 }); } } diff --git a/lib/commands/install.ts b/lib/commands/install.ts index 6dde3308ff..a39423ec9c 100644 --- a/lib/commands/install.ts +++ b/lib/commands/install.ts @@ -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}`; } diff --git a/lib/commands/livesync.ts b/lib/commands/livesync.ts index 4ac66d0176..81f9821fd8 100644 --- a/lib/commands/livesync.ts +++ b/lib/commands/livesync.ts @@ -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); } diff --git a/lib/commands/platform-clean.ts b/lib/commands/platform-clean.ts index 939ec4a9aa..d2ff1106dc 100644 --- a/lib/commands/platform-clean.ts +++ b/lib/commands/platform-clean.ts @@ -10,7 +10,7 @@ export class CleanCommand implements ICommand { public async execute(args: string[]): Promise { 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 { diff --git a/lib/commands/prepare.ts b/lib/commands/prepare.ts index 14dba0bb42..648771aba3 100644 --- a/lib/commands/prepare.ts +++ b/lib/commands/prepare.ts @@ -10,7 +10,7 @@ export class PrepareCommand implements ICommand { public async execute(args: string[]): Promise { 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 { diff --git a/lib/commands/run.ts b/lib/commands/run.ts index d35f09a950..ff8016ae8f 100644 --- a/lib/commands/run.ts +++ b/lib/commands/run.ts @@ -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; diff --git a/lib/commands/update-platform.ts b/lib/commands/update-platform.ts index 5ca21e3a14..5ff02b6509 100644 --- a/lib/commands/update-platform.ts +++ b/lib/commands/update-platform.ts @@ -9,7 +9,7 @@ export class UpdatePlatformCommand implements ICommand { } public async execute(args: string[]): Promise { - 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 { diff --git a/lib/commands/update.ts b/lib/commands/update.ts index 7514ebd778..49c3eee4ea 100644 --- a/lib/commands/update.ts +++ b/lib/commands/update.ts @@ -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); } diff --git a/lib/declarations.ts b/lib/declarations.ts index 0b39dad18d..31470d5697 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -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} */ - refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectId: string): Promise; + refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectData: IProjectData): Promise; /** * Removes specified files from a connected device * @param {string} appIdentifier Application identifier. @@ -78,7 +78,7 @@ interface INativeScriptDeviceLiveSyncService extends IDeviceLiveSyncServiceBase interface IPlatformLiveSyncService { fullSync(projectData: IProjectData, postAction?: (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => Promise): Promise; partialSync(event: string, filePath: string, dispatcher: IFutureDispatcher, afterFileSyncAction: (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => Promise, projectData: IProjectData): Promise; - refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], isFullSync: boolean, projectId: string): Promise; + refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], isFullSync: boolean, projectData: IProjectData): Promise; } interface IBundle { diff --git a/lib/definitions/platform.d.ts b/lib/definitions/platform.d.ts index ccab0182a6..974d2e7067 100644 --- a/lib/definitions/platform.d.ts +++ b/lib/definitions/platform.d.ts @@ -1,5 +1,5 @@ interface IPlatformService extends NodeJS.EventEmitter { - addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData): Promise; + addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, frameworkPath?: string): Promise; /** * Gets list of all installed platforms (the ones for which /platforms/ exists). @@ -30,7 +30,7 @@ interface IPlatformService extends NodeJS.EventEmitter { */ removePlatforms(platforms: string[], projectData: IProjectData): Promise; - updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData): Promise; + updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; /** * Ensures that the specified platform and its dependencies are installed. @@ -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; + preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; /** * Determines whether a build is necessary. A build is necessary when one of the following is true: @@ -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; + deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; /** * Runs the application on specified platform. Assumes that the application is already build and installed. Fails if this is not true. @@ -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; + emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; - cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData): Promise; + cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; validatePlatformInstalled(platform: string, projectData: IProjectData): void; validatePlatform(platform: string, projectData: IProjectData): void; @@ -177,6 +177,21 @@ interface IPlatformService extends NodeJS.EventEmitter { trackProjectType(projectData: IProjectData): Promise; } +/** + * 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; diff --git a/lib/definitions/project.d.ts b/lib/definitions/project.d.ts index 902834edcf..c29c5a7318 100644 --- a/lib/definitions/project.d.ts +++ b/lib/definitions/project.d.ts @@ -152,8 +152,8 @@ interface IPlatformProjectService extends NodeJS.EventEmitter { getPlatformData(projectData: IProjectData): IPlatformData; validate(projectData: IProjectData): Promise; createProject(frameworkDir: string, frameworkVersion: string, projectData: IProjectData, pathToTemplate?: string): Promise; - interpolateData(projectData: IProjectData): Promise; - interpolateConfigurationFile(projectData: IProjectData, sdk?: string): Promise; + interpolateData(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; + interpolateConfigurationFile(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; /** * Executes additional actions after native project is created. @@ -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; + prepareProject(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise; /** * Prepares App_Resources in the native project by clearing data from other platform and applying platform specific rules. diff --git a/lib/platforms-data.ts b/lib/platforms-data.ts index bd82fa49ae..2e12d32eec 100644 --- a/lib/platforms-data.ts +++ b/lib/platforms-data.ts @@ -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 { diff --git a/lib/providers/livesync-provider.ts b/lib/providers/livesync-provider.ts index ede556a0b6..08bb432702 100644 --- a/lib/providers/livesync-provider.ts +++ b/lib/providers/livesync-provider.ts @@ -53,7 +53,7 @@ export class LiveSyncProvider implements ILiveSyncProvider { public async preparePlatformForSync(platform: string, provision: any, projectData: IProjectData): Promise { const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release }; - await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, provision); + await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, { provision: provision, sdk: this.$options.sdk }); } public canExecuteFastSync(filePath: string, projectData: IProjectData, platform: string): boolean { diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 3095265267..1888dd3c53 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -183,9 +183,9 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject _.map(directoriesToClean, dir => this.$fs.deleteDirectory(dir)); } - public async interpolateData(projectData: IProjectData): Promise { + public async interpolateData(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { // Interpolate the apilevel and package - await this.interpolateConfigurationFile(projectData); + await this.interpolateConfigurationFile(projectData, platformSpecificData); let stringsFilePath = path.join(this.getAppResourcesDestinationDirectoryPath(projectData), 'values', 'strings.xml'); shell.sed('-i', /__NAME__/, projectData.projectName, stringsFilePath); @@ -204,10 +204,11 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject } } - public async interpolateConfigurationFile(projectData: IProjectData, sdk?: string): Promise { + public async interpolateConfigurationFile(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { let manifestPath = this.getPlatformData(projectData).configurationFilePath; shell.sed('-i', /__PACKAGE__/, projectData.projectId, manifestPath); - shell.sed('-i', /__APILEVEL__/, sdk || (await this.$androidToolsInfo.getToolsInfo()).compileSdkVersion.toString(), manifestPath); + const sdk = (platformSpecificData && platformSpecificData.sdk) || (await this.$androidToolsInfo.getToolsInfo()).compileSdkVersion.toString(); + shell.sed('-i', /__APILEVEL__/, sdk, manifestPath); } private getProjectNameFromId(projectData: IProjectData): string { diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 7c6359aa68..67f5953bf2 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -132,7 +132,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ } //TODO: plamen5kov: revisit this method, might have unnecessary/obsolete logic - public async interpolateData(projectData: IProjectData): Promise { + public async interpolateData(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { let projectRootFilePath = path.join(this.getPlatformData(projectData).projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER); // Starting with NativeScript for iOS 1.6.0, the project Info.plist file resides not in the platform project, // but in the hello-world app template as a platform specific resource. @@ -161,7 +161,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ this.replaceFileContent(pbxprojFilePath, projectData); } - public interpolateConfigurationFile(projectData: IProjectData, configurationFilePath?: string): Promise { + public interpolateConfigurationFile(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { return Promise.resolve(); } @@ -578,7 +578,9 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f } } - public async prepareProject(projectData: IProjectData, provision?: any): Promise { + public async prepareProject(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { + let provision = platformSpecificData && platformSpecificData.provision; + if (provision) { let projectRoot = path.join(projectData.platformsDir, "ios"); await this.setupSigningFromProvision(projectRoot, provision); diff --git a/lib/services/livesync/android-device-livesync-service.ts b/lib/services/livesync/android-device-livesync-service.ts index 238fbf7945..d5f7da18ee 100644 --- a/lib/services/livesync/android-device-livesync-service.ts +++ b/lib/services/livesync/android-device-livesync-service.ts @@ -20,8 +20,8 @@ class AndroidLiveSyncService implements INativeScriptDeviceLiveSyncService { return this.$androidDebugService; } - public async refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean): Promise { - let canExecuteFastSync = !forceExecuteFullSync && !_.some(localToDevicePaths, (localToDevicePath: any) => !this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), deviceAppData.platform)); + public async refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectData: IProjectData): Promise { + let canExecuteFastSync = !forceExecuteFullSync && !_.some(localToDevicePaths, (localToDevicePath: any) => !this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), projectData, deviceAppData.platform)); if (canExecuteFastSync) { return this.reloadPage(deviceAppData, localToDevicePaths); diff --git a/lib/services/livesync/ios-device-livesync-service.ts b/lib/services/livesync/ios-device-livesync-service.ts index 1ba5c6ae7a..5dd2652e92 100644 --- a/lib/services/livesync/ios-device-livesync-service.ts +++ b/lib/services/livesync/ios-device-livesync-service.ts @@ -61,7 +61,7 @@ class IOSLiveSyncService implements INativeScriptDeviceLiveSyncService { await Promise.all(_.map(localToDevicePaths, localToDevicePathData => this.device.fileSystem.deleteFile(localToDevicePathData.getDevicePath(), appIdentifier))); } - public async refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectId: string): Promise { + public async refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectData: IProjectData): Promise { if (forceExecuteFullSync) { await this.restartApplication(deviceAppData); return; @@ -72,14 +72,14 @@ class IOSLiveSyncService implements INativeScriptDeviceLiveSyncService { constants.LIVESYNC_EXCLUDED_FILE_PATTERNS.forEach(pattern => scriptRelatedFiles = _.concat(scriptRelatedFiles, localToDevicePaths.filter(file => minimatch(file.getDevicePath(), pattern, { nocase: true })))); let otherFiles = _.difference(localToDevicePaths, _.concat(scriptFiles, scriptRelatedFiles)); - let shouldRestart = _.some(otherFiles, (localToDevicePath: Mobile.ILocalToDevicePathData) => !this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), deviceAppData.platform)); + let shouldRestart = _.some(otherFiles, (localToDevicePath: Mobile.ILocalToDevicePathData) => !this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), projectData, deviceAppData.platform)); if (shouldRestart || (!this.$options.liveEdit && scriptFiles.length)) { await this.restartApplication(deviceAppData); return; } - if (await this.setupSocketIfNeeded(projectId)) { + if (await this.setupSocketIfNeeded(projectData.projectId)) { this.liveEdit(scriptFiles); await this.reloadPage(deviceAppData, otherFiles); } else { diff --git a/lib/services/livesync/livesync-service.ts b/lib/services/livesync/livesync-service.ts index 17480a4d6f..acddceefd6 100644 --- a/lib/services/livesync/livesync-service.ts +++ b/lib/services/livesync/livesync-service.ts @@ -31,7 +31,7 @@ class LiveSyncService implements ILiveSyncService { if (semver.lt(frameworkVersion, "1.2.1")) { let shouldUpdate = await this.$prompter.confirm("You need Android Runtime 1.2.1 or later for LiveSync to work properly. Do you want to update your runtime now?"); if (shouldUpdate) { - await this.$platformService.updatePlatforms([this.$devicePlatformsConstants.Android.toLowerCase()], this.$options.platformTemplate, projectData); + await this.$platformService.updatePlatforms([this.$devicePlatformsConstants.Android.toLowerCase()], this.$options.platformTemplate, projectData, null); } else { return; } diff --git a/lib/services/livesync/platform-livesync-service.ts b/lib/services/livesync/platform-livesync-service.ts index 92fa192a2f..1837a89685 100644 --- a/lib/services/livesync/platform-livesync-service.ts +++ b/lib/services/livesync/platform-livesync-service.ts @@ -48,7 +48,7 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe return; } - await this.refreshApplication(deviceAppData, localToDevicePaths, true, projectData.projectId); + await this.refreshApplication(deviceAppData, localToDevicePaths, true, projectData); await this.finishLivesync(deviceAppData); }; await this.$devicesService.execute(action, canExecute); @@ -75,10 +75,10 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe return isTheSamePlatformAction; } - public async refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], isFullSync: boolean, projectId: string): Promise { + public async refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], isFullSync: boolean, projectData: IProjectData): Promise { let deviceLiveSyncService = this.resolveDeviceSpecificLiveSyncService(deviceAppData.device.deviceInfo.platform, deviceAppData.device); this.$logger.info("Refreshing application..."); - await deviceLiveSyncService.refreshApplication(deviceAppData, localToDevicePaths, isFullSync, projectId); + await deviceLiveSyncService.refreshApplication(deviceAppData, localToDevicePaths, isFullSync, projectData); } protected async finishLivesync(deviceAppData: Mobile.IDeviceAppData): Promise { @@ -123,7 +123,7 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe let batch = this.batch[platform]; await batch.syncFiles(async (filesToSync: string[]) => { const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release }; - await this.$platformService.preparePlatform(this.liveSyncData.platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, this.$options.provision); + await this.$platformService.preparePlatform(this.liveSyncData.platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, { provision: this.$options.provision, sdk: this.$options.sdk }); let canExecute = this.getCanExecuteAction(this.liveSyncData.platform, this.liveSyncData.appIdentifier); let deviceFileAction = (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => this.transferFiles(deviceAppData, localToDevicePaths, this.liveSyncData.projectFilesPath, !filePath); let action = this.getSyncAction(filesToSync, deviceFileAction, afterFileSyncAction, projectData); @@ -183,7 +183,7 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe isFullSync = true; } else { deviceAppData = this.$deviceAppDataFactory.create(this.liveSyncData.appIdentifier, this.$mobileHelper.normalizePlatformName(this.liveSyncData.platform), device); - const mappedFiles = filesToSync.map((file: string) => this.$projectFilesProvider.mapFilePath(file, device.deviceInfo.platform)); + const mappedFiles = filesToSync.map((file: string) => this.$projectFilesProvider.mapFilePath(file, device.deviceInfo.platform, projectData)); // Some plugins modify platforms dir on afterPrepare (check nativescript-dev-sass) - we want to sync only existing file. const existingFiles = mappedFiles.filter(m => this.$fs.exists(m)); @@ -202,7 +202,7 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe } if (!afterFileSyncAction) { - await this.refreshApplication(deviceAppData, localToDevicePaths, isFullSync, projectData.projectId); + await this.refreshApplication(deviceAppData, localToDevicePaths, isFullSync, projectData); } await device.fileSystem.putFile(this.$projectChangesService.getPrepareInfoFilePath(device.deviceInfo.platform, projectData), await this.getLiveSyncInfoFilePath(deviceAppData), this.liveSyncData.appIdentifier); diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 28014d9104..8b807f1c15 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -44,16 +44,16 @@ export class PlatformService extends EventEmitter implements IPlatformService { super(); } - public async addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData): Promise { + public async addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, frameworkPath?: string): Promise { let platformsDir = projectData.platformsDir; this.$fs.ensureDirectoryExists(platformsDir); for (let platform of platforms) { - await this.addPlatform(platform.toLowerCase(), platformTemplate, projectData); + await this.addPlatform(platform.toLowerCase(), platformTemplate, projectData, platformSpecificData, frameworkPath); } } - private async addPlatform(platformParam: string, platformTemplate: string, projectData: IProjectData, frameworkPath?: string): Promise { + private async addPlatform(platformParam: string, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, frameworkPath?: string): Promise { let data = platformParam.split("@"), platform = data[0].toLowerCase(), version = data[1]; @@ -99,7 +99,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { let frameworkDir = path.join(downloadedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME); frameworkDir = path.resolve(frameworkDir); - let coreModuleName = await this.addPlatformCore(platformData, frameworkDir, platformTemplate, projectData); + let coreModuleName = await this.addPlatformCore(platformData, frameworkDir, platformTemplate, projectData, platformSpecificData); await this.$npm.uninstall(coreModuleName, { save: true }, projectData.projectDir); } catch (err) { this.$fs.deleteDirectory(platformPath); @@ -112,7 +112,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } - private async addPlatformCore(platformData: IPlatformData, frameworkDir: string, platformTemplate: string, projectData: IProjectData): Promise { + private async addPlatformCore(platformData: IPlatformData, frameworkDir: string, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { let coreModuleData = this.$fs.readJson(path.join(frameworkDir, "../", "package.json")); let installedVersion = coreModuleData.version; let coreModuleName = coreModuleData.name; @@ -121,7 +121,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { let pathToTemplate = customTemplateOptions && customTemplateOptions.pathToTemplate; await platformData.platformProjectService.createProject(path.resolve(frameworkDir), installedVersion, projectData, pathToTemplate); platformData.platformProjectService.ensureConfigurationFileInAppResources(projectData); - await platformData.platformProjectService.interpolateData(projectData); + await platformData.platformProjectService.interpolateData(projectData, platformSpecificData); platformData.platformProjectService.afterCreateProject(platformData.projectRoot, projectData); let frameworkPackageNameData: any = { version: installedVersion }; @@ -186,7 +186,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { return _.filter(this.$platformsData.platformsNames, p => { return this.isPlatformPrepared(p, projectData); }); } - public async preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, provision: any): Promise { + public async preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { this.validatePlatform(platform, projectData); await this.trackProjectType(projectData); @@ -209,7 +209,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } } - await this.ensurePlatformInstalled(platform, platformTemplate, projectData); + await this.ensurePlatformInstalled(platform, platformTemplate, projectData, platformSpecificData); let changesInfo = this.$projectChangesService.checkForChanges(platform, projectData); this.$logger.trace("Changes info in prepare platform:", changesInfo); @@ -225,7 +225,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } } - await this.preparePlatformCore(platform, appFilesUpdaterOptions, projectData, provision); + await this.preparePlatformCore(platform, appFilesUpdaterOptions, projectData, platformSpecificData); this.$projectChangesService.savePrepareInfo(platform, projectData); } else { this.$logger.out("Skipping prepare."); @@ -253,7 +253,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } @helpers.hook('prepare') - private async preparePlatformCore(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, projectData: IProjectData, provision: any, changesInfo?: IProjectChangesInfo): Promise { + private async preparePlatformCore(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, changesInfo?: IProjectChangesInfo): Promise { this.$logger.out("Preparing project..."); let platformData = this.$platformsData.getPlatformData(platform, projectData); @@ -263,7 +263,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } if (!changesInfo || changesInfo.appResourcesChanged) { this.copyAppResources(platform, projectData); - await platformData.platformProjectService.prepareProject(projectData, provision); + await platformData.platformProjectService.prepareProject(projectData, platformSpecificData); } if (!changesInfo || changesInfo.modulesChanged) { await this.copyTnsModules(platform, projectData); @@ -281,7 +281,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { await platformData.platformProjectService.processConfigurationFilesFromAppResources(appFilesUpdaterOptions.release, projectData); } - await platformData.platformProjectService.interpolateConfigurationFile(projectData); + await platformData.platformProjectService.interpolateConfigurationFile(projectData, platformSpecificData); this.$logger.out("Project successfully prepared (" + platform + ")"); } @@ -426,8 +426,8 @@ export class PlatformService extends EventEmitter implements IPlatformService { this.$logger.out(`Successfully installed on device with identifier '${device.deviceInfo.identifier}'.`); } - public async deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, provision: any): Promise { - await this.preparePlatform(platform, appFilesUpdaterOptions, deployOptions.platformTemplate, projectData, provision); + public async deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { + await this.preparePlatform(platform, appFilesUpdaterOptions, deployOptions.platformTemplate, projectData, platformSpecificData); this.$logger.out("Searching for devices..."); await this.$devicesService.initialize({ platform: platform, deviceId: deployOptions.device }); let action = async (device: Mobile.IDevice): Promise => { @@ -474,7 +474,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { await this.$devicesService.execute(action, this.getCanExecuteAction(platform, runOptions)); } - public async emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, provision: any): Promise { + public async emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { if (emulateOptions.avd) { this.$logger.warn(`Option --avd is no longer supported. Please use --device instead!`); return Promise.resolve(); @@ -505,7 +505,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } } - await this.deployPlatform(platform, appFilesUpdaterOptions, emulateOptions, projectData, provision); + await this.deployPlatform(platform, appFilesUpdaterOptions, emulateOptions, projectData, platformSpecificData); return this.runPlatform(platform, emulateOptions, projectData); } @@ -547,8 +547,8 @@ export class PlatformService extends EventEmitter implements IPlatformService { return null; } - public async cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData): Promise { - await this.ensurePlatformInstalled(platform, platformTemplate, projectData); + public async cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { + await this.ensurePlatformInstalled(platform, platformTemplate, projectData, platformSpecificData); const appSourceDirectoryPath = path.join(projectData.projectDir, constants.APP_FOLDER_NAME); let platformData = this.$platformsData.getPlatformData(platform, projectData); @@ -603,16 +603,16 @@ export class PlatformService extends EventEmitter implements IPlatformService { } } - public async updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData): Promise { + public async updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { for (let platformParam of platforms) { let data = platformParam.split("@"), platform = data[0], version = data[1]; if (this.isPlatformInstalled(platform, projectData)) { - await this.updatePlatform(platform, version, platformTemplate, projectData); + await this.updatePlatform(platform, version, platformTemplate, projectData, platformSpecificData); } else { - await this.addPlatform(platformParam, platformTemplate, projectData); + await this.addPlatform(platformParam, platformTemplate, projectData, platformSpecificData); } }; } @@ -664,9 +664,9 @@ export class PlatformService extends EventEmitter implements IPlatformService { } } - public async ensurePlatformInstalled(platform: string, platformTemplate: string, projectData: IProjectData): Promise { + public async ensurePlatformInstalled(platform: string, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { if (!this.isPlatformInstalled(platform, projectData)) { - await this.addPlatform(platform, platformTemplate, projectData); + await this.addPlatform(platform, platformTemplate, projectData, platformSpecificData); } } @@ -726,7 +726,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { return this.getLatestApplicationPackage(platformData.emulatorBuildOutputPath || platformData.deviceBuildOutputPath, platformData.validPackageNamesForEmulator || platformData.validPackageNamesForDevice); } - private async updatePlatform(platform: string, version: string, platformTemplate: string, projectData: IProjectData): Promise { + private async updatePlatform(platform: string, version: string, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { let platformData = this.$platformsData.getPlatformData(platform, projectData); let data = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName); @@ -747,7 +747,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } if (!semver.gt(currentVersion, newVersion)) { - await this.updatePlatformCore(platformData, { currentVersion, newVersion, canUpdate, platformTemplate }, projectData); + await this.updatePlatformCore(platformData, { currentVersion, newVersion, canUpdate, platformTemplate }, projectData, platformSpecificData); } else if (semver.eq(currentVersion, newVersion)) { this.$errors.fail("Current and new version are the same."); } else { @@ -759,11 +759,11 @@ export class PlatformService extends EventEmitter implements IPlatformService { } - private async updatePlatformCore(platformData: IPlatformData, updateOptions: IUpdatePlatformOptions, projectData: IProjectData): Promise { + private async updatePlatformCore(platformData: IPlatformData, updateOptions: IUpdatePlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise { let packageName = platformData.normalizedPlatformName.toLowerCase(); await this.removePlatforms([packageName], projectData); packageName = updateOptions.newVersion ? `${packageName}@${updateOptions.newVersion}` : packageName; - await this.addPlatform(packageName, updateOptions.platformTemplate, projectData); + await this.addPlatform(packageName, updateOptions.platformTemplate, projectData, platformSpecificData); this.$logger.out("Successfully updated to version ", updateOptions.newVersion); } diff --git a/lib/services/test-execution-service.ts b/lib/services/test-execution-service.ts index e5a0985ecd..40593cb418 100644 --- a/lib/services/test-execution-service.ts +++ b/lib/services/test-execution-service.ts @@ -54,7 +54,7 @@ class TestExecutionService implements ITestExecutionService { this.$fs.writeFile(path.join(projectDir, TestExecutionService.SOCKETIO_JS_FILE_NAME), socketIoJs); const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release }; - if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, this.$options.provision)) { + if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, { provision: this.$options.provision, sdk: this.$options.sdk })) { this.$errors.failWithoutHelp("Verify that listed files are well-formed and try again the operation."); } this.detourEntryPoint(projectFilesPath); @@ -69,7 +69,7 @@ class TestExecutionService implements ITestExecutionService { provision: this.$options.provision, teamId: this.$options.teamId }; - await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData, this.$options.provision); + await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData, { provision: this.$options.provision, sdk: this.$options.sdk }); await this.$usbLiveSyncService.liveSync(platform, projectData); if (this.$options.debugBrk) { @@ -123,7 +123,7 @@ class TestExecutionService implements ITestExecutionService { const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release }; // Prepare the project AFTER the TestExecutionService.CONFIG_FILE_NAME file is created in node_modules // so it will be sent to device. - if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, this.$options.provision)) { + if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, { provision: this.$options.provision, sdk: this.$options.sdk })) { this.$errors.failWithoutHelp("Verify that listed files are well-formed and try again the operation."); } @@ -141,7 +141,7 @@ class TestExecutionService implements ITestExecutionService { teamId: this.$options.teamId }; - await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData, this.$options.provision); + await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData, { provision: this.$options.provision, sdk: this.$options.sdk }); await this.$usbLiveSyncService.liveSync(platform, projectData); } }; diff --git a/test/platform-service.ts b/test/platform-service.ts index 23dfea7f4e..92938e593f 100644 --- a/test/platform-service.ts +++ b/test/platform-service.ts @@ -98,21 +98,21 @@ describe('Platform Service Tests', () => { fs.exists = () => false; let projectData: IProjectData = testInjector.resolve("projectData"); - await platformService.addPlatforms(["Android"], "", projectData); - await platformService.addPlatforms(["ANDROID"], "", projectData); - await platformService.addPlatforms(["AnDrOiD"], "", projectData); - await platformService.addPlatforms(["androiD"], "", projectData); - - await platformService.addPlatforms(["iOS"], "", projectData); - await platformService.addPlatforms(["IOS"], "", projectData); - await platformService.addPlatforms(["IoS"], "", projectData); - await platformService.addPlatforms(["iOs"], "", projectData); + await platformService.addPlatforms(["Android"], "", projectData, null); + await platformService.addPlatforms(["ANDROID"], "", projectData, null); + await platformService.addPlatforms(["AnDrOiD"], "", projectData, null); + await platformService.addPlatforms(["androiD"], "", projectData, null); + + await platformService.addPlatforms(["iOS"], "", projectData, null); + await platformService.addPlatforms(["IOS"], "", projectData, null); + await platformService.addPlatforms(["IoS"], "", projectData, null); + await platformService.addPlatforms(["iOs"], "", projectData, null); }); it("should fail if platform is already installed", async () => { let projectData: IProjectData = testInjector.resolve("projectData"); // By default fs.exists returns true, so the platforms directory should exists - await assert.isRejected(platformService.addPlatforms(["android"], "", projectData)); - await assert.isRejected(platformService.addPlatforms(["ios"], "", projectData)); + await assert.isRejected(platformService.addPlatforms(["android"], "", projectData, null)); + await assert.isRejected(platformService.addPlatforms(["ios"], "", projectData, null)); }); it("should fail if npm is unavalible", async () => { let fs = testInjector.resolve("fs"); @@ -124,7 +124,7 @@ describe('Platform Service Tests', () => { let projectData: IProjectData = testInjector.resolve("projectData"); try { - await platformService.addPlatforms(["android"], "", projectData); + await platformService.addPlatforms(["android"], "", projectData, null); } catch (err) { assert.equal(errorMessage, err.message); } @@ -144,7 +144,7 @@ describe('Platform Service Tests', () => { }; try { - await platformService.addPlatforms(["ios"], "", projectData); + await platformService.addPlatforms(["ios"], "", projectData, null); } catch (err) { assert.equal(errorMessage, err.message); } @@ -164,7 +164,7 @@ describe('Platform Service Tests', () => { let projectData: IProjectData = testInjector.resolve("projectData"); try { - await platformService.addPlatforms(["android"], "", projectData); + await platformService.addPlatforms(["android"], "", projectData, null); } catch (err) { assert.equal(errorMessage, err.message); } @@ -196,7 +196,7 @@ describe('Platform Service Tests', () => { it("shouldn't fail when platforms are added", async () => { let projectData: IProjectData = testInjector.resolve("projectData"); testInjector.resolve("fs").exists = () => false; - await platformService.addPlatforms(["android"], "", projectData); + await platformService.addPlatforms(["android"], "", projectData, null); testInjector.resolve("fs").exists = () => true; await platformService.removePlatforms(["android"], projectData); @@ -217,7 +217,7 @@ describe('Platform Service Tests', () => { npmInstallationManager.getLatestVersion = async () => "0.2.0"; let projectData: IProjectData = testInjector.resolve("projectData"); - await assert.isRejected(platformService.updatePlatforms(["android"], "", projectData)); + await assert.isRejected(platformService.updatePlatforms(["android"], "", projectData, null)); }); }); });