Skip to content

Commit 6fe7f88

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into pgonzal/ae-trimming-5
2 parents 9d9328c + 0d9674e commit 6fe7f88

16 files changed

Lines changed: 181 additions & 47 deletions

File tree

‎apps/api-extractor/src/api/ApiItem.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,3 @@ export type ApiMember = IApiProperty | IApiMethod | IApiConstructor;
401401
*/
402402
export type ApiItem = IApiProperty | ApiMember | IApiFunction | IApiConstructor |
403403
IApiClass | IApiEnum | IApiEnumMember | IApiInterface | IApiNamespace | IApiPackage;
404-
405-
/**
406-
* Describes a return type and description of the return type
407-
* that is given in documentation comments.
408-
*
409-
* @alpha
410-
*/
411-
export interface IApiReturnValue {
412-
type: string;
413-
description: MarkupBasicElement[];
414-
}

‎apps/api-extractor/src/generators/packageTypings/AstDeclaration.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export class AstDeclaration {
9494
throw new Error('Program Bug: Invalid call to notifyChildAttach()');
9595
}
9696

97+
if (this.astSymbol.analyzed) {
98+
throw new Error('Program Bug: _notifyChildAttach() called after analysis is already complete');
99+
}
100+
97101
this._analyzedChildren.push(child);
98102
}
99103

