Skip to content

Commit afbc10f

Browse files
committed
Replace the incrementalBuildDependencyGranularity option with the legacyIncrementalBuildDependencyDetection experiment flag.
1 parent 7d90301 commit afbc10f

10 files changed

Lines changed: 26 additions & 56 deletions

File tree

‎apps/rush-lib/assets/rush-init/common/config/rush/experiments.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,13 @@
44
*/
55
{
66
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/experiments.schema.json",
7+
8+
/**
9+
* Rush 5.14.0 improved incremental builds to ignore spurious changes in the pnpm-lock.json file.
10+
* This optimization is enabled by default. If you encounter a problem where "rush build" is neglecting
11+
* to build some projects, please open a GitHub issue. As a workaround you can uncomment this line
12+
* to temporarily restore the old behavior where everything must be rebuilt whenever pnpm-lock.json
13+
* is modified.
14+
*/
15+
/*[LINE "HYPOTHETICAL"]*/ "legacyIncrementalBuildDependencyDetection": true
716
}

‎apps/rush-lib/assets/rush-init/rush.json‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,7 @@
6161
* After modifying this field, it's recommended to run "rush update --full" so that the package manager
6262
* will recalculate all version selections.
6363
*/
64-
/*[LINE "HYPOTHETICAL"]*/ "resolutionStrategy": "fast",
65-
66-
/**
67-
* This defines the granularity by which external dependencies are tracked to detect if a project needs
68-
* to be rebuilt during an incremental build.
69-
*
70-
* If set to "project," Rush will track only the individual project's direct and indirect dependencies when
71-
* detecting if a project needs to be rebuilt.
72-
*
73-
* If set to "repository," all projects will be rebuilt if any external dependencies anywhere in the repository
74-
* are changed.
75-
*
76-
* If unset, defaults to "project."
77-
*/
78-
/*[LINE "DEMO"]*/ "incrementalBuildDependencyGranularity": "project"
64+
/*[LINE "HYPOTHETICAL"]*/ "resolutionStrategy": "fast"
7965
},
8066

8167
/**

‎apps/rush-lib/src/api/ExperimentsConfiguration.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import {
1212
* @beta
1313
*/
1414
export interface IExperimentsJson {
15+
/**
16+
* If this setting is enabled, incremental builds should use repo-wide dependency tracking
17+
* instead of project-specific tracking.
18+
*/
19+
legacyIncrementalBuildDependencyDetection?: boolean;
1520
}
1621

1722
/**
@@ -47,7 +52,7 @@ export class ExperimentsConfiguration {
4752
/**
4853
* Get the experiments configuration.
4954
*/
50-
public get experimentConfiguration(): Readonly<IExperimentsJson> {
55+
public get configuration(): Readonly<IExperimentsJson> {
5156
return this._experimentConfiguration;
5257
}
5358
}

‎apps/rush-lib/src/api/RushConfiguration.ts‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ export interface IRushRepositoryJson {
8989
export interface IPnpmOptionsJson {
9090
strictPeerDependencies?: boolean;
9191
resolutionStrategy?: ResolutionStrategy;
92-
/** @beta */
93-
incrementalBuildDependencyGranularity?: IncrementalBuildDependencyGranularity;
9492
}
9593

9694
/**
@@ -190,27 +188,10 @@ export class PnpmOptionsConfiguration {
190188
*/
191189
public readonly resolutionStrategy: ResolutionStrategy;
192190

193-
/**
194-
* This defines the granularity by which external dependencies are tracked to detect if a project needs
195-
* to be rebuilt during an incremental build.
196-
*
197-
* If set to "project," Rush will track only the individual project's direct and indirect dependencies when
198-
* detecting if a project needs to be rebuilt.
199-
*
200-
* If set to "repository," all projects will be rebuilt if any external dependencies anywhere in the repository
201-
* are changed.
202-
*
203-
* If unset, defaults to "project."
204-
*
205-
* @beta
206-
*/
207-
public readonly incrementalBuildDependencyGranularity: IncrementalBuildDependencyGranularity;
208-
209191
/** @internal */
210192
public constructor(json: IPnpmOptionsJson) {
211193
this.strictPeerDependencies = !!json.strictPeerDependencies;
212194
this.resolutionStrategy = json.resolutionStrategy || 'fewer-dependencies';
213-
this.incrementalBuildDependencyGranularity = json.incrementalBuildDependencyGranularity || 'project';
214195
}
215196
}
216197

