Skip to content

Commit b5e0aa0

Browse files
author
Fatme
authored
Merge pull request #3764 from NativeScript/fatme/fix-check-for-changes
Skip local prepare when executing cloud build from sidekick and no project's file is changed
2 parents 84aabc5 + ed427db commit b5e0aa0

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
@@ -198,10 +198,27 @@ export class PlatformService extends EventEmitter implements IPlatformService {
198198
return shouldPrepareInfo.changesInfo.hasChanges || requiresNativePrepare;
199199
}
200200

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

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

207224
public async preparePlatform(platformInfo: IPreparePlatformInfo): Promise<boolean> {
@@ -256,7 +273,8 @@ export class PlatformService extends EventEmitter implements IPlatformService {
256273
}
257274
}
258275

259-
private async initialPrepare(platform: string, platformData: IPlatformData, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, config: IPlatformOptions, nativePrepare?: INativePrepare, skipNativeCheckOptions?: ISkipNativeCheckOptional): Promise<IProjectChangesInfo> {
276+
private async initialPrepare(preparePlatformInfo: IPreparePlatformInfo) {
277+
const { platform, appFilesUpdaterOptions, platformTemplate, projectData, config, nativePrepare } = preparePlatformInfo;
260278
this.validatePlatform(platform, projectData);
261279

262280
await this.trackProjectType(projectData);
@@ -270,24 +288,6 @@ export class PlatformService extends EventEmitter implements IPlatformService {
270288
}
271289

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

293293
/* 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
@@ -106,8 +106,10 @@ export class ProjectChangesService implements IProjectChangesService {
106106
this.$logger.trace(`Set value of configChanged to ${this._changesInfo.configChanged}`);
107107
}
108108

109-
const projectService = platformData.platformProjectService;
110-
await projectService.checkForChanges(this._changesInfo, projectChangesOptions, projectData);
109+
if (checkForChangesOpts.projectChangesOptions.nativePlatformStatus !== NativePlatformStatus.requiresPlatformAdd) {
110+
const projectService = platformData.platformProjectService;
111+
await projectService.checkForChanges(this._changesInfo, projectChangesOptions, projectData);
112+
}
111113

112114
if (projectChangesOptions.bundle !== this._prepareInfo.bundle || projectChangesOptions.release !== this._prepareInfo.release) {
113115
this.$logger.trace(`Setting all setting to true. Current options are: `, projectChangesOptions, " old prepare info is: ", this._prepareInfo);

0 commit comments

Comments
 (0)