Skip to content

Commit ed427db

Browse files
committed
Skip local prepare when executing cloud build from sidekick and no project's file is changed
1 parent f73ec8e commit ed427db

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

lib/services/platform-service.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,27 @@ export class PlatformService extends EventEmitter implements IPlatformService {
197197
return shouldPrepareInfo.changesInfo.hasChanges || requiresNativePrepare;
198198
}
199199

200-
private async getChangesInfo(platformInfo: IPreparePlatformInfo): Promise<IProjectChangesInfo> {
201-
const platformData = this.$platformsData.getPlatformData(platformInfo.platform, platformInfo.projectData);
200+
private async getChangesInfo(preparePlatformInfo: IPreparePlatformInfo): Promise<IProjectChangesInfo> {
201+
await this.initialPrepare(preparePlatformInfo);
202202

203-
return this.initialPrepare(platformInfo.platform, platformData, platformInfo.appFilesUpdaterOptions, platformInfo.platformTemplate, platformInfo.projectData, platformInfo.config, platformInfo.nativePrepare, platformInfo);
203+
const { platform, appFilesUpdaterOptions, projectData, config, nativePrepare } = preparePlatformInfo;
204+
const bundle = appFilesUpdaterOptions.bundle;
205+
const nativePlatformStatus = (nativePrepare && nativePrepare.skipNativePrepare) ? constants.NativePlatformStatus.requiresPlatformAdd : constants.NativePlatformStatus.requiresPrepare;
206+
const changesInfo = await this.$projectChangesService.checkForChanges({
207+
platform,
208+
projectData,
209+
projectChangesOptions: {
210+
bundle,
211+
release: appFilesUpdaterOptions.release,
212+
provision: config.provision,
213+
teamId: config.teamId,
214+
nativePlatformStatus,
215+
skipModulesNativeCheck: preparePlatformInfo.skipModulesNativeCheck
216+
}
217+
});
218+
219+
this.$logger.trace("Changes info in prepare platform:", changesInfo);
220+
return changesInfo;
204221
}
205222

206223
public async preparePlatform(platformInfo: IPreparePlatformInfo): Promise<boolean> {
@@ -252,7 +269,8 @@ export class PlatformService extends EventEmitter implements IPlatformService {
252269
}
253270
}
254271

255-
private async initialPrepare(platform: string, platformData: IPlatformData, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, config: IPlatformOptions, nativePrepare?: INativePrepare, skipNativeCheckOptions?: ISkipNativeCheckOptional): Promise<IProjectChangesInfo> {
272+
private async initialPrepare(preparePlatformInfo: IPreparePlatformInfo) {
273+
const { platform, appFilesUpdaterOptions, platformTemplate, projectData, config, nativePrepare } = preparePlatformInfo;
256274
this.validatePlatform(platform, projectData);
257275

258276
await this.trackProjectType(projectData);
@@ -266,24 +284,6 @@ export class PlatformService extends EventEmitter implements IPlatformService {
266284
}
267285

268286
await this.ensurePlatformInstalled(platform, platformTemplate, projectData, config, appFilesUpdaterOptions, nativePrepare);
269-
270-
const bundle = appFilesUpdaterOptions.bundle;
271-
const nativePlatformStatus = (nativePrepare && nativePrepare.skipNativePrepare) ? constants.NativePlatformStatus.requiresPlatformAdd : constants.NativePlatformStatus.requiresPrepare;
272-
const changesInfo = await this.$projectChangesService.checkForChanges({
273-
platform,
274-
projectData,
275-
projectChangesOptions: {
276-
bundle,
277-
release: appFilesUpdaterOptions.release,
278-
provision: config.provision,
279-
teamId: config.teamId,
280-
nativePlatformStatus,
281-
skipModulesNativeCheck: skipNativeCheckOptions.skipModulesNativeCheck
282-
}
283-
});
284-
285-
this.$logger.trace("Changes info in prepare platform:", changesInfo);
286-
return changesInfo;
287287
}
288288

289289
/* Hooks are expected to use "filesToSync" parameter, as to give plugin authors additional information about the sync process.*/

lib/services/project-changes-service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ export class ProjectChangesService implements IProjectChangesService {
9999
}
100100
}
101101

102-
const projectService = platformData.platformProjectService;
103-
await projectService.checkForChanges(this._changesInfo, projectChangesOptions, projectData);
102+
if (checkForChangesOpts.projectChangesOptions.nativePlatformStatus !== NativePlatformStatus.requiresPlatformAdd) {
103+
const projectService = platformData.platformProjectService;
104+
await projectService.checkForChanges(this._changesInfo, projectChangesOptions, projectData);
105+
}
104106

105107
if (projectChangesOptions.bundle !== this._prepareInfo.bundle || projectChangesOptions.release !== this._prepareInfo.release) {
106108
this._changesInfo.appFilesChanged = true;

0 commit comments

Comments
 (0)