Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] When using cobuilds, no-op operations should not be treated as uncacheable #4660

Merged
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
84bcc6d
fix cobuild plugin sandbox
aramissennyeydd Apr 17, 2024
e5780f4
improve cache disabled check for skipped scripts
aramissennyeydd Apr 17, 2024
f4b765a
add changeset
aramissennyeydd Apr 17, 2024
22fd9cf
use itsnoop and adjust tests
aramissennyeydd Apr 18, 2024
d7eb323
small improvements in logging
aramissennyeydd Apr 18, 2024
9ca4353
fix tsc
aramissennyeydd Apr 18, 2024
29cb7dc
better handling of noop and skipped elements
aramissennyeydd Apr 18, 2024
7e37a16
update to debug logs
aramissennyeydd Apr 19, 2024
f39d8f8
add logging about tree depth
aramissennyeydd Apr 20, 2024
e73fdba
adjust maxWidth and depth calcs
aramissennyeydd Apr 22, 2024
b068fe8
update wording for parents vs dependents
aramissennyeydd Apr 22, 2024
6dd1b75
operation depth wording
aramissennyeydd Apr 22, 2024
9aa5a49
fix initial width calc
aramissennyeydd Apr 23, 2024
5397768
fix tsc errors
aramissennyeydd Apr 23, 2024
1244ea1
Apply suggestions from code review
aramissennyeydd Apr 25, 2024
d831692
address PR comments
aramissennyeydd Apr 25, 2024
ef71ebc
move to a separate logging plugin and add tests
aramissennyeydd Apr 26, 2024
067b60b
fix linting errors
aramissennyeydd Apr 26, 2024
cdf753e
fix typing issue
aramissennyeydd Apr 29, 2024
138c9e1
retry tests
aramissennyeydd Apr 29, 2024
81f3536
more linting
aramissennyeydd Apr 29, 2024
98a2b91
Apply suggestions from code review
aramissennyeydd May 10, 2024
d98fd22
make into a non-breaking change
aramissennyeydd May 10, 2024
3ecc6cc
fix snapshots
aramissennyeydd May 10, 2024
6865a11
fix clustering in the display plugin
aramissennyeydd May 22, 2024
21ee0d6
fix linting
aramissennyeydd May 22, 2024
0167239
Apply suggestions from code review
aramissennyeydd May 23, 2024
a7cd9e7
make isNoOp an operation property and adjust cacheDisabled API
aramissennyeydd May 23, 2024
b693a40
adjust following PR review
aramissennyeydd May 23, 2024
f827bba
adjust snapshots
aramissennyeydd May 23, 2024
77bdaa0
adjust comments
aramissennyeydd May 23, 2024
c19bcf3
address pr feedback for test
aramissennyeydd May 23, 2024
5f6853f
Apply suggestions from code review
aramissennyeydd May 25, 2024
f0af2ff
test fixes from PR review
aramissennyeydd May 25, 2024
5e7da2c
fix linting
aramissennyeydd May 25, 2024
fd3ea2b
Update libraries/rush-lib/src/logic/operations/test/BuildPlanPlugin.t…
aramissennyeydd May 25, 2024
4c3b9de
fix snapshots
aramissennyeydd May 25, 2024
1ca4ca1
Update libraries/rush-lib/src/logic/operations/test/BuildPlanPlugin.t…
aramissennyeydd May 25, 2024
0b05318
Merge remote-tracking branch 'upstream/main' into fix-caching-behavio…
aramissennyeydd May 25, 2024
fd1e8f5
udpate snapshot
aramissennyeydd May 25, 2024
ffb6427
Fix an issue with StringBufferTerminalProvider's 'normalizeSpecialCha…
iclanton May 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
{
"operationName": "cobuild",
"outputFolderNames": ["dist"]
},
{
"operationName": "_phase:build",
"outputFolderNames": ["dist"]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
{
"operationName": "cobuild",
"outputFolderNames": ["dist"]
},
{
"operationName": "_phase:build",
"outputFolderNames": ["dist"]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
{
"operationName": "cobuild",
"outputFolderNames": ["dist"]
},
{
"operationName": "_phase:build",
"outputFolderNames": ["dist"]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
{
"operationName": "cobuild",
"outputFolderNames": ["dist"]
},
{
"operationName": "_phase:build",
"outputFolderNames": ["dist"]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
{
"operationName": "cobuild",
"outputFolderNames": ["dist"]
},
{
"operationName": "_phase:build",
"outputFolderNames": ["dist"]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
{
"operationName": "cobuild",
"outputFolderNames": ["dist"]
},
{
"operationName": "_phase:build",
"outputFolderNames": ["dist"]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
{
"operationName": "cobuild",
"outputFolderNames": ["dist"]
},
{
"operationName": "_phase:build",
"outputFolderNames": ["dist"]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fixes a bug where no-op operations were treated as having build cache disabled.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
2 changes: 1 addition & 1 deletion common/reviews/api/rush-lib.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ export class RushLifecycleHooks {
// @alpha
export class RushProjectConfiguration {
readonly disableBuildCacheForProject: boolean;
getCacheDisabledReason(trackedFileNames: Iterable<string>, phaseName: string): string | undefined;
getCacheDisabledReason(trackedFileNames: Iterable<string>, phaseName: string, operation?: Operation): string | undefined;
readonly incrementalBuildIgnoredGlobs: ReadonlyArray<string>;
// (undocumented)
readonly operationSettingsByOperationName: ReadonlyMap<string, Readonly<IOperationSettings>>;
Expand Down
13 changes: 11 additions & 2 deletions libraries/rush-lib/src/api/RushProjectConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { IPhase } from './CommandLineConfiguration';
import { OverlappingPathAnalyzer } from '../utilities/OverlappingPathAnalyzer';
import schemaJson from '../schemas/rush-project.schema.json';
import anythingSchemaJson from '../schemas/rush-project.schema.json';
import type { Operation } from '../logic/operations/Operation';

/**
* Describes the file structure for the `<project root>/config/rush-project.json` config file.
Expand Down Expand Up @@ -299,12 +300,19 @@ export class RushProjectConfiguration {
* Examines the list of source files for the project and the target phase and returns a reason
* why the project cannot enable the build cache for that phase, or undefined if it is safe to so do.
*/
public getCacheDisabledReason(trackedFileNames: Iterable<string>, phaseName: string): string | undefined {
public getCacheDisabledReason(
trackedFileNames: Iterable<string>,
phaseName: string,
operation?: Operation
aramissennyeydd marked this conversation as resolved.
Show resolved Hide resolved
): string | undefined {
if (this.disableBuildCacheForProject) {
return 'Caching has been disabled for this project.';
}

const normalizedProjectRelativeFolder: string = Path.convertToSlashes(this.project.projectRelativeFolder);
// Skip no-op operations as they won't have any output/cacheable things.
if (operation?.runner?.isNoOp) {
return undefined;
}
aramissennyeydd marked this conversation as resolved.
Show resolved Hide resolved

const operationSettings: IOperationSettings | undefined =
this.operationSettingsByOperationName.get(phaseName);
Expand All @@ -320,6 +328,7 @@ export class RushProjectConfiguration {
if (!outputFolderNames) {
return;
}
const normalizedProjectRelativeFolder: string = Path.convertToSlashes(this.project.projectRelativeFolder);

const normalizedOutputFolders: string[] = outputFolderNames.map(
(outputFolderName) => `${normalizedProjectRelativeFolder}/${outputFolderName}/`
Expand Down