@rushstack/rush-sdk 5.101.0 → 5.102.0-pr3949.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rush-lib.d.ts +402 -8
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/api/CobuildConfiguration.d.ts +71 -0
- package/lib/api/CobuildConfiguration.js +1 -0
- package/lib/api/CustomTipsConfiguration.d.ts +89 -0
- package/lib/api/CustomTipsConfiguration.js +1 -0
- package/lib/api/EnvironmentConfiguration.d.ts +61 -0
- package/lib/api/ExperimentsConfiguration.d.ts +6 -0
- package/lib/api/RushConfiguration.d.ts +11 -0
- package/lib/cli/actions/BaseInstallAction.d.ts +2 -0
- package/lib/cli/actions/CheckAction.d.ts +1 -0
- package/lib/index.d.ts +4 -1
- package/lib/logic/RushConstants.d.ts +10 -0
- package/lib/logic/base/BaseInstallManagerTypes.d.ts +4 -0
- package/lib/logic/buildCache/ProjectBuildCache.d.ts +5 -4
- package/lib/logic/cobuild/CobuildLock.d.ts +43 -0
- package/lib/logic/cobuild/CobuildLock.js +1 -0
- package/lib/logic/cobuild/DisjointSet.d.ts +28 -0
- package/lib/logic/cobuild/DisjointSet.js +1 -0
- package/lib/logic/cobuild/ICobuildLockProvider.d.ts +99 -0
- package/lib/logic/cobuild/ICobuildLockProvider.js +1 -0
- package/lib/logic/operations/AsyncOperationQueue.d.ts +23 -4
- package/lib/logic/operations/CacheableOperationPlugin.d.ts +41 -0
- package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
- package/lib/logic/operations/IOperationExecutionResult.d.ts +4 -0
- package/lib/logic/operations/IOperationRunner.d.ts +21 -6
- package/lib/logic/operations/OperationExecutionManager.d.ts +6 -0
- package/lib/logic/operations/OperationExecutionRecord.d.ts +15 -1
- package/lib/logic/operations/OperationMetadataManager.d.ts +3 -1
- package/lib/logic/operations/OperationStateFile.d.ts +2 -0
- package/lib/logic/operations/OperationStatus.d.ts +8 -0
- package/lib/logic/operations/PeriodicCallback.d.ts +20 -0
- package/lib/logic/operations/PeriodicCallback.js +1 -0
- package/lib/logic/operations/ProjectLogWritable.d.ts +11 -0
- package/lib/logic/operations/ShellOperationRunner.d.ts +2 -26
- package/lib/logic/versionMismatch/VersionMismatchFinder.d.ts +3 -2
- package/lib/pluginFramework/PhasedCommandHooks.d.ts +24 -4
- package/lib/pluginFramework/RushSession.d.ts +11 -2
- package/lib/utilities/NullTerminalProvider.d.ts +10 -0
- package/lib/utilities/NullTerminalProvider.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ITerminal } from '@rushstack/node-core-library';
|
|
2
|
+
/**
|
|
3
|
+
* This interface represents the raw custom-tips.json file which allows repo maintainers
|
|
4
|
+
* to configure extra details to be printed alongside certain Rush messages.
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export interface ICustomTipsJson {
|
|
8
|
+
/**
|
|
9
|
+
* If specified, this prefix will be prepended to any the tip messages when they are displayed.
|
|
10
|
+
* The default value is an empty string.
|
|
11
|
+
*/
|
|
12
|
+
defaultMessagePrefix?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specifies the custom tips to be displayed by Rush.
|
|
15
|
+
*/
|
|
16
|
+
customTips?: ICustomTipItemJson[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An item from the {@link ICustomTipsJson.customTips} list.
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
export interface ICustomTipItemJson {
|
|
23
|
+
/**
|
|
24
|
+
* (REQUIRED) An identifier indicating a message that may be printed by Rush.
|
|
25
|
+
* If that message is printed, then this custom tip will be shown.
|
|
26
|
+
* Consult the Rush documentation for the current list of possible identifiers.
|
|
27
|
+
*/
|
|
28
|
+
tipId: CustomTipId;
|
|
29
|
+
/**
|
|
30
|
+
* (REQUIRED) The message text to be displayed for this tip.
|
|
31
|
+
*/
|
|
32
|
+
message: string;
|
|
33
|
+
/**
|
|
34
|
+
* Overrides the "defaultMessagePrefix" for this tip.
|
|
35
|
+
* Specify an empty string to omit the "defaultMessagePrefix" entirely.
|
|
36
|
+
*/
|
|
37
|
+
messagePrefix?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* An identifier representing a Rush message that can be customized by
|
|
41
|
+
* defining a custom tip in `common/config/rush/custom-tips.json`.
|
|
42
|
+
* @remarks
|
|
43
|
+
* Custom tip ids always start with the `TIP_` prefix.
|
|
44
|
+
*
|
|
45
|
+
* @privateRemarks
|
|
46
|
+
* Events from the Rush process should with "TIP_RUSH_".
|
|
47
|
+
* Events from a PNPM subprocess should start with "TIP_PNPM_".
|
|
48
|
+
*
|
|
49
|
+
* @beta
|
|
50
|
+
*/
|
|
51
|
+
export type CustomTipId = 'TIP_RUSH_INCONSISTENT_VERSIONS' | string;
|
|
52
|
+
/**
|
|
53
|
+
* Used to access the `common/config/rush/custom-tips.json` config file,
|
|
54
|
+
* which allows repo maintainers to configure extra details to be printed alongside
|
|
55
|
+
* certain Rush messages.
|
|
56
|
+
* @beta
|
|
57
|
+
*/
|
|
58
|
+
export declare class CustomTipsConfiguration {
|
|
59
|
+
private static _jsonSchema;
|
|
60
|
+
private readonly _tipMap;
|
|
61
|
+
private readonly _jsonFileName;
|
|
62
|
+
/**
|
|
63
|
+
* The JSON settings loaded from `custom-tips.json`.
|
|
64
|
+
*/
|
|
65
|
+
readonly configuration: Readonly<ICustomTipsJson>;
|
|
66
|
+
/**
|
|
67
|
+
* The list of identifiers that are allowed to be used in the "tipId" field
|
|
68
|
+
* of the config file.
|
|
69
|
+
*/
|
|
70
|
+
static readonly supportedTipIds: ReadonlySet<string>;
|
|
71
|
+
constructor(configFilename: string);
|
|
72
|
+
private _formatTipMessage;
|
|
73
|
+
/**
|
|
74
|
+
* If custom-tips.json defines a tip for the specified tipId,
|
|
75
|
+
* display the tip on the terminal.
|
|
76
|
+
*/
|
|
77
|
+
showInfoTip(terminal: ITerminal, tipId: CustomTipId): void;
|
|
78
|
+
/**
|
|
79
|
+
* If custom-tips.json defines a tip for the specified tipId,
|
|
80
|
+
* display the tip on the terminal.
|
|
81
|
+
*/
|
|
82
|
+
showWarningTip(terminal: ITerminal, tipId: CustomTipId): void;
|
|
83
|
+
/**
|
|
84
|
+
* If custom-tips.json defines a tip for the specified tipId,
|
|
85
|
+
* display the tip on the terminal.
|
|
86
|
+
*/
|
|
87
|
+
showErrorTip(terminal: ITerminal, tipId: CustomTipId): void;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=CustomTipsConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../lib-shim/index")._rushSdk_loadInternalModule("api/CustomTipsConfiguration");
|
|
@@ -120,6 +120,43 @@ export declare const EnvironmentVariableNames: {
|
|
|
120
120
|
* this environment variable is ignored.
|
|
121
121
|
*/
|
|
122
122
|
readonly RUSH_BUILD_CACHE_WRITE_ALLOWED: "RUSH_BUILD_CACHE_WRITE_ALLOWED";
|
|
123
|
+
/**
|
|
124
|
+
* Setting this environment variable overrides the value of `cobuildEnabled` in the `cobuild.json`
|
|
125
|
+
* configuration file.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* Specify `1` to enable the cobuild or `0` to disable it.
|
|
129
|
+
*
|
|
130
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
131
|
+
*/
|
|
132
|
+
readonly RUSH_COBUILD_ENABLED: "RUSH_COBUILD_ENABLED";
|
|
133
|
+
/**
|
|
134
|
+
* Setting this environment variable opts into running with cobuilds. The context id should be the same across
|
|
135
|
+
* multiple VMs, but changed when it is a new round of cobuilds.
|
|
136
|
+
*
|
|
137
|
+
* e.g. `Build.BuildNumber` in Azure DevOps Pipeline.
|
|
138
|
+
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
141
|
+
*/
|
|
142
|
+
readonly RUSH_COBUILD_CONTEXT_ID: "RUSH_COBUILD_CONTEXT_ID";
|
|
143
|
+
/**
|
|
144
|
+
* Explicitly specifies a name for each participating cobuild runner.
|
|
145
|
+
*
|
|
146
|
+
* Setting this environment variable opts into running with cobuilds.
|
|
147
|
+
*
|
|
148
|
+
* @remarks
|
|
149
|
+
* This environment variable is optional, if it is not provided, a random id is used.
|
|
150
|
+
*
|
|
151
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
152
|
+
*/
|
|
153
|
+
readonly RUSH_COBUILD_RUNNER_ID: "RUSH_COBUILD_RUNNER_ID";
|
|
154
|
+
/**
|
|
155
|
+
* If this variable is set to "1", When getting distributed builds, Rush will automatically handle the leaf project
|
|
156
|
+
* with build cache "disabled" by writing to the cache in a special "log files only mode". This is useful when you
|
|
157
|
+
* want to use Cobuilds to improve the performance in CI validations and the leaf projects have not enabled cache.
|
|
158
|
+
*/
|
|
159
|
+
readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED";
|
|
123
160
|
/**
|
|
124
161
|
* Explicitly specifies the path for the Git binary that is invoked by certain Rush operations.
|
|
125
162
|
*/
|
|
@@ -164,6 +201,10 @@ export declare class EnvironmentConfiguration {
|
|
|
164
201
|
private static _buildCacheCredential;
|
|
165
202
|
private static _buildCacheEnabled;
|
|
166
203
|
private static _buildCacheWriteAllowed;
|
|
204
|
+
private static _cobuildEnabled;
|
|
205
|
+
private static _cobuildContextId;
|
|
206
|
+
private static _cobuildRunnerId;
|
|
207
|
+
private static _cobuildLeafProjectLogOnlyAllowed;
|
|
167
208
|
private static _gitBinaryPath;
|
|
168
209
|
private static _tarBinaryPath;
|
|
169
210
|
/**
|
|
@@ -219,6 +260,26 @@ export declare class EnvironmentConfiguration {
|
|
|
219
260
|
* See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED}
|
|
220
261
|
*/
|
|
221
262
|
static get buildCacheWriteAllowed(): boolean | undefined;
|
|
263
|
+
/**
|
|
264
|
+
* If set, enables or disables the cobuild feature.
|
|
265
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_ENABLED}
|
|
266
|
+
*/
|
|
267
|
+
static get cobuildEnabled(): boolean | undefined;
|
|
268
|
+
/**
|
|
269
|
+
* Provides a determined cobuild context id if configured
|
|
270
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}
|
|
271
|
+
*/
|
|
272
|
+
static get cobuildContextId(): string | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Provides a determined cobuild runner id if configured
|
|
275
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_RUNNER_ID}
|
|
276
|
+
*/
|
|
277
|
+
static get cobuildRunnerId(): string | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* If set, enables or disables the cobuild leaf project log only feature.
|
|
280
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED}
|
|
281
|
+
*/
|
|
282
|
+
static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined;
|
|
222
283
|
/**
|
|
223
284
|
* Allows the git binary path to be explicitly provided.
|
|
224
285
|
* See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH}
|
|
@@ -14,6 +14,12 @@ export interface IExperimentsJson {
|
|
|
14
14
|
* Set this option to true to pass '--prefer-frozen-lockfile' instead.
|
|
15
15
|
*/
|
|
16
16
|
usePnpmPreferFrozenLockfileForRushUpdate?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* By default, 'rush update' runs as a single operation.
|
|
19
|
+
* Set this option to true to instead update the lockfile with `--lockfile-only`, then perform a `--frozen-lockfile` install.
|
|
20
|
+
* Necessary when using the `afterAllResolved` hook in .pnpmfile.cjs.
|
|
21
|
+
*/
|
|
22
|
+
usePnpmLockfileOnlyThenFrozenLockfileForRushUpdate?: boolean;
|
|
17
23
|
/**
|
|
18
24
|
* If using the 'preventManualShrinkwrapChanges' option, restricts the hash to only include the layout of external dependencies.
|
|
19
25
|
* Used to allow links between workspace projects or the addition/removal of references to existing dependency versions to not
|
|
@@ -13,6 +13,7 @@ import { IPnpmOptionsJson, PnpmOptionsConfiguration } from '../logic/pnpm/PnpmOp
|
|
|
13
13
|
import { INpmOptionsJson, NpmOptionsConfiguration } from '../logic/npm/NpmOptionsConfiguration';
|
|
14
14
|
import { IYarnOptionsJson, YarnOptionsConfiguration } from '../logic/yarn/YarnOptionsConfiguration';
|
|
15
15
|
import { PackageManagerOptionsConfigurationBase } from '../logic/base/BasePackageManagerOptionsConfiguration';
|
|
16
|
+
import { CustomTipsConfiguration } from './CustomTipsConfiguration';
|
|
16
17
|
/**
|
|
17
18
|
* Part of IRushConfigurationJson.
|
|
18
19
|
*/
|
|
@@ -413,6 +414,16 @@ export declare class RushConfiguration {
|
|
|
413
414
|
* @beta
|
|
414
415
|
*/
|
|
415
416
|
readonly versionPolicyConfigurationFilePath: string;
|
|
417
|
+
/**
|
|
418
|
+
* Accesses the custom-tips.json configuration.
|
|
419
|
+
* @beta
|
|
420
|
+
*/
|
|
421
|
+
readonly customTipsConfiguration: CustomTipsConfiguration;
|
|
422
|
+
/**
|
|
423
|
+
* The absolute path to the custom tips configuration file.
|
|
424
|
+
* @beta
|
|
425
|
+
*/
|
|
426
|
+
readonly customTipsConfigurationFilePath: string;
|
|
416
427
|
/**
|
|
417
428
|
* This configuration object contains settings repo maintainers have specified to enable
|
|
418
429
|
* and disable experimental Rush features.
|
|
@@ -2,10 +2,12 @@ import type { CommandLineFlagParameter, CommandLineIntegerParameter, CommandLine
|
|
|
2
2
|
import { BaseRushAction, IBaseRushActionOptions } from './BaseRushAction';
|
|
3
3
|
import type { IInstallManagerOptions } from '../../logic/base/BaseInstallManagerTypes';
|
|
4
4
|
import { SelectionParameterSet } from '../parsing/SelectionParameterSet';
|
|
5
|
+
import { ITerminal } from '@rushstack/node-core-library';
|
|
5
6
|
/**
|
|
6
7
|
* This is the common base class for InstallAction and UpdateAction.
|
|
7
8
|
*/
|
|
8
9
|
export declare abstract class BaseInstallAction extends BaseRushAction {
|
|
10
|
+
protected readonly _terminal: ITerminal;
|
|
9
11
|
protected readonly _variant: CommandLineStringParameter;
|
|
10
12
|
protected readonly _purgeParameter: CommandLineFlagParameter;
|
|
11
13
|
protected readonly _bypassPolicyParameter: CommandLineFlagParameter;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RushCommandLineParser } from '../RushCommandLineParser';
|
|
2
2
|
import { BaseRushAction } from './BaseRushAction';
|
|
3
3
|
export declare class CheckAction extends BaseRushAction {
|
|
4
|
+
private readonly _terminal;
|
|
4
5
|
private readonly _variant;
|
|
5
6
|
private readonly _jsonFlag;
|
|
6
7
|
private readonly _verboseFlag;
|
package/lib/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { INpmOptionsJson as _INpmOptionsJson, NpmOptionsConfiguration } from './
|
|
|
9
9
|
export { IYarnOptionsJson as _IYarnOptionsJson, YarnOptionsConfiguration } from './logic/yarn/YarnOptionsConfiguration';
|
|
10
10
|
export { IPnpmOptionsJson as _IPnpmOptionsJson, PnpmStoreOptions, PnpmOptionsConfiguration } from './logic/pnpm/PnpmOptionsConfiguration';
|
|
11
11
|
export { BuildCacheConfiguration } from './api/BuildCacheConfiguration';
|
|
12
|
+
export { CobuildConfiguration, ICobuildJson } from './api/CobuildConfiguration';
|
|
12
13
|
export { GetCacheEntryIdFunction, IGenerateCacheEntryIdOptions } from './logic/buildCache/CacheEntryId';
|
|
13
14
|
export { FileSystemBuildCacheProvider, IFileSystemBuildCacheProviderOptions } from './logic/buildCache/FileSystemBuildCacheProvider';
|
|
14
15
|
export { IPhase, PhaseBehaviorForMissingScript as IPhaseBehaviorForMissingScript } from './api/CommandLineConfiguration';
|
|
@@ -31,12 +32,13 @@ export { VersionPolicyConfiguration } from './api/VersionPolicyConfiguration';
|
|
|
31
32
|
export { ILaunchOptions, Rush } from './api/Rush';
|
|
32
33
|
export { RushInternals as _RushInternals } from './api/RushInternals';
|
|
33
34
|
export { ExperimentsConfiguration, IExperimentsJson } from './api/ExperimentsConfiguration';
|
|
35
|
+
export { CustomTipsConfiguration, CustomTipId, ICustomTipsJson, ICustomTipItemJson } from './api/CustomTipsConfiguration';
|
|
34
36
|
export { ProjectChangeAnalyzer, IGetChangedProjectsOptions } from './logic/ProjectChangeAnalyzer';
|
|
35
37
|
export { IOperationRunner, IOperationRunnerContext } from './logic/operations/IOperationRunner';
|
|
36
38
|
export { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
|
|
37
39
|
export { IOperationOptions, Operation } from './logic/operations/Operation';
|
|
38
40
|
export { OperationStatus } from './logic/operations/OperationStatus';
|
|
39
|
-
export { RushSession, IRushSessionOptions, CloudBuildCacheProviderFactory } from './pluginFramework/RushSession';
|
|
41
|
+
export { RushSession, IRushSessionOptions, CloudBuildCacheProviderFactory, CobuildLockProviderFactory } from './pluginFramework/RushSession';
|
|
40
42
|
export { IRushCommand, IGlobalCommand, IPhasedCommand, RushLifecycleHooks } from './pluginFramework/RushLifeCycle';
|
|
41
43
|
export { ICreateOperationsContext, PhasedCommandHooks } from './pluginFramework/PhasedCommandHooks';
|
|
42
44
|
export { IRushPlugin } from './pluginFramework/IRushPlugin';
|
|
@@ -44,6 +46,7 @@ export { IBuiltInPluginConfiguration as _IBuiltInPluginConfiguration } from './p
|
|
|
44
46
|
export { IRushPluginConfigurationBase as _IRushPluginConfigurationBase } from './api/RushPluginsConfiguration';
|
|
45
47
|
export { ILogger } from './pluginFramework/logging/Logger';
|
|
46
48
|
export { ICloudBuildCacheProvider } from './logic/buildCache/ICloudBuildCacheProvider';
|
|
49
|
+
export { ICobuildLockProvider, ICobuildContext, ICobuildCompletedState } from './logic/cobuild/ICobuildLockProvider';
|
|
47
50
|
export { ICredentialCacheOptions, ICredentialCacheEntry, CredentialCache } from './logic/CredentialCache';
|
|
48
51
|
export type { ITelemetryData, ITelemetryMachineInfo, ITelemetryOperationResult } from './logic/Telemetry';
|
|
49
52
|
export { IStopwatchResult } from './utilities/Stopwatch';
|
|
@@ -108,6 +108,12 @@ export declare class RushConstants {
|
|
|
108
108
|
* store the state of various features as they stand in the repo.
|
|
109
109
|
*/
|
|
110
110
|
static readonly repoStateFilename: string;
|
|
111
|
+
/**
|
|
112
|
+
* The filename ("custom-tips.json") for the file used by Rush to
|
|
113
|
+
* print user-customized messages.
|
|
114
|
+
* This configuration file should go in the "common/config/rush" folder.
|
|
115
|
+
*/
|
|
116
|
+
static readonly customTipsFilename: string;
|
|
111
117
|
/**
|
|
112
118
|
* The name of the per-project folder where project-specific Rush files are stored. For example,
|
|
113
119
|
* the package-deps files, which are used by commands to determine if a particular project needs to be rebuilt.
|
|
@@ -148,6 +154,10 @@ export declare class RushConstants {
|
|
|
148
154
|
* Changing this ensures that cache entries generated by an old version will no longer register as a cache hit.
|
|
149
155
|
*/
|
|
150
156
|
static readonly buildCacheVersion: number;
|
|
157
|
+
/**
|
|
158
|
+
* Cobuild configuration file.
|
|
159
|
+
*/
|
|
160
|
+
static readonly cobuildFilename: string;
|
|
151
161
|
/**
|
|
152
162
|
* Per-project configuration filename.
|
|
153
163
|
*/
|
|
@@ -29,6 +29,10 @@ export interface IInstallManagerOptions {
|
|
|
29
29
|
* will be upgraded to the latest SemVer-compatible version.
|
|
30
30
|
*/
|
|
31
31
|
fullUpgrade: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* If set, only update the shrinkwrap file; do not create node_modules.
|
|
34
|
+
*/
|
|
35
|
+
onlyShrinkwrap?: boolean;
|
|
32
36
|
/**
|
|
33
37
|
* Whether to force an update to the shrinkwrap file even if it appears to be unnecessary.
|
|
34
38
|
* Normally Rush uses heuristics to determine when "pnpm install" can be skipped,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ITerminal } from '@rushstack/node-core-library';
|
|
2
|
+
import { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
2
3
|
import { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
|
|
3
|
-
import { RushProjectConfiguration } from '../../api/RushProjectConfiguration';
|
|
4
4
|
import { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
|
|
5
5
|
export interface IProjectBuildCacheOptions {
|
|
6
6
|
buildCacheConfiguration: BuildCacheConfiguration;
|
|
7
|
-
|
|
7
|
+
project: RushConfigurationProject;
|
|
8
8
|
projectOutputFolderNames: ReadonlyArray<string>;
|
|
9
9
|
additionalProjectOutputFilePaths?: ReadonlyArray<string>;
|
|
10
10
|
additionalContext?: Record<string, string>;
|
|
@@ -30,10 +30,11 @@ export declare class ProjectBuildCache {
|
|
|
30
30
|
private _cacheId;
|
|
31
31
|
private constructor();
|
|
32
32
|
private static _tryGetTarUtility;
|
|
33
|
+
get cacheId(): string | undefined;
|
|
33
34
|
static tryGetProjectBuildCache(options: IProjectBuildCacheOptions): Promise<ProjectBuildCache | undefined>;
|
|
34
35
|
private static _validateProject;
|
|
35
|
-
tryRestoreFromCacheAsync(terminal: ITerminal): Promise<boolean>;
|
|
36
|
-
trySetCacheEntryAsync(terminal: ITerminal): Promise<boolean>;
|
|
36
|
+
tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
|
|
37
|
+
trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
|
|
37
38
|
/**
|
|
38
39
|
* Walks the declared output folders of the project and collects a list of files.
|
|
39
40
|
* @returns The list of output files as project-relative paths, or `undefined` if a
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CobuildConfiguration } from '../../api/CobuildConfiguration';
|
|
2
|
+
import type { OperationStatus } from '../operations/OperationStatus';
|
|
3
|
+
import type { ICobuildContext } from './ICobuildLockProvider';
|
|
4
|
+
import type { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
|
|
5
|
+
export interface ICobuildLockOptions {
|
|
6
|
+
/**
|
|
7
|
+
* {@inheritdoc CobuildConfiguration}
|
|
8
|
+
*/
|
|
9
|
+
cobuildConfiguration: CobuildConfiguration;
|
|
10
|
+
/**
|
|
11
|
+
* {@inheritdoc ICobuildContext.clusterId}
|
|
12
|
+
*/
|
|
13
|
+
cobuildClusterId: string;
|
|
14
|
+
/**
|
|
15
|
+
* {@inheritdoc ICobuildContext.packageName}
|
|
16
|
+
*/
|
|
17
|
+
packageName: string;
|
|
18
|
+
/**
|
|
19
|
+
* {@inheritdoc ICobuildContext.phaseName}
|
|
20
|
+
*/
|
|
21
|
+
phaseName: string;
|
|
22
|
+
projectBuildCache: ProjectBuildCache;
|
|
23
|
+
/**
|
|
24
|
+
* The expire time of the lock in seconds.
|
|
25
|
+
*/
|
|
26
|
+
lockExpireTimeInSeconds: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ICobuildCompletedState {
|
|
29
|
+
status: OperationStatus.Success | OperationStatus.SuccessWithWarning | OperationStatus.Failure;
|
|
30
|
+
cacheId: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class CobuildLock {
|
|
33
|
+
readonly cobuildConfiguration: CobuildConfiguration;
|
|
34
|
+
readonly projectBuildCache: ProjectBuildCache;
|
|
35
|
+
private _cobuildContext;
|
|
36
|
+
constructor(options: ICobuildLockOptions);
|
|
37
|
+
setCompletedStateAsync(state: ICobuildCompletedState): Promise<void>;
|
|
38
|
+
getCompletedStateAsync(): Promise<ICobuildCompletedState | undefined>;
|
|
39
|
+
tryAcquireLockAsync(): Promise<boolean>;
|
|
40
|
+
renewLockAsync(): Promise<void>;
|
|
41
|
+
get cobuildContext(): ICobuildContext;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=CobuildLock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/cobuild/CobuildLock");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A disjoint set data structure
|
|
3
|
+
*/
|
|
4
|
+
export declare class DisjointSet<T extends object> {
|
|
5
|
+
private _forest;
|
|
6
|
+
private _parentMap;
|
|
7
|
+
private _sizeMap;
|
|
8
|
+
private _setByElement;
|
|
9
|
+
constructor();
|
|
10
|
+
destroy(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Adds a new set containing specific object
|
|
13
|
+
*/
|
|
14
|
+
add(x: T): void;
|
|
15
|
+
/**
|
|
16
|
+
* Unions the sets that contain two objects
|
|
17
|
+
*/
|
|
18
|
+
union(a: T, b: T): void;
|
|
19
|
+
getAllSets(): Iterable<Set<T>>;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if x and y are in the same set
|
|
22
|
+
*/
|
|
23
|
+
isConnected(x: T, y: T): boolean;
|
|
24
|
+
private _find;
|
|
25
|
+
private _getParent;
|
|
26
|
+
private _getSize;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=DisjointSet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/cobuild/DisjointSet");
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { OperationStatus } from '../operations/OperationStatus';
|
|
2
|
+
/**
|
|
3
|
+
* @beta
|
|
4
|
+
*/
|
|
5
|
+
export interface ICobuildContext {
|
|
6
|
+
/**
|
|
7
|
+
* The key for acquiring lock.
|
|
8
|
+
*/
|
|
9
|
+
lockKey: string;
|
|
10
|
+
/**
|
|
11
|
+
* The expire time of the lock in seconds.
|
|
12
|
+
*/
|
|
13
|
+
lockExpireTimeInSeconds: number;
|
|
14
|
+
/**
|
|
15
|
+
* The key for storing completed state.
|
|
16
|
+
*/
|
|
17
|
+
completedStateKey: string;
|
|
18
|
+
/**
|
|
19
|
+
* The contextId is provided by the monorepo maintainer, it reads from environment variable {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}.
|
|
20
|
+
* It ensure only the builds from the same given contextId cooperated.
|
|
21
|
+
*/
|
|
22
|
+
contextId: string;
|
|
23
|
+
/**
|
|
24
|
+
* The id of the cluster. The operations in the same cluster share the same clusterId and
|
|
25
|
+
* will be executed on the same machine.
|
|
26
|
+
*/
|
|
27
|
+
clusterId: string;
|
|
28
|
+
/**
|
|
29
|
+
* The id of the runner. The identifier for the running machine.
|
|
30
|
+
*
|
|
31
|
+
* It can be specified via assigning `RUSH_COBUILD_RUNNER_ID` environment variable.
|
|
32
|
+
*/
|
|
33
|
+
runnerId: string;
|
|
34
|
+
/**
|
|
35
|
+
* The id of the cache entry. It should be kept the same as the normal cacheId from ProjectBuildCache.
|
|
36
|
+
* Otherwise, there is a discrepancy in the success case wherein turning on cobuilds will
|
|
37
|
+
* fail to populate the normal build cache.
|
|
38
|
+
*/
|
|
39
|
+
cacheId: string;
|
|
40
|
+
/**
|
|
41
|
+
* The name of NPM package
|
|
42
|
+
*
|
|
43
|
+
* Example: `@scope/MyProject`
|
|
44
|
+
*/
|
|
45
|
+
packageName: string;
|
|
46
|
+
/**
|
|
47
|
+
* The name of the phase.
|
|
48
|
+
*
|
|
49
|
+
* Example: _phase:build
|
|
50
|
+
*/
|
|
51
|
+
phaseName: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
export interface ICobuildCompletedState {
|
|
57
|
+
status: OperationStatus.Success | OperationStatus.SuccessWithWarning | OperationStatus.Failure;
|
|
58
|
+
/**
|
|
59
|
+
* Completed state points to the cache id that was used to store the build cache.
|
|
60
|
+
* Note: Cache failed builds in a separate cache id
|
|
61
|
+
*/
|
|
62
|
+
cacheId: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @beta
|
|
66
|
+
*/
|
|
67
|
+
export interface ICobuildLockProvider {
|
|
68
|
+
/**
|
|
69
|
+
* The callback function invoked to connect to the lock provider.
|
|
70
|
+
* For example, initializing the connection to the redis server.
|
|
71
|
+
*/
|
|
72
|
+
connectAsync(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* The callback function invoked to disconnect the lock provider.
|
|
75
|
+
*/
|
|
76
|
+
disconnectAsync(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* The callback function to acquire a lock with a lock key and specific contexts.
|
|
79
|
+
*
|
|
80
|
+
* NOTE: This lock implementation must be a ReentrantLock. It says the lock might be acquired
|
|
81
|
+
* multiple times, since tasks in the same cluster can be run in the same VM.
|
|
82
|
+
*/
|
|
83
|
+
acquireLockAsync(context: Readonly<ICobuildContext>): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* The callback function to renew a lock with a lock key and specific contexts.
|
|
86
|
+
*
|
|
87
|
+
* NOTE: If the lock key expired
|
|
88
|
+
*/
|
|
89
|
+
renewLockAsync(context: Readonly<ICobuildContext>): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* The callback function to set completed state.
|
|
92
|
+
*/
|
|
93
|
+
setCompletedStateAsync(context: Readonly<ICobuildContext>, state: ICobuildCompletedState): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* The callback function to get completed state.
|
|
96
|
+
*/
|
|
97
|
+
getCompletedStateAsync(context: Readonly<ICobuildContext>): Promise<ICobuildCompletedState | undefined>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=ICobuildLockProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/cobuild/ICobuildLockProvider");
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { OperationExecutionRecord } from './OperationExecutionRecord';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* When the queue returns an unassigned operation, it means there is at least one remote executing operation,
|
|
4
|
+
* at this time, the caller has a chance to make a decision:
|
|
5
|
+
* 1. Manually invoke `tryGetRemoteExecutingOperation()` to get the remote executing operation.
|
|
6
|
+
* 2. If there is no remote executing operation available, wait for some time and return in callback, which
|
|
7
|
+
* internally invoke `assignOperations()` to assign new operations.
|
|
8
|
+
* NOTE: the caller must wait for some time to avoid busy loop and burn CPU cycles.
|
|
9
|
+
*/
|
|
10
|
+
export declare const UNASSIGNED_OPERATION: 'UNASSIGNED_OPERATION';
|
|
11
|
+
export type IOperationIteratorResult = OperationExecutionRecord | typeof UNASSIGNED_OPERATION;
|
|
12
|
+
/**
|
|
13
|
+
* Implementation of the async iteration protocol for a collection of IOperation objects.
|
|
4
14
|
* The async iterator will wait for an operation to be ready for execution, or terminate if there are no more operations.
|
|
5
15
|
*
|
|
6
16
|
* @remarks
|
|
@@ -8,9 +18,12 @@ import { OperationExecutionRecord } from './OperationExecutionRecord';
|
|
|
8
18
|
* it must manually invoke `assignOperations()` after performing the updates, otherwise iterators will
|
|
9
19
|
* stall until another operations completes.
|
|
10
20
|
*/
|
|
11
|
-
export declare class AsyncOperationQueue implements AsyncIterable<
|
|
21
|
+
export declare class AsyncOperationQueue implements AsyncIterable<IOperationIteratorResult>, AsyncIterator<IOperationIteratorResult> {
|
|
12
22
|
private readonly _queue;
|
|
13
23
|
private readonly _pendingIterators;
|
|
24
|
+
private readonly _totalOperations;
|
|
25
|
+
private readonly _completedOperations;
|
|
26
|
+
private _isDone;
|
|
14
27
|
/**
|
|
15
28
|
* @param operations - The set of operations to be executed
|
|
16
29
|
* @param sortFn - A function that sorts operations in reverse priority order:
|
|
@@ -23,17 +36,23 @@ export declare class AsyncOperationQueue implements AsyncIterable<OperationExecu
|
|
|
23
36
|
* For use with `for await (const operation of taskQueue)`
|
|
24
37
|
* @see {AsyncIterator}
|
|
25
38
|
*/
|
|
26
|
-
next(): Promise<IteratorResult<
|
|
39
|
+
next(): Promise<IteratorResult<IOperationIteratorResult>>;
|
|
40
|
+
/**
|
|
41
|
+
* Set a callback to be invoked when one operation is completed.
|
|
42
|
+
* If all operations are completed, set the queue to done, resolve all pending iterators in next cycle.
|
|
43
|
+
*/
|
|
44
|
+
complete(record: OperationExecutionRecord): void;
|
|
27
45
|
/**
|
|
28
46
|
* Routes ready operations with 0 dependencies to waiting iterators. Normally invoked as part of `next()`, but
|
|
29
47
|
* if the caller does not update operation dependencies prior to calling `next()`, may need to be invoked manually.
|
|
30
48
|
*/
|
|
31
49
|
assignOperations(): void;
|
|
50
|
+
tryGetRemoteExecutingOperation(): OperationExecutionRecord | undefined;
|
|
32
51
|
/**
|
|
33
52
|
* Returns this queue as an async iterator, such that multiple functions iterating this object concurrently
|
|
34
53
|
* receive distinct iteration results.
|
|
35
54
|
*/
|
|
36
|
-
[Symbol.asyncIterator](): AsyncIterator<
|
|
55
|
+
[Symbol.asyncIterator](): AsyncIterator<IOperationIteratorResult>;
|
|
37
56
|
}
|
|
38
57
|
export interface IOperationSortFunction {
|
|
39
58
|
/**
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ITerminal } from '@rushstack/node-core-library';
|
|
2
|
+
import { CobuildLock } from '../cobuild/CobuildLock';
|
|
3
|
+
import { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
|
|
4
|
+
import { ProjectLogWritable } from './ProjectLogWritable';
|
|
5
|
+
import { PeriodicCallback } from './PeriodicCallback';
|
|
6
|
+
import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
|
|
7
|
+
export interface IProjectDeps {
|
|
8
|
+
files: {
|
|
9
|
+
[filePath: string]: string;
|
|
10
|
+
};
|
|
11
|
+
arguments: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IOperationBuildCacheContext {
|
|
14
|
+
isCacheWriteAllowed: boolean;
|
|
15
|
+
isCacheReadAllowed: boolean;
|
|
16
|
+
isSkipAllowed: boolean;
|
|
17
|
+
projectBuildCache: ProjectBuildCache | undefined;
|
|
18
|
+
cobuildLock: CobuildLock | undefined;
|
|
19
|
+
cobuildClusterId: string | undefined;
|
|
20
|
+
buildCacheTerminal: ITerminal | undefined;
|
|
21
|
+
buildCacheProjectLogWritable: ProjectLogWritable | undefined;
|
|
22
|
+
periodicCallback: PeriodicCallback;
|
|
23
|
+
projectDeps: IProjectDeps | undefined;
|
|
24
|
+
currentDepsPath: string | undefined;
|
|
25
|
+
cacheRestored: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class CacheableOperationPlugin implements IPhasedCommandPlugin {
|
|
28
|
+
private _buildCacheContextByOperationExecutionRecord;
|
|
29
|
+
private _createContext;
|
|
30
|
+
apply(hooks: PhasedCommandHooks): void;
|
|
31
|
+
private _getBuildCacheContextByOperationExecutionRecord;
|
|
32
|
+
private _getBuildCacheContextByOperationExecutionRecordOrThrow;
|
|
33
|
+
private _tryGetProjectBuildCacheEnabledAsync;
|
|
34
|
+
private _tryGetProjectBuildCacheAsync;
|
|
35
|
+
private _tryGetLogOnlyProjectBuildCacheAsync;
|
|
36
|
+
private _tryGetCobuildLockAsync;
|
|
37
|
+
private _getBuildCacheTerminal;
|
|
38
|
+
private _createBuildCacheTerminal;
|
|
39
|
+
private _tryGetBuildCacheProjectLogWritable;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=CacheableOperationPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/CacheableOperationPlugin");
|
|
@@ -31,6 +31,10 @@ export interface IOperationExecutionResult {
|
|
|
31
31
|
* The value indicates the duration of the same operation without cache hit.
|
|
32
32
|
*/
|
|
33
33
|
readonly nonCachedDurationMs: number | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The id of the runner which actually runs the building process in cobuild mode.
|
|
36
|
+
*/
|
|
37
|
+
readonly cobuildRunnerId: string | undefined;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* The `IExecutionResult` interface represents the results of executing a set of {@link Operation}s.
|