Skip to content

Commit 116e1a1

Browse files
author
rosen-vladimirov
committed
Fix build/prepare
1 parent d56e0b6 commit 116e1a1

18 files changed

+38
-34
lines changed

lib/commands/appstore-upload.ts

+2-2
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);
74+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
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);
79+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
8080

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

lib/commands/build.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class BuildCommandBase {
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);
12+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options.provision);
1313
this.$options.clean = true;
1414
const buildConfig: IBuildConfig = {
1515
buildForDevice: this.$options.forDevice,

lib/commands/debug.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
projectDir: this.$options.path,
3030
release: this.$options.release
3131
};
32-
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData);
32+
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
3333
this.$config.debugLivesync = true;
3434
let applicationReloadAction = async (deviceAppData: Mobile.IDeviceAppData): Promise<void> => {
3535
let projectData: IProjectData = this.$injector.resolve("projectData");

lib/commands/deploy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class DeployOnDeviceCommand implements ICommand {
2121
release: this.$options.release,
2222
forceInstall: true
2323
};
24-
return this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData);
24+
return this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
2525
}
2626

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

lib/commands/emulate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class EmulateCommandBase {
1919
availableDevices: this.$options.availableDevices,
2020
platformTemplate: this.$options.platformTemplate
2121
};
22-
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData);
22+
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, this.$options.provision);
2323
}
2424
}
2525

lib/commands/livesync.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class LivesyncCommand implements ICommand {
2626
release: this.$options.release
2727
};
2828

29-
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData);
29+
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
3030
return this.$usbLiveSyncService.liveSync(args[0], this.$projectData);
3131
}
3232

lib/commands/prepare.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class PrepareCommand implements ICommand {
1010

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

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

lib/commands/run.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class RunCommandBase {
1616
platformTemplate: this.$options.platformTemplate,
1717
release: this.$options.release
1818
};
19-
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData);
19+
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options.provision);
2020

2121
if (this.$options.bundle) {
2222
this.$options.watch = false;

lib/common

lib/definitions/platform.d.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ interface IPlatformService {
4141
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
4242
* @param {string} platformTemplate The name of the platform template.
4343
* @param {IProjectData} projectData DTO with information about the project.
44+
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
4445
* @returns {boolean} true indicates that the platform was prepared.
4546
*/
46-
preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData): Promise<boolean>;
47+
preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, provision: any): Promise<boolean>;
4748

4849
/**
4950
* Determines whether a build is necessary. A build is necessary when one of the following is true:
@@ -102,9 +103,10 @@ interface IPlatformService {
102103
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
103104
* @param {IDeployPlatformOptions} deployOptions Various options that can manage the deploy operation.
104105
* @param {IProjectData} projectData DTO with information about the project.
106+
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
105107
* @returns {void}
106108
*/
107-
deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData): Promise<void>;
109+
deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, provision: any): Promise<void>;
108110

109111
/**
110112
* Runs the application on specified platform. Assumes that the application is already build and installed. Fails if this is not true.
@@ -121,9 +123,10 @@ interface IPlatformService {
121123
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
122124
* @param {IEmulatePlatformOptions} emulateOptions Various options that can manage the emulate operation.
123125
* @param {IProjectData} projectData DTO with information about the project.
126+
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
124127
* @returns {void}
125128
*/
126-
emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData): Promise<void>;
129+
emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, provision: any): Promise<void>;
127130

128131
cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData): Promise<void>;
129132
validatePlatformInstalled(platform: string, projectData: IProjectData): void;

