8000 [rush] Split ProjectChangeAnalyzer, fix build cache hashes (#4476) · glitchkyle/rushstack@3530cb2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3530cb2

Browse files
authored
[rush] Split ProjectChangeAnalyzer, fix build cache hashes (microsoft#4476)
* [rush] Split ProjectChangeAnalyzer, fix build cache hashes * Rename InputSnapshot and related functionality * [rush] More renames, move logging * [rush] Allow rush plugins to add metadata files to cache entries * [rush] Add `operation.enabled` flag * [rush] Add `cacheHashSalt` property --------- Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
1 parent 300fcd1 commit 3530cb2

File tree

46 files changed

+2338
-1587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2338
-1587
lines changed

build-tests/heft-node-everything-test/config/heft.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@
2626
"taskPlugin": {
2727
"pluginPackage": "@rushstack/heft-api-extractor-plugin"
2828
}
29+
},
30+
"metadata-test": {
31+
"taskDependencies": ["typescript"],
32+
"taskPlugin": {
33+
"pluginPackage": "@rushstack/heft",
34+
"pluginName": "run-script-plugin",
35+
"options": {
36+
"scriptPath": "./lib/test-metadata.js"
37+
}
38+
}
2939
}
3040
}
3141
},

build-tests/heft-node-everything-test/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"scripts": {
99
"build": "heft build --clean",
1010
"_phase:build": "heft run --only build -- --clean",
11-
"_phase:test": "heft run --only test -- --clean"
11+
"_phase:build:incremental": "heft run --only build --",
12+
"_phase:test": "heft run --only test -- --clean",
13+
"_phase:test:incremental": "heft run --only test --"
1214
},
1315
"devDependencies": {
1416
"@microsoft/api-extractor": "workspace:*",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
import * as fs from 'node:fs/promises';
5+
6+
import type { IRunScriptOptions } from '@rushstack/heft';
7+
8+
export async function runAsync({ heftConfiguration: { buildFolderPath } }: IRunScriptOptions): Promise<void> {
9+
const metadataFolder: string = `${buildFolderPath}/.rush/temp/operation/_phase_build`;
10+
11+
await fs.mkdir(metadataFolder, { recursive: true });
12+
13+
await fs.writeFile(`${metadataFolder}/test.txt`, new Date().toString(), 'utf-8');
14+
}
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": "Allow rush plugins to extend build cache entries by writing additional files to the metadata folder. Expose the metadata folder path to plugins.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
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": "[CACHE BREAK] Alter the computation of build cache IDs to depend on the graph of operations in the build and therefore account for multiple phases, rather than only the declared dependencies. Ensure that `dependsOnEnvVars` and command line parameters that affect upstream phases impact the cache IDs of downstream operations.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
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 1241 +
"comment": "(BREAKING CHANGE) Replace use of `ProjectChangeAnalyzer` in phased command hooks with a new `InputsSnapshot` data structure that is completely synchronous and does not perform any disk operations. Perform all disk operations and state computation prior to executing the build graph.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
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": "Add a new property `enabled` to `Operation` that when set to false, will cause the execution engine to immediately return `OperationStatus.Skipped` instead of invoking the runner. Use this property to disable operations that are not intended to be executed in the current pass, e.g. those that did not contain changes in the most recent watch iteration, or those excluded by `--only`.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
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": "Add an optional property `cacheHashSalt` to `build-cache.json` to allow repository maintainers to globally force a hash change in build cache entries.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/lookup-by-path",
5+
"comment": "Add `IReadonlyLookupByPath` interface to help unit tests for functions that consume `LookupByPath`.",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@rushstack/lookup-by-path"
10+
}

common/reviews/api/lookup-by-path.api.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ export interface IPrefixMatch<TItem> {
1212
}
1313

1414
// @beta
15-
export class LookupByPath<TItem> {
15+
export interface IReadonlyLookupByPath<TItem> {
16+
findChildPath(childPath: string): TItem | undefined;
17+
findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
18+
findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
19+
groupByChild<TInfo>(infoByPath: Map<string, TInfo>): Map<TItem, Map<string, TInfo>>;
20+
}
21+
22+
// @beta
23+
export class LookupByPath<TItem> implements IReadonlyLookupByPath<TItem> {
1624
constructor(entries?: Iterable<[string, TItem]>, delimiter?: string);
1725
readonly delimiter: string;
1826
findChildPath(childPath: string): TItem | undefined;

0 commit comments

Comments
 (0)
0