@rushstack/rush-sdk 5.103.0 → 5.104.1
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 +419 -10
- package/lib/api/CobuildConfiguration.d.ts +71 -0
- package/lib/api/CobuildConfiguration.js +1 -0
- package/lib/api/EnvironmentConfiguration.d.ts +45 -0
- package/lib/api/RushProjectConfiguration.d.ts +19 -5
- package/lib/index.d.ts +5 -2
- package/lib/logic/RushConstants.d.ts +4 -0
- package/lib/logic/buildCache/ProjectBuildCache.d.ts +6 -7
- 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 +51 -0
- package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
- package/lib/logic/operations/IOperationExecutionResult.d.ts +9 -1
- package/lib/logic/operations/IOperationRunner.d.ts +25 -6
- package/lib/logic/operations/LegacySkipPlugin.d.ts +22 -0
- package/lib/logic/operations/LegacySkipPlugin.js +1 -0
- package/lib/logic/operations/NullOperationRunner.d.ts +2 -2
- package/lib/logic/operations/OperationExecutionManager.d.ts +6 -0
- package/lib/logic/operations/OperationExecutionRecord.d.ts +19 -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 +4 -26
- package/lib/pluginFramework/PhasedCommandHooks.d.ts +31 -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
|
@@ -120,6 +120,33 @@ 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 opts into running with cobuilds. The context id should be the same across
|
|
125
|
+
* multiple VMs, but changed when it is a new round of cobuilds.
|
|
126
|
+
*
|
|
127
|
+
* e.g. `Build.BuildNumber` in Azure DevOps Pipeline.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
131
|
+
*/
|
|
132
|
+
readonly RUSH_COBUILD_CONTEXT_ID: "RUSH_COBUILD_CONTEXT_ID";
|
|
133
|
+
/**
|
|
134
|
+
* Explicitly specifies a name for each participating cobuild runner.
|
|
135
|
+
*
|
|
136
|
+
* Setting this environment variable opts into running with cobuilds.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* This environment variable is optional, if it is not provided, a random id is used.
|
|
140
|
+
*
|
|
141
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
142
|
+
*/
|
|
143
|
+
readonly RUSH_COBUILD_RUNNER_ID: "RUSH_COBUILD_RUNNER_ID";
|
|
144
|
+
/**
|
|
145
|
+
* If this variable is set to "1", When getting distributed builds, Rush will automatically handle the leaf project
|
|
146
|
+
* with build cache "disabled" by writing to the cache in a special "log files only mode". This is useful when you
|
|
147
|
+
* want to use Cobuilds to improve the performance in CI validations and the leaf projects have not enabled cache.
|
|
148
|
+
*/
|
|
149
|
+
readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED";
|
|
123
150
|
/**
|
|
124
151
|
* Explicitly specifies the path for the Git binary that is invoked by certain Rush operations.
|
|
125
152
|
*/
|
|
@@ -164,6 +191,9 @@ export declare class EnvironmentConfiguration {
|
|
|
164
191
|
private static _buildCacheCredential;
|
|
165
192
|
private static _buildCacheEnabled;
|
|
166
193
|
private static _buildCacheWriteAllowed;
|
|
194
|
+
private static _cobuildContextId;
|
|
195
|
+
private static _cobuildRunnerId;
|
|
196
|
+
private static _cobuildLeafProjectLogOnlyAllowed;
|
|
167
197
|
private static _gitBinaryPath;
|
|
168
198
|
private static _tarBinaryPath;
|
|
169
199
|
/**
|
|
@@ -219,6 +249,21 @@ export declare class EnvironmentConfiguration {
|
|
|
219
249
|
* See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED}
|
|
220
250
|
*/
|
|
221
251
|
static get buildCacheWriteAllowed(): boolean | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* Provides a determined cobuild context id if configured
|
|
254
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}
|
|
255
|
+
*/
|
|
256
|
+
static get cobuildContextId(): string | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* Provides a determined cobuild runner id if configured
|
|
259
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_RUNNER_ID}
|
|
260
|
+
*/
|
|
261
|
+
static get cobuildRunnerId(): string | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* If set, enables or disables the cobuild leaf project log only feature.
|
|
264
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED}
|
|
265
|
+
*/
|
|
266
|
+
static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined;
|
|
222
267
|
/**
|
|
223
268
|
* Allows the git binary path to be explicitly provided.
|
|
224
269
|
* See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ITerminal } from '@rushstack/node-core-library';
|
|
1
|
+
import { type ITerminal } from '@rushstack/node-core-library';
|
|
2
2
|
import { RushConfigurationProject } from './RushConfigurationProject';
|
|
3
3
|
import type { IPhase } from './CommandLineConfiguration';
|
|
4
4
|
/**
|
|
5
|
-
* Describes the file structure for the
|
|
5
|
+
* Describes the file structure for the `<project root>/config/rush-project.json` config file.
|
|
6
|
+
* @internal
|
|
6
7
|
*/
|
|
7
8
|
export interface IRushProjectJson {
|
|
8
9
|
/**
|
|
@@ -26,6 +27,9 @@ export interface IRushProjectJson {
|
|
|
26
27
|
disableBuildCacheForProject?: boolean;
|
|
27
28
|
operationSettings?: IOperationSettings[];
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
29
33
|
export interface IOperationSettings {
|
|
30
34
|
/**
|
|
31
35
|
* The name of the operation. This should be a key in the `package.json`'s `scripts` object.
|
|
@@ -74,17 +78,17 @@ export interface IOperationSettings {
|
|
|
74
78
|
* Use this class to load the "config/rush-project.json" config file.
|
|
75
79
|
*
|
|
76
80
|
* This file provides project-specific configuration options.
|
|
77
|
-
* @
|
|
81
|
+
* @alpha
|
|
78
82
|
*/
|
|
79
83
|
export declare class RushProjectConfiguration {
|
|
80
84
|
private static readonly _configCache;
|
|
81
85
|
readonly project: RushConfigurationProject;
|
|
82
86
|
/**
|
|
83
|
-
* {@inheritdoc
|
|
87
|
+
* {@inheritdoc _IRushProjectJson.incrementalBuildIgnoredGlobs}
|
|
84
88
|
*/
|
|
85
89
|
readonly incrementalBuildIgnoredGlobs: ReadonlyArray<string>;
|
|
86
90
|
/**
|
|
87
|
-
* {@inheritdoc
|
|
91
|
+
* {@inheritdoc _IRushProjectJson.disableBuildCacheForProject}
|
|
88
92
|
*/
|
|
89
93
|
readonly disableBuildCacheForProject: boolean;
|
|
90
94
|
readonly operationSettingsByOperationName: ReadonlyMap<string, Readonly<IOperationSettings>>;
|
|
@@ -98,6 +102,11 @@ export declare class RushProjectConfiguration {
|
|
|
98
102
|
* that are not used by "rush build" will not cause "rush build" to exit with an error.
|
|
99
103
|
*/
|
|
100
104
|
validatePhaseConfiguration(phases: Iterable<IPhase>, terminal: ITerminal): void;
|
|
105
|
+
/**
|
|
106
|
+
* Examines the list of source files for the project and the target phase and returns a reason
|
|
107
|
+
* why the project cannot enable the build cache for that phase, or undefined if it is safe to so do.
|
|
108
|
+
*/
|
|
109
|
+
getCacheDisabledReason(trackedFileNames: Iterable<string>, phaseName: string): string | undefined;
|
|
101
110
|
/**
|
|
102
111
|
* Loads the rush-project.json data for the specified project.
|
|
103
112
|
*/
|
|
@@ -111,6 +120,11 @@ export declare class RushProjectConfiguration {
|
|
|
111
120
|
* having to validate the rest of the `rush-project.json` file against the repo's command-line configuration.
|
|
112
121
|
*/
|
|
113
122
|
static tryLoadIgnoreGlobsForProjectAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<ReadonlyArray<string> | undefined>;
|
|
123
|
+
/**
|
|
124
|
+
* Load the rush-project.json data for all selected projects.
|
|
125
|
+
* Validate compatibility of output folders across all selected phases.
|
|
126
|
+
*/
|
|
127
|
+
static tryLoadAndValidateForProjectsAsync(projects: Iterable<RushConfigurationProject>, phases: ReadonlySet<IPhase>, terminal: ITerminal): Promise<ReadonlyMap<RushConfigurationProject, RushProjectConfiguration>>;
|
|
114
128
|
private static _tryLoadJsonForProjectAsync;
|
|
115
129
|
private static _getRushProjectConfiguration;
|
|
116
130
|
}
|
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';
|
|
@@ -16,6 +17,7 @@ export { EnvironmentConfiguration, EnvironmentVariableNames, IEnvironmentConfigu
|
|
|
16
17
|
export { RushConstants } from './logic/RushConstants';
|
|
17
18
|
export { PackageManagerName, PackageManager } from './api/packageManager/PackageManager';
|
|
18
19
|
export { RushConfigurationProject } from './api/RushConfigurationProject';
|
|
20
|
+
export { IRushProjectJson as _IRushProjectJson, IOperationSettings, RushProjectConfiguration } from './api/RushProjectConfiguration';
|
|
19
21
|
export { RushUserConfiguration } from './api/RushUserConfiguration';
|
|
20
22
|
export { RushGlobalFolder as _RushGlobalFolder } from './api/RushGlobalFolder';
|
|
21
23
|
export { ApprovedPackagesItem, ApprovedPackagesConfiguration } from './api/ApprovedPackagesConfiguration';
|
|
@@ -32,12 +34,12 @@ export { ILaunchOptions, Rush } from './api/Rush';
|
|
|
32
34
|
export { RushInternals as _RushInternals } from './api/RushInternals';
|
|
33
35
|
export { ExperimentsConfiguration, IExperimentsJson } from './api/ExperimentsConfiguration';
|
|
34
36
|
export { CustomTipsConfiguration, CustomTipId, ICustomTipsJson, ICustomTipItemJson } from './api/CustomTipsConfiguration';
|
|
35
|
-
export { ProjectChangeAnalyzer, IGetChangedProjectsOptions } from './logic/ProjectChangeAnalyzer';
|
|
37
|
+
export { ProjectChangeAnalyzer, IGetChangedProjectsOptions, IRawRepoState as _IRawRepoState } from './logic/ProjectChangeAnalyzer';
|
|
36
38
|
export { IOperationRunner, IOperationRunnerContext } from './logic/operations/IOperationRunner';
|
|
37
39
|
export { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
|
|
38
40
|
export { IOperationOptions, Operation } from './logic/operations/Operation';
|
|
39
41
|
export { OperationStatus } from './logic/operations/OperationStatus';
|
|
40
|
-
export { RushSession, IRushSessionOptions, CloudBuildCacheProviderFactory } from './pluginFramework/RushSession';
|
|
42
|
+
export { RushSession, IRushSessionOptions, CloudBuildCacheProviderFactory, CobuildLockProviderFactory } from './pluginFramework/RushSession';
|
|
41
43
|
export { IRushCommand, IGlobalCommand, IPhasedCommand, RushLifecycleHooks } from './pluginFramework/RushLifeCycle';
|
|
42
44
|
export { ICreateOperationsContext, PhasedCommandHooks } from './pluginFramework/PhasedCommandHooks';
|
|
43
45
|
export { IRushPlugin } from './pluginFramework/IRushPlugin';
|
|
@@ -45,6 +47,7 @@ export { IBuiltInPluginConfiguration as _IBuiltInPluginConfiguration } from './p
|
|
|
45
47
|
export { IRushPluginConfigurationBase as _IRushPluginConfigurationBase } from './api/RushPluginsConfiguration';
|
|
46
48
|
export { ILogger } from './pluginFramework/logging/Logger';
|
|
47
49
|
export { ICloudBuildCacheProvider } from './logic/buildCache/ICloudBuildCacheProvider';
|
|
50
|
+
export { ICobuildLockProvider, ICobuildContext, ICobuildCompletedState } from './logic/cobuild/ICobuildLockProvider';
|
|
48
51
|
export { ICredentialCacheOptions, ICredentialCacheEntry, CredentialCache } from './logic/CredentialCache';
|
|
49
52
|
export type { ITelemetryData, ITelemetryMachineInfo, ITelemetryOperationResult } from './logic/Telemetry';
|
|
50
53
|
export { IStopwatchResult } from './utilities/Stopwatch';
|
|
@@ -154,6 +154,10 @@ export declare class RushConstants {
|
|
|
154
154
|
* Changing this ensures that cache entries generated by an old version will no longer register as a cache hit.
|
|
155
155
|
*/
|
|
156
156
|
static readonly buildCacheVersion: number;
|
|
157
|
+
/**
|
|
158
|
+
* Cobuild configuration file.
|
|
159
|
+
*/
|
|
160
|
+
static readonly cobuildFilename: string;
|
|
157
161
|
/**
|
|
158
162
|
* Per-project configuration filename.
|
|
159
163
|
*/
|
|
@@ -1,15 +1,14 @@
|
|
|
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>;
|
|
11
|
-
|
|
12
|
-
trackedProjectFiles: string[] | undefined;
|
|
11
|
+
configHash: string;
|
|
13
12
|
projectChangeAnalyzer: ProjectChangeAnalyzer;
|
|
14
13
|
terminal: ITerminal;
|
|
15
14
|
phaseName: string;
|
|
@@ -30,10 +29,10 @@ export declare class ProjectBuildCache {
|
|
|
30
29
|
private _cacheId;
|
|
31
30
|
private constructor();
|
|
32
31
|
private static _tryGetTarUtility;
|
|
32
|
+
get cacheId(): string | undefined;
|
|
33
33
|
static tryGetProjectBuildCache(options: IProjectBuildCacheOptions): Promise<ProjectBuildCache | undefined>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
trySetCacheEntryAsync(terminal: ITerminal): Promise<boolean>;
|
|
34
|
+
tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
|
|
35
|
+
trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
|
|
37
36
|
/**
|
|
38
37
|
* Walks the declared output folders of the project and collects a list of files.
|
|
39
38
|
* @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,51 @@
|
|
|
1
|
+
import { ITerminal } from '@rushstack/node-core-library';
|
|
2
|
+
import { CobuildLock } from '../cobuild/CobuildLock';
|
|
3
|
+
import { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
|
|
4
|
+
import { IOperationSettings } from '../../api/RushProjectConfiguration';
|
|
5
|
+
import { ProjectLogWritable } from './ProjectLogWritable';
|
|
6
|
+
import { CobuildConfiguration } from '../../api/CobuildConfiguration';
|
|
7
|
+
import { PeriodicCallback } from './PeriodicCallback';
|
|
8
|
+
import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
|
|
9
|
+
import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
|
|
10
|
+
export interface IProjectDeps {
|
|
11
|
+
files: {
|
|
12
|
+
[filePath: string]: string;
|
|
13
|
+
};
|
|
14
|
+
arguments: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IOperationBuildCacheContext {
|
|
17
|
+
isCacheWriteAllowed: boolean;
|
|
18
|
+
isCacheReadAllowed: boolean;
|
|
19
|
+
projectBuildCache: ProjectBuildCache | undefined;
|
|
20
|
+
cacheDisabledReason: string | undefined;
|
|
21
|
+
operationSettings: IOperationSettings | undefined;
|
|
22
|
+
cobuildLock: CobuildLock | undefined;
|
|
23
|
+
cobuildClusterId: string | undefined;
|
|
24
|
+
buildCacheTerminal: ITerminal | undefined;
|
|
25
|
+
buildCacheProjectLogWritable: ProjectLogWritable | undefined;
|
|
26
|
+
periodicCallback: PeriodicCallback;
|
|
27
|
+
cacheRestored: boolean;
|
|
28
|
+
isCacheReadAttempted: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ICacheableOperationPluginOptions {
|
|
31
|
+
allowWarningsInSuccessfulBuild: boolean;
|
|
32
|
+
buildCacheConfiguration: BuildCacheConfiguration;
|
|
33
|
+
cobuildConfiguration: CobuildConfiguration | undefined;
|
|
34
|
+
terminal: ITerminal;
|
|
35
|
+
}
|
|
36
|
+
export declare class CacheableOperationPlugin implements IPhasedCommandPlugin {
|
|
37
|
+
private _buildCacheContextByOperation;
|
|
38
|
+
private _createContext;
|
|
39
|
+
private readonly _options;
|
|
40
|
+
constructor(options: ICacheableOperationPluginOptions);
|
|
41
|
+
apply(hooks: PhasedCommandHooks): void;
|
|
42
|
+
private _getBuildCacheContextByOperation;
|
|
43
|
+
private _getBuildCacheContextByOperationOrThrow;
|
|
44
|
+
private _tryGetProjectBuildCacheAsync;
|
|
45
|
+
private _tryGetLogOnlyProjectBuildCacheAsync;
|
|
46
|
+
private _tryGetCobuildLockAsync;
|
|
47
|
+
private _getBuildCacheTerminal;
|
|
48
|
+
private _createBuildCacheTerminal;
|
|
49
|
+
private _tryGetBuildCacheProjectLogWritable;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=CacheableOperationPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/CacheableOperationPlugin");
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { StdioSummarizer } from '@rushstack/terminal';
|
|
2
2
|
import type { OperationStatus } from './OperationStatus';
|
|
3
|
-
import type { IStopwatchResult } from '../../utilities/Stopwatch';
|
|
4
3
|
import type { Operation } from './Operation';
|
|
4
|
+
import type { IStopwatchResult } from '../../utilities/Stopwatch';
|
|
5
5
|
/**
|
|
6
6
|
* The `IOperationExecutionResult` interface represents the results of executing an {@link Operation}.
|
|
7
7
|
* @alpha
|
|
8
8
|
*/
|
|
9
9
|
export interface IOperationExecutionResult {
|
|
10
|
+
/**
|
|
11
|
+
* The operation itself
|
|
12
|
+
*/
|
|
13
|
+
readonly operation: Operation;
|
|
10
14
|
/**
|
|
11
15
|
* The current execution status of an operation. Operations start in the 'ready' state,
|
|
12
16
|
* but can be 'blocked' if an upstream operation failed. It is 'executing' when
|
|
@@ -31,6 +35,10 @@ export interface IOperationExecutionResult {
|
|
|
31
35
|
* The value indicates the duration of the same operation without cache hit.
|
|
32
36
|
*/
|
|
33
37
|
readonly nonCachedDurationMs: number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The id of the runner which actually runs the building process in cobuild mode.
|
|
40
|
+
*/
|
|
41
|
+
readonly cobuildRunnerId: string | undefined;
|
|
34
42
|
}
|
|
35
43
|
/**
|
|
36
44
|
* The `IExecutionResult` interface represents the results of executing a set of {@link Operation}s.
|
|
@@ -35,6 +35,25 @@ export interface IOperationRunnerContext {
|
|
|
35
35
|
* Object used to track elapsed time.
|
|
36
36
|
*/
|
|
37
37
|
stopwatch: IStopwatchResult;
|
|
38
|
+
/**
|
|
39
|
+
* The current execution status of an operation. Operations start in the 'ready' state,
|
|
40
|
+
* but can be 'blocked' if an upstream operation failed. It is 'executing' when
|
|
41
|
+
* the operation is executing. Once execution is complete, it is either 'success' or
|
|
42
|
+
* 'failure'.
|
|
43
|
+
*/
|
|
44
|
+
status: OperationStatus;
|
|
45
|
+
/**
|
|
46
|
+
* Error which occurred while executing this operation, this is stored in case we need
|
|
47
|
+
* it later (for example to re-print errors at end of execution).
|
|
48
|
+
*/
|
|
49
|
+
error?: Error;
|
|
50
|
+
/**
|
|
51
|
+
* Normally the incremental build logic will rebuild changed projects as well as
|
|
52
|
+
* any projects that directly or indirectly depend on a changed project.
|
|
53
|
+
* If true, then the incremental build logic will only rebuild changed projects and
|
|
54
|
+
* ignore dependent projects.
|
|
55
|
+
*/
|
|
56
|
+
readonly changedProjectsOnly: boolean;
|
|
38
57
|
}
|
|
39
58
|
/**
|
|
40
59
|
* The `Operation` class is a node in the dependency graph of work that needs to be scheduled by the
|
|
@@ -49,9 +68,9 @@ export interface IOperationRunner {
|
|
|
49
68
|
*/
|
|
50
69
|
readonly name: string;
|
|
51
70
|
/**
|
|
52
|
-
*
|
|
71
|
+
* Whether or not the operation is cacheable. If false, all cache engines will be disabled for this operation.
|
|
53
72
|
*/
|
|
54
|
-
|
|
73
|
+
cacheable: boolean;
|
|
55
74
|
/**
|
|
56
75
|
* Indicates that this runner's duration has meaning.
|
|
57
76
|
*/
|
|
@@ -65,13 +84,13 @@ export interface IOperationRunner {
|
|
|
65
84
|
* exit code
|
|
66
85
|
*/
|
|
67
86
|
warningsAreAllowed: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Indicates if the output of this operation may be written to the cache
|
|
70
|
-
*/
|
|
71
|
-
isCacheWriteAllowed: boolean;
|
|
72
87
|
/**
|
|
73
88
|
* Method to be executed for the operation.
|
|
74
89
|
*/
|
|
75
90
|
executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
|
|
91
|
+
/**
|
|
92
|
+
* Return a hash of the configuration that affects the operation.
|
|
93
|
+
*/
|
|
94
|
+
getConfigHash(): string;
|
|
76
95
|
}
|
|
77
96
|
//# sourceMappingURL=IOperationRunner.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ITerminal } from '@rushstack/node-core-library';
|
|
2
|
+
import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
|
|
3
|
+
export interface IProjectDeps {
|
|
4
|
+
files: {
|
|
5
|
+
[filePath: string]: string;
|
|
6
|
+
};
|
|
7
|
+
arguments: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ILegacySkipPluginOptions {
|
|
10
|
+
terminal: ITerminal;
|
|
11
|
+
changedProjectsOnly: boolean;
|
|
12
|
+
isIncrementalBuildAllowed: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Core phased command plugin that implements the legacy skip detection logic, used when build cache is disabled.
|
|
16
|
+
*/
|
|
17
|
+
export declare class LegacySkipPlugin implements IPhasedCommandPlugin {
|
|
18
|
+
private readonly _options;
|
|
19
|
+
constructor(options: ILegacySkipPluginOptions);
|
|
20
|
+
apply(hooks: PhasedCommandHooks): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=LegacySkipPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/LegacySkipPlugin");
|
|
@@ -25,11 +25,11 @@ export declare class NullOperationRunner implements IOperationRunner {
|
|
|
25
25
|
readonly name: string;
|
|
26
26
|
readonly reportTiming: boolean;
|
|
27
27
|
readonly silent: boolean;
|
|
28
|
-
|
|
29
|
-
isCacheWriteAllowed: boolean;
|
|
28
|
+
cacheable: boolean;
|
|
30
29
|
readonly warningsAreAllowed: boolean;
|
|
31
30
|
readonly result: OperationStatus;
|
|
32
31
|
constructor({ name, result, silent }: INullOperationRunnerParams);
|
|
33
32
|
executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
|
|
33
|
+
getConfigHash(): string;
|
|
34
34
|
}
|
|
35
35
|
//# sourceMappingURL=NullOperationRunner.d.ts.map
|