lib/definitions/project.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,11 @@ interface IPlatformProjectService {
169169

170170
/**
171171
* Prepares images in Native project (for iOS).
172+
* @param {IProjectData} projectData DTO with information about the project.
172173
* @param {any} provision UUID of the provisioning profile used in iOS project preparation.
173174
* @returns {void}
174175
*/
175-
prepareProject(provision?: any): Promise<void>;
176+
prepareProject(projectData: IProjectData, provision: any): Promise<void>;
176177

177178
/**
178179
* Prepares App_Resources in the native project by clearing data from other platform and applying platform specific rules.

lib/providers/livesync-provider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export class LiveSyncProvider implements ILiveSyncProvider {
4646
return this.$platformService.getLatestApplicationPackageForDevice(platformData).packageName;
4747
}
4848

49-
public async preparePlatformForSync(platform: string, projectData: IProjectData): Promise<void> {
49+
public async preparePlatformForSync(platform: string, provision: any, projectData: IProjectData): Promise<void> {
5050
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
51-
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData);
51+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, provision);
5252
}
5353

5454
public canExecuteFastSync(filePath: string, projectData: IProjectData, platform: string): boolean {

lib/services/livesync/platform-livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
123123
let batch = this.batch[platform];
124124
await batch.syncFiles(async (filesToSync: string[]) => {
125125
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
126-
await this.$platformService.preparePlatform(this.liveSyncData.platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData);
126+
await this.$platformService.preparePlatform(this.liveSyncData.platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, this.$options.provision);
127127
let canExecute = this.getCanExecuteAction(this.liveSyncData.platform, this.liveSyncData.appIdentifier);
128128
let deviceFileAction = (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => this.transferFiles(deviceAppData, localToDevicePaths, this.liveSyncData.projectFilesPath, !filePath);
129129
let action = this.getSyncAction(filesToSync, deviceFileAction, afterFileSyncAction, projectData);

lib/services/platform-service.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class PlatformService implements IPlatformService {
185185
return _.filter(this.$platformsData.platformsNames, p => { return this.isPlatformPrepared(p, projectData); });
186186
}
187187

188-
public async preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData): Promise<boolean> {
188+
public async preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, provision: any): Promise<boolean> {
189189
this.validatePlatform(platform, projectData);
190190

191191
await this.trackProjectType(projectData);
@@ -214,7 +214,7 @@ export class PlatformService implements IPlatformService {
214214
this.$logger.trace("Changes info in prepare platform:", changesInfo);
215215

216216
if (changesInfo.hasChanges) {
217-
await this.preparePlatformCore(platform, appFilesUpdaterOptions, projectData, changesInfo);
217+
await this.preparePlatformCore(platform, appFilesUpdaterOptions, projectData, provision, changesInfo);
218218
this.$projectChangesService.savePrepareInfo(platform, projectData);
219219
} else {
220220
this.$logger.out("Skipping prepare.");
@@ -242,7 +242,7 @@ export class PlatformService implements IPlatformService {
242242
}
243243

244244
@helpers.hook('prepare')
245-
private async preparePlatformCore(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, projectData: IProjectData, changesInfo?: IProjectChangesInfo): Promise<void> {
245+
private async preparePlatformCore(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, projectData: IProjectData, provision: any, changesInfo?: IProjectChangesInfo): Promise<void> {
246246
this.$logger.out("Preparing project...");
247247

248248
let platformData = this.$platformsData.getPlatformData(platform, projectData);
@@ -252,7 +252,7 @@ export class PlatformService implements IPlatformService {
252252
}
253253
if (!changesInfo || changesInfo.appResourcesChanged) {
254254
this.copyAppResources(platform, projectData);
255-
await platformData.platformProjectService.prepareProject();
255+
await platformData.platformProjectService.prepareProject(projectData, provision);
256256
}
257257
if (!changesInfo || changesInfo.modulesChanged) {
258258
await this.copyTnsModules(platform, projectData);
@@ -360,7 +360,7 @@ export class PlatformService implements IPlatformService {
360360
@exportedPromise("platformService")
361361
public async build(platform: string, platformBuildOptions: IPlatformBuildData, platformTemplate?: string): Promise<void> {
362362
this.$projectData.initializeProjectData(platformBuildOptions.projectDir);
363-
await this.preparePlatform(platform, platformBuildOptions, platformTemplate, this.$projectData);
363+
await this.preparePlatform(platform, platformBuildOptions, platformTemplate, this.$projectData, undefined);
364364
await this.buildPlatform(platform, platformBuildOptions, this.$projectData);
365365
}
366366

@@ -418,8 +418,8 @@ export class PlatformService implements IPlatformService {
418418
this.$logger.out(`Successfully installed on device with identifier '${device.deviceInfo.identifier}'.`);
419419
}
420420

421-
public async deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData): Promise<void> {
422-
await this.preparePlatform(platform, appFilesUpdaterOptions, deployOptions.platformTemplate, projectData);
421+
public async deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, provision: any): Promise<void> {
422+
await this.preparePlatform(platform, appFilesUpdaterOptions, deployOptions.platformTemplate, projectData, provision);
423423
this.$logger.out("Searching for devices...");
424424
await this.$devicesService.initialize({ platform: platform, deviceId: deployOptions.device });
425425
let action = async (device: Mobile.IDevice): Promise<void> => {
@@ -459,7 +459,7 @@ export class PlatformService implements IPlatformService {
459459
await this.$devicesService.execute(action, this.getCanExecuteAction(platform, runOptions));
460460
}
461461

462-
public async emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData): Promise<void> {
462+
public async emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, provision: any): Promise<void> {
463463
if (emulateOptions.avd) {
464464
this.$logger.warn(`Option --avd is no longer supported. Please use --device instead!`);
465465
return Promise.resolve();
@@ -490,7 +490,7 @@ export class PlatformService implements IPlatformService {
490490
}
491491
}
492492

493-
await this.deployPlatform(platform, appFilesUpdaterOptions, emulateOptions, projectData);
493+
await this.deployPlatform(platform, appFilesUpdaterOptions, emulateOptions, projectData, provision);
494494
return this.runPlatform(platform, emulateOptions, projectData);
495495
}
496496

lib/services/plugins-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class PluginsService implements IPluginsService {
135135
let platformData = this.$platformsData.getPlatformData(platform, projectData);
136136

137137
pluginData.pluginPlatformsFolderPath = (_platform: string) => path.join(pluginData.fullPath, "platforms", _platform);
138-
await platformData.platformProjectService.preparePluginNativeCode(pluginData);
138+
await platformData.platformProjectService.preparePluginNativeCode(pluginData, projectData);
139139
}
140140

141141
public async ensureAllDependenciesAreInstalled(projectData: IProjectData): Promise<void> {

lib/services/test-execution-service.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TestExecutionService implements ITestExecutionService {
5454
this.$fs.writeFile(path.join(projectDir, TestExecutionService.SOCKETIO_JS_FILE_NAME), socketIoJs);
5555

5656
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
57-
if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData)) {
57+
if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, this.$options.provision)) {
5858
this.$errors.failWithoutHelp("Verify that listed files are well-formed and try again the operation.");
5959
}
6060
this.detourEntryPoint(projectFilesPath);
@@ -67,7 +67,7 @@ class TestExecutionService implements ITestExecutionService {
6767
platformTemplate: this.$options.platformTemplate,
6868
release: this.$options.release
6969
};
70-
await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData);
70+
await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData, this.$options.provision);
7171
await this.$usbLiveSyncService.liveSync(platform, projectData);
7272

7373
if (this.$options.debugBrk) {
@@ -121,7 +121,7 @@ class TestExecutionService implements ITestExecutionService {
121121
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
122122
// Prepare the project AFTER the TestExecutionService.CONFIG_FILE_NAME file is created in node_modules
123123
// so it will be sent to device.
124-
if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData)) {
124+
if (!await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, projectData, this.$options.provision)) {
125125
this.$errors.failWithoutHelp("Verify that listed files are well-formed and try again the operation.");
126126
}
127127

@@ -137,7 +137,7 @@ class TestExecutionService implements ITestExecutionService {
137137
release: this.$options.release
138138
};
139139

140-
await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData);
140+
await this.$platformService.deployPlatform(platform, appFilesUpdaterOptions, deployOptions, projectData, this.$options.provision);
141141
await this.$usbLiveSyncService.liveSync(platform, projectData);
142142
}
143143
};

test/npm-support.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async function preparePlatform(testInjector: IInjector): Promise<void> {
188188
let projectData: IProjectData = testInjector.resolve("projectData");
189189
projectData.initializeProjectData();
190190

191-
await platformService.preparePlatform("android", { bundle: false, release: false }, "", projectData);
191+
await platformService.preparePlatform("android", { bundle: false, release: false }, "", projectData, undefined);
192192
}
193193

194194
describe("Npm support tests", () => {

0 commit comments

Comments
 (0)