Skip to content

Commit d76dadf

Browse files
authored
Merge pull request #4551 from william2958/will/subspace-patch-4
[rush] Fix rush build for subspaces
2 parents af0d9e6 + d7f8e98 commit d76dadf

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Fix an issue where, when the experimental subspaces feature was enabled, the lockfile validation would check irrelevant subspaces",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

libraries/rush-lib/src/logic/ProjectChangeAnalyzer.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -409,27 +409,27 @@ export class ProjectChangeAnalyzer {
409409
const additionalFilesToHash: string[] = [];
410410

411411
if (this._rushConfiguration.packageManager === 'pnpm') {
412-
const absoluteFilePathsToCheck: string[] = [];
413-
414-
for (const project of this._rushConfiguration.projects) {
415-
const projectShrinkwrapFilePath: string =
416-
BaseProjectShrinkwrapFile.getFilePathForProject(project);
417-
absoluteFilePathsToCheck.push(projectShrinkwrapFilePath);
418-
const relativeProjectShrinkwrapFilePath: string = Path.convertToSlashes(
419-
path.relative(rootDir, projectShrinkwrapFilePath)
420-
);
421-
422-
additionalFilesToHash.push(relativeProjectShrinkwrapFilePath);
423-
}
424-
425-
await Async.forEachAsync(absoluteFilePathsToCheck, async (filePath: string) => {
426-
if (!(await FileSystem.existsAsync(filePath))) {
427-
throw new Error(
428-
`A project dependency file (${filePath}) is missing. You may need to run ` +
429-
'"rush install" or "rush update".'
412+
await Async.forEachAsync(
413+
this._rushConfiguration.projects,
414+
async (project: RushConfigurationProject) => {
415+
const projectShrinkwrapFilePath: string =
416+
BaseProjectShrinkwrapFile.getFilePathForProject(project);
417+
if (!(await FileSystem.existsAsync(projectShrinkwrapFilePath))) {
418+
// Missing shrinkwrap of subspace project is allowed because subspace projects can be partial installed
419+
if (this._rushConfiguration.subspacesFeatureEnabled) {
420+
return;
421+
}
422+
throw new Error(
423+
`A project dependency file (${projectShrinkwrapFilePath}) is missing. You may need to run ` +
424+
'"rush install" or "rush update".'
425+
);
426+
}
427+
const relativeProjectShrinkwrapFilePath: string = Path.convertToSlashes(
428+
path.relative(rootDir, projectShrinkwrapFilePath)
430429
);
430+
additionalFilesToHash.push(relativeProjectShrinkwrapFilePath);
431431
}
432-
});
432+
);
433433
}
434434

435435
const hashes: Map<string, string> = await getRepoStateAsync(rootDir, additionalFilesToHash, gitPath);

0 commit comments

Comments
 (0)