‎apps/api-extractor/src/generators/packageTypings/AstSymbol.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ export class AstSymbol {
7676

7777
private readonly _astDeclarations: AstDeclaration[];
7878

79+
// This flag is unused if this is not the root symbol.
80+
// Being "analyzed" is a property of the root symbol.
7981
private _analyzed: boolean = false;
8082

8183
public constructor(parameters: IAstSymbolParameters) {
@@ -101,9 +103,12 @@ export class AstSymbol {
101103
/**
102104
* Returns true if the AstSymbolTable.analyze() was called for this object.
103105
* See that function for details.
106+
* @remarks
107+
* AstSymbolTable.analyze() is always performed on the root AstSymbol. This function
108+
* returns true if-and-only-if the root symbol was analyzed.
104109
*/
105110
public get analyzed(): boolean {
106-
return this._analyzed;
111+
return this.rootAstSymbol._analyzed;
107112
}
108113

109114
/**
@@ -119,6 +124,9 @@ export class AstSymbol {
119124
* @internal
120125
*/
121126
public _notifyDeclarationAttach(astDeclaration: AstDeclaration): void {
127+
if (this.analyzed) {
128+
throw new Error('Program Bug: _notifyDeclarationAttach() called after analysis is already complete');
129+
}
122130
this._astDeclarations.push(astDeclaration);
123131
}
124132

@@ -128,6 +136,9 @@ export class AstSymbol {
128136
* @internal
129137
*/
130138
public _notifyAnalyzed(): void {
139+
if (this.rootAstSymbol !== this) {
140+
throw new Error('Program Bug: _notifyAnalyzed() called for an AstSymbol which is not the root');
141+
}
131142
this._analyzed = true;
132143
}
133144

‎apps/api-extractor/src/generators/packageTypings/AstSymbolTable.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class AstSymbolTable {
139139
this._analyzeChildTree(astDeclaration.declaration, astDeclaration);
140140
}
141141

142-
astSymbol._notifyAnalyzed();
142+
rootAstSymbol._notifyAnalyzed();
143143

144144
if (!astSymbol.astImport) {
145145
// If this symbol is not imported, then we also analyze any referencedAstSymbols
@@ -224,10 +224,6 @@ export class AstSymbolTable {
224224
for (const childNode of node.getChildren()) {
225225
this._analyzeChildTree(childNode, newGoverningAstDeclaration || governingAstDeclaration);
226226
}
227-
228-
if (newGoverningAstDeclaration) {
229-
newGoverningAstDeclaration.astSymbol._notifyAnalyzed();
230-
}
231227
}
232228

233229
// tslint:disable-next-line:no-unused-variable

‎apps/rush-lib/src/cli/actions/CustomRushAction.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616

1717
import {
1818
CommandLineFlagParameter,
19-
CommandLineIntegerParameter,
19+
CommandLineStringParameter,
2020
CommandLineStringListParameter,
2121
CommandLineOptionParameter,
2222
ICommandLineActionOptions
@@ -39,7 +39,7 @@ export class CustomRushAction extends BaseRushAction {
3939
private _fromFlag: CommandLineStringListParameter;
4040
private _toFlag: CommandLineStringListParameter;
4141
private _verboseParameter: CommandLineFlagParameter;
42-
private _parallelismParameter: CommandLineIntegerParameter | undefined;
42+
private _parallelismParameter: CommandLineStringParameter | undefined;
4343

4444
constructor(private _parser: RushCommandLineParser,
4545
options: ICommandLineActionOptions,
@@ -75,9 +75,9 @@ export class CustomRushAction extends BaseRushAction {
7575

7676
// if this is parallizable, then use the value from the flag (undefined or a number),
7777
// if this is not parallelized, then use 1 core
78-
const parallelism: number | undefined = this._isParallelized()
78+
const parallelism: string | undefined = this._isParallelized()
7979
? this._parallelismParameter!.value
80-
: 1;
80+
: '1';
8181

8282
// collect all custom flags here
8383
const customFlags: string[] = [];
@@ -127,12 +127,13 @@ export class CustomRushAction extends BaseRushAction {
127127

128128
protected onDefineParameters(): void {
129129
if (this._isParallelized()) {
130-
this._parallelismParameter = this.defineIntegerParameter({
130+
this._parallelismParameter = this.defineStringParameter({
131131
parameterLongName: '--parallelism',
132132
parameterShortName: '-p',
133133
key: 'COUNT',
134-
description: 'Specify the number of concurrent build processes.'
135-
+ ' If omitted, the parallelism will be based on the number of CPU cores.'
134+
description: 'Specify the number of concurrent build processes'
135+
+ ' The value "max" can be specified to indicate the number of CPU cores.'
136+
+ ' If this parameter omitted, the default value depends on the operating system and number of CPU cores.'
136137
});
137138
}
138139
this._toFlag = this.defineStringListParameter({

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface ITaskSelectorConstructor {
1515
commandToRun: string;
1616
customFlags: string[];
1717
isQuietMode: boolean;
18-
parallelism: number;
18+
parallelism: string;
1919
isIncrementalBuildAllowed: boolean;
2020
changedProjectsOnly: boolean;
2121
}

‎apps/rush-lib/src/cli/taskRunner/TaskRunner.ts‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,36 @@ export default class TaskRunner {
3131
private _completedTasks: number;
3232

3333
constructor(quietMode: boolean,
34-
parallelism: number | undefined,
34+
parallelism: string |undefined,
3535
changedProjectsOnly: boolean) {
3636
this._tasks = new Map<string, ITask>();
3737
this._buildQueue = [];
3838
this._quietMode = quietMode;
3939
this._hasAnyFailures = false;
4040
this._changedProjectsOnly = changedProjectsOnly;
4141

42+
const numberOfCores: number = os.cpus().length;
43+
4244
if (parallelism) {
43-
this._parallelism = parallelism;
44-
} else {
45+
if (parallelism === 'max') {
46+
this._parallelism = numberOfCores;
47+
} else {
48+
const parallelismInt: number = parseInt(parallelism, 10);
49+
50+
if (isNaN(parallelismInt)) {
51+
throw new Error(`Invalid parallelism value of '${parallelism}', expected a number or 'max'`);
52+
}
53+
54+
this._parallelism = parallelismInt;
55+
}
56+
57+
} else {
4558
// If an explicit parallelism number wasn't provided, then choose a sensible
4659
// default.
47-
const numberOfCores: number = os.cpus().length;
48-
4960
if (os.platform() === 'win32') {
5061
// On desktop Windows, some people have complained that their system becomes
5162
// sluggish if Rush is using all the CPU cores. Leave one thread for
52-
// other operations.
63+
// other operations. For CI environments, you can use the "max" argument to use all available cores.
5364
this._parallelism = Math.max(numberOfCores - 1, 1);
5465
} else {
5566
// Unix-like operating systems have more balanced scheduling, so default

‎build-tests/api-extractor-test-01/dist/index-internal.d.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,40 @@ export declare interface IInterfaceAsDefaultExport {
172172
member: string;
173173
}
174174

175+
/**
176+
* IMergedInterface instance 1.
177+
* @alpha
178+
*/
179+
export declare interface IMergedInterface {
180+
type: string;
181+
reference: IMergedInterfaceReferencee;
182+
}
183+
184+
/**
185+
* IMergedInterface instance 2.
186+
* @alpha
187+
*/
188+
export declare interface IMergedInterface {
189+
type: string;
190+
reference: IMergedInterfaceReferencee;
191+
}
192+
193+
/**
194+
* @alpha
195+
*/
196+
export declare interface IMergedInterfaceReferencee {
197+
}
198+
199+
/**
200+
* api-extractor-test-01
201+
*
202+
* @remarks
203+
* This library is consumed by api-extractor-test-02 and api-extractor-test-03.
204+
* It tests the basic types of definitions, and all the weird cases for following
205+
* chains of type aliases.
206+
*
207+
* @packagedocumentation
208+
*/
175209
/**
176210
* A simple, normal definition
177211
* @public

‎build-tests/api-extractor-test-01/dist/index-preview.d.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ export declare interface IInterfaceAsDefaultExport {
172172
member: string;
173173
}
174174

175+
// Removed for this release type: IMergedInterface
176+
177+
// Removed for this release type: IMergedInterfaceReferencee
178+
179+
/**
180+
* api-extractor-test-01
181+
*
182+
* @remarks
183+
* This library is consumed by api-extractor-test-02 and api-extractor-test-03.
184+
* It tests the basic types of definitions, and all the weird cases for following
185+
* chains of type aliases.
186+
*
187+
* @packagedocumentation
188+
*/
175189
/**
176190
* A simple, normal definition
177191
* @public

‎build-tests/api-extractor-test-01/dist/index-public.d.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,20 @@ export declare interface IInterfaceAsDefaultExport {
165165
member: string;
166166
}
167167

168+
// Removed for this release type: IMergedInterface
169+
170+
// Removed for this release type: IMergedInterfaceReferencee
171+
172+
/**
173+
* api-extractor-test-01
174+
*
175+
* @remarks
176+
* This library is consumed by api-extractor-test-02 and api-extractor-test-03.
177+
* It tests the basic types of definitions, and all the weird cases for following
178+
* chains of type aliases.
179+
*
180+
* @packagedocumentation
181+
*/
168182
/**
169183
* A simple, normal definition
170184
* @public

0 commit comments

Comments
 (0)