Skip to content

Commit 43cc464

Browse files
committed
Allowing the option to ignore dependencies when running bulk commands to allow running things like UT and Lint that don't require dependency order execution
1 parent 4637b27 commit 43cc464

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

apps/rush-lib/src/api/CommandLineJson.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface IBulkCommandJson extends IBaseCommandJson {
2222
commandKind: 'bulk';
2323
enableParallelism: boolean;
2424
ignoreMissingScript?: boolean;
25+
ignoreDependencies?: boolean;
2526
}
2627

2728
/**

apps/rush-lib/src/cli/scriptActions/BulkScriptAction.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { FileSystem } from '@microsoft/node-core-library';
2828
export interface IBulkScriptActionOptions extends IBaseScriptActionOptions {
2929
enableParallelism: boolean;
3030
ignoreMissingScript: boolean;
31+
ignoreDependencies?: boolean;
3132

3233
/**
3334
* Optional command to run. Otherwise, use the `actionName` as the command to run.
@@ -55,6 +56,7 @@ export class BulkScriptAction extends BaseScriptAction {
5556
private _toVersionPolicy: CommandLineStringListParameter;
5657
private _verboseParameter: CommandLineFlagParameter;
5758
private _parallelismParameter: CommandLineStringParameter | undefined;
59+
private _ignoreDependencies: boolean;
5860

5961
constructor(
6062
options: IBulkScriptActionOptions
@@ -63,6 +65,7 @@ export class BulkScriptAction extends BaseScriptAction {
6365
this._enableParallelism = options.enableParallelism;
6466
this._ignoreMissingScript = options.ignoreMissingScript;
6567
this._commandToRun = options.commandToRun || options.actionName;
68+
this._ignoreDependencies = !! options.ignoreDependencies;
6669
}
6770

6871
public run(): Promise<void> {
@@ -102,7 +105,8 @@ export class BulkScriptAction extends BaseScriptAction {
102105
parallelism,
103106
isIncrementalBuildAllowed: this.actionName === 'build',
104107
changedProjectsOnly,
105-
ignoreMissingScript: this._ignoreMissingScript
108+
ignoreMissingScript: this._ignoreMissingScript,
109+
ignoreDependencies: this._ignoreDependencies
106110
}
107111
);
108112

apps/rush-lib/src/logic/TaskSelector.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface ITaskSelectorConstructor {
2020
isIncrementalBuildAllowed: boolean;
2121
changedProjectsOnly: boolean;
2222
ignoreMissingScript: boolean;
23+
ignoreDependencies: boolean;
2324
}
2425

2526
/**
@@ -60,7 +61,7 @@ export class TaskSelector {
6061
this._registerFromFlags(this._options.fromFlags);
6162
}
6263
if (this._options.toFlags.length === 0 && this._options.fromFlags.length === 0) {
63-
this._registerAll();
64+
this._registerAll(this._options.ignoreDependencies);
6465
}
6566
}
6667

@@ -114,15 +115,17 @@ export class TaskSelector {
114115
}
115116
}
116117

117-
private _registerAll(): void {
118+
private _registerAll(addDependencies: boolean): void {
119+
console.log(addDependencies);
118120
// Register all tasks
119121
for (const rushProject of this._options.rushConfiguration.projects) {
120122
this._registerTask(rushProject);
121123
}
122-
123-
// Add all dependencies
124-
for (const projectName of Object.keys(this._rushLinkJson.localLinks)) {
125-
this._taskRunner.addDependencies(projectName, this._rushLinkJson.localLinks[projectName]);
124+
if (addDependencies) {
125+
// Add all dependencies
126+
for (const projectName of Object.keys(this._rushLinkJson.localLinks)) {
127+
this._taskRunner.addDependencies(projectName, this._rushLinkJson.localLinks[projectName]);
128+
}
126129
}
127130
}
128131

apps/rush-lib/src/schemas/command-line.schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@
7272
"title": "Ignore Missing Script",
7373
"description": "Normally Rush requires that each project's package.json has a \"scripts\" entry matching the custom command name. To disable this check, set \"ignoreMissingScript\" to true.",
7474
"type": "boolean"
75+
},
76+
"ignoreDependencies": {
77+
"title": "Ignore dependency relation between projects and just run everything in parallel",
78+
"description": "Ignore dependency relation between projects and just run everything in parallel",
79+
"type": "boolean"
7580
}
7681
}
7782
},
@@ -86,7 +91,8 @@
8691
"safeForSimultaneousRushProcesses": { "$ref": "#/definitions/anything" },
8792

8893
"enableParallelism": { "$ref": "#/definitions/anything" },
89-
"ignoreMissingScript": { "$ref": "#/definitions/anything" }
94+
"ignoreMissingScript": { "$ref": "#/definitions/anything" },
95+
"ignoreDependencies": { "$ref": "#/definitions/anything" }
9096
}
9197
}
9298
]

0 commit comments

Comments
 (0)