@@ -261,12 +242,6 @@ export interface ITryFindRushJsonLocationOptions {
261242
*/
262243
export type ResolutionStrategy = 'fewer-dependencies' | 'fast';
263244

264-
/**
265-
* This represents the available dependency-tracking granularities during incremental builds.
266-
* @beta
267-
*/
268-
export type IncrementalBuildDependencyGranularity = 'project' | 'repository';
269-
270245
/**
271246
* This represents the Rush configuration for a repository, based on the "rush.json"
272247
* configuration file.

‎apps/rush-lib/src/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export {
1414
RushConfiguration,
1515
ITryFindRushJsonLocationOptions,
1616
ResolutionStrategy,
17-
IncrementalBuildDependencyGranularity,
1817
PnpmOptionsConfiguration,
1918
YarnOptionsConfiguration
2019
} from './api/RushConfiguration';

‎apps/rush-lib/src/logic/PackageChangeAnalyzer.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class PackageChangeAnalyzer {
136136

137137
if (
138138
this._rushConfiguration.packageManager === 'pnpm' &&
139-
this._rushConfiguration.pnpmOptions.incrementalBuildDependencyGranularity === 'project'
139+
!this._rushConfiguration.experimentsConfiguration.configuration.legacyIncrementalBuildDependencyDetection
140140
) {
141141
const projects: RushConfigurationProject[] = [];
142142
const projectDependencyManifestPaths: string[] = [];

‎apps/rush-lib/src/logic/pnpm/PnpmLinkManager.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export class PnpmLinkManager extends BaseLinkManager {
270270
newLocalFolderPath
271271
);
272272

273-
if (this._rushConfiguration.pnpmOptions.incrementalBuildDependencyGranularity === 'project') {
273+
if (!this._rushConfiguration.experimentsConfiguration.configuration.legacyIncrementalBuildDependencyDetection) {
274274
pnpmProjectDependencyManifest.addDependency(newLocalPackage);
275275
}
276276

@@ -284,7 +284,7 @@ export class PnpmLinkManager extends BaseLinkManager {
284284

285285
PnpmLinkManager._createSymlinksForTopLevelProject(localPackage);
286286

287-
if (this._rushConfiguration.pnpmOptions.incrementalBuildDependencyGranularity === 'project') {
287+
if (!this._rushConfiguration.experimentsConfiguration.configuration.legacyIncrementalBuildDependencyDetection) {
288288
pnpmProjectDependencyManifest.save();
289289
} else {
290290
pnpmProjectDependencyManifest.deleteIfExists();

‎apps/rush-lib/src/schemas/experiments.schema.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"$schema": {
99
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
1010
"type": "string"
11+
},
12+
13+
"legacyIncrementalBuildDependencyDetection": {
14+
"description": "Rush 5.14.0 improved incremental builds to ignore spurious changes in the pnpm-lock.json file. This optimization is enabled by default. If you encounter a problem where \"rush build\" is neglecting to build some projects, please open a GitHub issue. As a workaround you can uncomment this line to temporarily restore the old behavior where everything must be rebuilt whenever pnpm-lock.json is modified.",
15+
"type": "boolean"
1116
}
1217
},
1318
"additionalProperties": false

‎apps/rush-lib/src/schemas/rush.schema.json‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@
6565
"description": "Configures the strategy used to select versions during installation. This feature requires PNPM version 3.1 or newer. It corresponds to the \"--resolution-strategy\" command-line option for PNPM. Possible values are \"fast\" and \"fewer-dependencies\". PNPM's default is \"fast\", but this may be incompatible with certain packages, for example the \"@types\" packages from DefinitelyTyped. Rush's default is \"fewer-dependencies\", which causes PNPM to avoid installing a newer version if an already installed version can be reused; this is more similar to NPM's algorithm.",
6666
"type": "string",
6767
"enum": ["fewer-dependencies", "fast"]
68-
},
69-
"incrementalBuildDependencyGranularity": {
70-
"description": "Defines the granularity by which external dependencies are tracked to detect if a project needs to be rebuilt during an incremental build.",
71-
"type": "string",
72-
"enum": ["project", "repository"]
7368
}
7469
},
7570
"additionalProperties": false

‎common/reviews/api/rush-lib.api.md‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,12 @@ export class EventHooks {
114114
export class ExperimentsConfiguration {
115115
// @internal
116116
constructor(jsonFileName: string);
117-
readonly experimentConfiguration: Readonly<IExperimentsJson>;
117+
readonly configuration: Readonly<IExperimentsJson>;
118118
}
119119

120120
// @beta (undocumented)
121121
export interface IExperimentsJson {
122+
legacyIncrementalBuildDependencyDetection?: boolean;
122123
}
123124

124125
// @public
@@ -127,9 +128,6 @@ export interface ILaunchOptions {
127128
isManaged: boolean;
128129
}
129130

130-
// @beta
131-
export type IncrementalBuildDependencyGranularity = 'project' | 'repository';
132-
133131
// @beta
134132
export class IndividualVersionPolicy extends VersionPolicy {
135133
// Warning: (ae-forgotten-export) The symbol "IIndividualVersionJson" needs to be exported by the entry point index.d.ts
@@ -233,8 +231,6 @@ export class PnpmOptionsConfiguration {
233231
//
234232
// @internal
235233
constructor(json: IPnpmOptionsJson);
236-
// @beta
237-
readonly incrementalBuildDependencyGranularity: IncrementalBuildDependencyGranularity;
238234
readonly resolutionStrategy: ResolutionStrategy;
239235
readonly strictPeerDependencies: boolean;
240236
}

0 commit comments

Comments
 (0)