Skip to content

Commit

Permalink
[rush] Fix build cache ids when "enableSubPathScan" is enabled (#5045)
Browse files Browse the repository at this point in the history
Co-authored-by: David Michon <[email protected]>
  • Loading branch information
dmichon-msft and dmichon-msft authored Dec 14, 2024
1 parent 2e2ac57 commit 4f94865
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fix an issue with the `enableSubpathScan` experiment where the set of returned hashes would result in incorrect build cache identifiers when using `--only`.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,12 @@ export class PhasedScriptAction extends BaseScriptAction<IPhasedCommandConfig> {

const analyzer: ProjectChangeAnalyzer = new ProjectChangeAnalyzer(this.rushConfiguration);
const getInputsSnapshotAsync: GetInputsSnapshotAsyncFn | undefined =
await analyzer._tryGetSnapshotProviderAsync(projectConfigurations, terminal, projectSelection);
await analyzer._tryGetSnapshotProviderAsync(
projectConfigurations,
terminal,
// We need to include all dependencies, otherwise build cache id calculation will be incorrect
Selection.expandAllDependencies(projectSelection)
);
const initialSnapshot: IInputsSnapshot | undefined = await getInputsSnapshotAsync?.();

repoStateStopwatch.stop();
Expand Down
3 changes: 2 additions & 1 deletion libraries/rush-lib/src/logic/ProjectChangeAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@ export class ProjectChangeAnalyzer {

if (
projectSelection &&
projectSelection.size > 0 &&
this._rushConfiguration.experimentsConfiguration.configuration.enableSubpathScan
) {
filterPath = Array.from(projectSelection).map(({ projectFolder }) => projectFolder);
filterPath = Array.from(projectSelection, ({ projectFolder }) => projectFolder);
}

return async function tryGetSnapshotAsync(): Promise<IInputsSnapshot | undefined> {
Expand Down

0 comments on commit 4f94865

Please sign in to comment.