@rushstack/rush-sdk 5.97.0 → 5.97.1-pr3949.0
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 +259 -9
- package/lib/api/CobuildConfiguration.d.ts +63 -0
- package/lib/api/CobuildConfiguration.js +1 -0
- package/lib/api/EnvironmentConfiguration.d.ts +41 -0
- package/lib/index.d.ts +3 -1
- package/lib/logic/RushConstants.d.ts +9 -0
- package/lib/logic/buildCache/ProjectBuildCache.d.ts +5 -4
- package/lib/logic/cobuild/CobuildLock.d.ts +24 -0
- package/lib/logic/cobuild/CobuildLock.js +1 -0
- package/lib/logic/cobuild/ICobuildLockProvider.d.ts +46 -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 +21 -0
- package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
- package/lib/logic/operations/IOperationRunner.d.ts +29 -10
- package/lib/logic/operations/OperationExecutionManager.d.ts +5 -0
- package/lib/logic/operations/OperationExecutionRecord.d.ts +7 -1
- package/lib/logic/operations/OperationRunnerHooks.d.ts +50 -0
- package/lib/logic/operations/OperationRunnerHooks.js +1 -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/ShellOperationRunner.d.ts +4 -13
- package/lib/pluginFramework/PhasedCommandHooks.d.ts +15 -1
- package/lib/pluginFramework/RushSession.d.ts +11 -2
- package/package.json +2 -2
package/dist/rush-lib.d.ts
CHANGED
|
@@ -210,6 +210,55 @@ export declare class ChangeManager {
|
|
|
210
210
|
*/
|
|
211
211
|
export declare type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) => ICloudBuildCacheProvider;
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Use this class to load and save the "common/config/rush/cobuild.json" config file.
|
|
215
|
+
* This file provides configuration options for the Rush Cobuild feature.
|
|
216
|
+
* @beta
|
|
217
|
+
*/
|
|
218
|
+
export declare class CobuildConfiguration {
|
|
219
|
+
private static _jsonSchema;
|
|
220
|
+
/**
|
|
221
|
+
* Indicates whether the cobuild feature is enabled.
|
|
222
|
+
* Typically it is enabled in the cobuild.json config file.
|
|
223
|
+
*
|
|
224
|
+
* Note: The orchestrator (or local users) should always have to opt into running with cobuilds by
|
|
225
|
+
* providing a cobuild context id. Even if cobuilds are "enabled" as a feature, they don't
|
|
226
|
+
* actually turn on for that particular build unless the cobuild context id is provided as an
|
|
227
|
+
* non-empty string.
|
|
228
|
+
*/
|
|
229
|
+
readonly cobuildEnabled: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Cobuild context id
|
|
232
|
+
*
|
|
233
|
+
* @remarks
|
|
234
|
+
* The cobuild feature won't be enabled until the context id is provided as an non-empty string.
|
|
235
|
+
*/
|
|
236
|
+
readonly cobuildContextId: string | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* If true, Rush will automatically handle the leaf project with build cache "disabled" by writing
|
|
239
|
+
* to the cache in a special "log files only mode". This is useful when you want to use Cobuilds
|
|
240
|
+
* to improve the performance in CI validations and the leaf projects have not enabled cache.
|
|
241
|
+
*/
|
|
242
|
+
readonly cobuildLeafProjectLogOnlyAllowed: boolean;
|
|
243
|
+
readonly cobuildLockProvider: ICobuildLockProvider;
|
|
244
|
+
private constructor();
|
|
245
|
+
/**
|
|
246
|
+
* Attempts to load the cobuild.json data from the standard file path `common/config/rush/cobuild.json`.
|
|
247
|
+
* If the file has not been created yet, then undefined is returned.
|
|
248
|
+
*/
|
|
249
|
+
static tryLoadAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise<CobuildConfiguration | undefined>;
|
|
250
|
+
static getCobuildConfigFilePath(rushConfiguration: RushConfiguration): string;
|
|
251
|
+
private static _loadAsync;
|
|
252
|
+
get contextId(): string | undefined;
|
|
253
|
+
connectLockProviderAsync(): Promise<void>;
|
|
254
|
+
disconnectLockProviderAsync(): Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @beta
|
|
259
|
+
*/
|
|
260
|
+
export declare type CobuildLockProviderFactory = (cobuildJson: ICobuildJson) => ICobuildLockProvider;
|
|
261
|
+
|
|
213
262
|
/**
|
|
214
263
|
* Use this class to load and save the "common/config/rush/common-versions.json" config file.
|
|
215
264
|
* This config file stores dependency version information that affects all projects in the repo.
|
|
@@ -339,6 +388,9 @@ export declare class EnvironmentConfiguration {
|
|
|
339
388
|
private static _buildCacheCredential;
|
|
340
389
|
private static _buildCacheEnabled;
|
|
341
390
|
private static _buildCacheWriteAllowed;
|
|
391
|
+
private static _cobuildEnabled;
|
|
392
|
+
private static _cobuildContextId;
|
|
393
|
+
private static _cobuildLeafProjectLogOnlyAllowed;
|
|
342
394
|
private static _gitBinaryPath;
|
|
343
395
|
private static _tarBinaryPath;
|
|
344
396
|
/**
|
|
@@ -394,6 +446,21 @@ export declare class EnvironmentConfiguration {
|
|
|
394
446
|
* See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED}
|
|
395
447
|
*/
|
|
396
448
|
static get buildCacheWriteAllowed(): boolean | undefined;
|
|
449
|
+
/**
|
|
450
|
+
* If set, enables or disables the cobuild feature.
|
|
451
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_ENABLED}
|
|
452
|
+
*/
|
|
453
|
+
static get cobuildEnabled(): boolean | undefined;
|
|
454
|
+
/**
|
|
455
|
+
* Provides a determined cobuild context id if configured
|
|
456
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}
|
|
457
|
+
*/
|
|
458
|
+
static get cobuildContextId(): string | undefined;
|
|
459
|
+
/**
|
|
460
|
+
* If set, enables or disables the cobuild leaf project log only feature.
|
|
461
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED}
|
|
462
|
+
*/
|
|
463
|
+
static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined;
|
|
397
464
|
/**
|
|
398
465
|
* Allows the git binary path to be explicitly provided.
|
|
399
466
|
* See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH}
|
|
@@ -551,6 +618,29 @@ export declare const EnvironmentVariableNames: {
|
|
|
551
618
|
* this environment variable is ignored.
|
|
552
619
|
*/
|
|
553
620
|
readonly RUSH_BUILD_CACHE_WRITE_ALLOWED: "RUSH_BUILD_CACHE_WRITE_ALLOWED";
|
|
621
|
+
/**
|
|
622
|
+
* Setting this environment variable overrides the value of `cobuildEnabled` in the `cobuild.json`
|
|
623
|
+
* configuration file.
|
|
624
|
+
*
|
|
625
|
+
* @remarks
|
|
626
|
+
* Specify `1` to enable the cobuild or `0` to disable it.
|
|
627
|
+
*
|
|
628
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
629
|
+
*/
|
|
630
|
+
readonly RUSH_COBUILD_ENABLED: "RUSH_COBUILD_ENABLED";
|
|
631
|
+
/**
|
|
632
|
+
* Setting this environment variable opt into running with cobuilds.
|
|
633
|
+
*
|
|
634
|
+
* @remarks
|
|
635
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
636
|
+
*/
|
|
637
|
+
readonly RUSH_COBUILD_CONTEXT_ID: "RUSH_COBUILD_CONTEXT_ID";
|
|
638
|
+
/**
|
|
639
|
+
* If this variable is set to "1", When getting distributed builds, Rush will automatically handle the leaf project
|
|
640
|
+
* with build cache "disabled" by writing to the cache in a special "log files only mode". This is useful when you
|
|
641
|
+
* want to use Cobuilds to improve the performance in CI validations and the leaf projects have not enabled cache.
|
|
642
|
+
*/
|
|
643
|
+
readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED";
|
|
554
644
|
/**
|
|
555
645
|
* Explicitly specifies the path for the Git binary that is invoked by certain Rush operations.
|
|
556
646
|
*/
|
|
@@ -714,6 +804,61 @@ export declare interface ICloudBuildCacheProvider {
|
|
|
714
804
|
deleteCachedCredentialsAsync(terminal: ITerminal): Promise<void>;
|
|
715
805
|
}
|
|
716
806
|
|
|
807
|
+
/**
|
|
808
|
+
* @beta
|
|
809
|
+
*/
|
|
810
|
+
export declare interface ICobuildCompletedState {
|
|
811
|
+
status: OperationStatus.Success | OperationStatus.SuccessWithWarning | OperationStatus.Failure;
|
|
812
|
+
/**
|
|
813
|
+
* Completed state points to the cache id that was used to store the build cache.
|
|
814
|
+
* Note: Cache failed builds in a separate cache id
|
|
815
|
+
*/
|
|
816
|
+
cacheId: string;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* @beta
|
|
821
|
+
*/
|
|
822
|
+
export declare interface ICobuildContext {
|
|
823
|
+
/**
|
|
824
|
+
* The contextId is provided by the monorepo maintainer, it reads from environment variable {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}.
|
|
825
|
+
* It ensure only the builds from the same given contextId cooperated. If user was more permissive,
|
|
826
|
+
* and wanted all PR and CI builds building anything with the same contextId to cooperate, then just
|
|
827
|
+
* set it to a static value.
|
|
828
|
+
*/
|
|
829
|
+
contextId: string;
|
|
830
|
+
/**
|
|
831
|
+
* The id of cache. It should be keep same as the normal cacheId from ProjectBuildCache.
|
|
832
|
+
* Otherwise, there is a discrepancy in the success case then turning on cobuilds will
|
|
833
|
+
* fail to populate the normal build cache.
|
|
834
|
+
*/
|
|
835
|
+
cacheId: string;
|
|
836
|
+
/**
|
|
837
|
+
* {@inheritdoc RushConstants.cobuildLockVersion}
|
|
838
|
+
*/
|
|
839
|
+
version: number;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* @beta
|
|
844
|
+
*/
|
|
845
|
+
export declare interface ICobuildJson {
|
|
846
|
+
cobuildEnabled: boolean;
|
|
847
|
+
cobuildLockProvider: string;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* @beta
|
|
852
|
+
*/
|
|
853
|
+
export declare interface ICobuildLockProvider {
|
|
854
|
+
connectAsync(): Promise<void>;
|
|
855
|
+
disconnectAsync(): Promise<void>;
|
|
856
|
+
acquireLockAsync(context: ICobuildContext): Promise<boolean>;
|
|
857
|
+
renewLockAsync(context: ICobuildContext): Promise<void>;
|
|
858
|
+
setCompletedStateAsync(context: ICobuildContext, state: ICobuildCompletedState): Promise<void>;
|
|
859
|
+
getCompletedStateAsync(context: ICobuildContext): Promise<ICobuildCompletedState | undefined>;
|
|
860
|
+
}
|
|
861
|
+
|
|
717
862
|
/**
|
|
718
863
|
* A collection of environment variables
|
|
719
864
|
* @public
|
|
@@ -751,6 +896,10 @@ export declare interface ICreateOperationsContext {
|
|
|
751
896
|
* The configuration for the build cache, if the feature is enabled.
|
|
752
897
|
*/
|
|
753
898
|
readonly buildCacheConfiguration: BuildCacheConfiguration | undefined;
|
|
899
|
+
/**
|
|
900
|
+
* The configuration for the cobuild, if cobuild feature and build cache feature are both enabled.
|
|
901
|
+
*/
|
|
902
|
+
readonly cobuildConfiguration: CobuildConfiguration | undefined;
|
|
754
903
|
/**
|
|
755
904
|
* The set of custom parameters for the executing command.
|
|
756
905
|
* Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
|
|
@@ -1157,10 +1306,6 @@ export declare interface IOperationRunner {
|
|
|
1157
1306
|
* Name of the operation, for logging.
|
|
1158
1307
|
*/
|
|
1159
1308
|
readonly name: string;
|
|
1160
|
-
/**
|
|
1161
|
-
* This flag determines if the operation is allowed to be skipped if up to date.
|
|
1162
|
-
*/
|
|
1163
|
-
isSkipAllowed: boolean;
|
|
1164
1309
|
/**
|
|
1165
1310
|
* Indicates that this runner's duration has meaning.
|
|
1166
1311
|
*/
|
|
@@ -1174,10 +1319,6 @@ export declare interface IOperationRunner {
|
|
|
1174
1319
|
* exit code
|
|
1175
1320
|
*/
|
|
1176
1321
|
warningsAreAllowed: boolean;
|
|
1177
|
-
/**
|
|
1178
|
-
* Indicates if the output of this operation may be written to the cache
|
|
1179
|
-
*/
|
|
1180
|
-
isCacheWriteAllowed: boolean;
|
|
1181
1322
|
/**
|
|
1182
1323
|
* Method to be executed for the operation.
|
|
1183
1324
|
*/
|
|
@@ -1215,7 +1356,34 @@ export declare interface IOperationRunnerContext {
|
|
|
1215
1356
|
/**
|
|
1216
1357
|
* Object used to track elapsed time.
|
|
1217
1358
|
*/
|
|
1218
|
-
stopwatch:
|
|
1359
|
+
stopwatch: Stopwatch;
|
|
1360
|
+
/**
|
|
1361
|
+
* The current execution status of an operation. Operations start in the 'ready' state,
|
|
1362
|
+
* but can be 'blocked' if an upstream operation failed. It is 'executing' when
|
|
1363
|
+
* the operation is executing. Once execution is complete, it is either 'success' or
|
|
1364
|
+
* 'failure'.
|
|
1365
|
+
*/
|
|
1366
|
+
status: OperationStatus;
|
|
1367
|
+
/**
|
|
1368
|
+
* Error which occurred while executing this operation, this is stored in case we need
|
|
1369
|
+
* it later (for example to re-print errors at end of execution).
|
|
1370
|
+
*/
|
|
1371
|
+
error?: Error;
|
|
1372
|
+
/**
|
|
1373
|
+
* The set of operations that depend on this operation.
|
|
1374
|
+
*/
|
|
1375
|
+
readonly consumers: Set<IOperationRunnerContext>;
|
|
1376
|
+
/**
|
|
1377
|
+
* The operation runner that is executing this operation.
|
|
1378
|
+
*/
|
|
1379
|
+
readonly runner: IOperationRunner;
|
|
1380
|
+
/**
|
|
1381
|
+
* Normally the incremental build logic will rebuild changed projects as well as
|
|
1382
|
+
* any projects that directly or indirectly depend on a changed project.
|
|
1383
|
+
* If true, then the incremental build logic will only rebuild changed projects and
|
|
1384
|
+
* ignore dependent projects.
|
|
1385
|
+
*/
|
|
1386
|
+
readonly changedProjectsOnly: boolean;
|
|
1219
1387
|
}
|
|
1220
1388
|
|
|
1221
1389
|
/**
|
|
@@ -2091,10 +2259,18 @@ export declare enum OperationStatus {
|
|
|
2091
2259
|
* The Operation is on the queue, ready to execute (but may be waiting for dependencies)
|
|
2092
2260
|
*/
|
|
2093
2261
|
Ready = "READY",
|
|
2262
|
+
/**
|
|
2263
|
+
* The Operation is Queued
|
|
2264
|
+
*/
|
|
2265
|
+
Queued = "QUEUED",
|
|
2094
2266
|
/**
|
|
2095
2267
|
* The Operation is currently executing
|
|
2096
2268
|
*/
|
|
2097
2269
|
Executing = "EXECUTING",
|
|
2270
|
+
/**
|
|
2271
|
+
* The Operation is currently executing by a remote process
|
|
2272
|
+
*/
|
|
2273
|
+
RemoteExecuting = "REMOTE EXECUTING",
|
|
2098
2274
|
/**
|
|
2099
2275
|
* The Operation completed successfully and did not write to standard output
|
|
2100
2276
|
*/
|
|
@@ -2264,6 +2440,14 @@ export declare class PhasedCommandHooks {
|
|
|
2264
2440
|
* Hook is series for stable output.
|
|
2265
2441
|
*/
|
|
2266
2442
|
readonly afterExecuteOperations: AsyncSeriesHook<[IExecutionResult, ICreateOperationsContext]>;
|
|
2443
|
+
/**
|
|
2444
|
+
* Hook invoked before executing a operation.
|
|
2445
|
+
*/
|
|
2446
|
+
readonly beforeExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
|
|
2447
|
+
/**
|
|
2448
|
+
* Hook invoked after executing a operation.
|
|
2449
|
+
*/
|
|
2450
|
+
readonly afterExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
|
|
2267
2451
|
/**
|
|
2268
2452
|
* Hook invoked after a run has finished and the command is watching for changes.
|
|
2269
2453
|
* May be used to display additional relevant data to the user.
|
|
@@ -3401,6 +3585,15 @@ export declare class RushConstants {
|
|
|
3401
3585
|
* Changing this ensures that cache entries generated by an old version will no longer register as a cache hit.
|
|
3402
3586
|
*/
|
|
3403
3587
|
static readonly buildCacheVersion: number;
|
|
3588
|
+
/**
|
|
3589
|
+
* Cobuild configuration file.
|
|
3590
|
+
*/
|
|
3591
|
+
static readonly cobuildFilename: string;
|
|
3592
|
+
/**
|
|
3593
|
+
* Cobuild version number, incremented when the logic to create cobuild lock changes.
|
|
3594
|
+
* Changing this ensures that lock generated by an old version will no longer access as a cobuild lock.
|
|
3595
|
+
*/
|
|
3596
|
+
static readonly cobuildLockVersion: number;
|
|
3404
3597
|
/**
|
|
3405
3598
|
* Per-project configuration filename.
|
|
3406
3599
|
*/
|
|
@@ -3566,12 +3759,15 @@ declare class RushPluginsConfiguration {
|
|
|
3566
3759
|
export declare class RushSession {
|
|
3567
3760
|
private readonly _options;
|
|
3568
3761
|
private readonly _cloudBuildCacheProviderFactories;
|
|
3762
|
+
private readonly _cobuildLockProviderFactories;
|
|
3569
3763
|
readonly hooks: RushLifecycleHooks;
|
|
3570
3764
|
constructor(options: IRushSessionOptions);
|
|
3571
3765
|
getLogger(name: string): ILogger;
|
|
3572
3766
|
get terminalProvider(): ITerminalProvider;
|
|
3573
3767
|
registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void;
|
|
3574
3768
|
getCloudBuildCacheProviderFactory(cacheProviderName: string): CloudBuildCacheProviderFactory | undefined;
|
|
3769
|
+
registerCobuildLockProviderFactory(cobuildLockProviderName: string, factory: CobuildLockProviderFactory): void;
|
|
3770
|
+
getCobuildLockProviderFactory(cobuildLockProviderName: string): CobuildLockProviderFactory | undefined;
|
|
3575
3771
|
}
|
|
3576
3772
|
|
|
3577
3773
|
/**
|
|
@@ -3590,6 +3786,60 @@ export declare class RushUserConfiguration {
|
|
|
3590
3786
|
static getRushUserFolderPath(): string;
|
|
3591
3787
|
}
|
|
3592
3788
|
|
|
3789
|
+
/**
|
|
3790
|
+
* Represents a typical timer/stopwatch which keeps track
|
|
3791
|
+
* of elapsed time in between two events.
|
|
3792
|
+
*/
|
|
3793
|
+
declare class Stopwatch implements IStopwatchResult {
|
|
3794
|
+
private _startTime;
|
|
3795
|
+
private _endTime;
|
|
3796
|
+
private _state;
|
|
3797
|
+
private _getTime;
|
|
3798
|
+
constructor(getTime?: () => number);
|
|
3799
|
+
/**
|
|
3800
|
+
* Static helper function which creates a stopwatch which is immediately started
|
|
3801
|
+
*/
|
|
3802
|
+
static start(): Stopwatch;
|
|
3803
|
+
get state(): StopwatchState;
|
|
3804
|
+
/**
|
|
3805
|
+
* Starts the stopwatch. Note that if end() has been called,
|
|
3806
|
+
* reset() should be called before calling start() again.
|
|
3807
|
+
*/
|
|
3808
|
+
start(): Stopwatch;
|
|
3809
|
+
/**
|
|
3810
|
+
* Stops executing the stopwatch and saves the current timestamp
|
|
3811
|
+
*/
|
|
3812
|
+
stop(): Stopwatch;
|
|
3813
|
+
/**
|
|
3814
|
+
* Resets all values of the stopwatch back to the original
|
|
3815
|
+
*/
|
|
3816
|
+
reset(): Stopwatch;
|
|
3817
|
+
/**
|
|
3818
|
+
* Displays how long the stopwatch has been executing in a human readable format.
|
|
3819
|
+
*/
|
|
3820
|
+
toString(): string;
|
|
3821
|
+
/**
|
|
3822
|
+
* Get the duration in seconds.
|
|
3823
|
+
*/
|
|
3824
|
+
get duration(): number;
|
|
3825
|
+
/**
|
|
3826
|
+
* Return the start time of the most recent stopwatch run.
|
|
3827
|
+
*/
|
|
3828
|
+
get startTime(): number | undefined;
|
|
3829
|
+
/**
|
|
3830
|
+
* Return the end time of the most recent stopwatch run.
|
|
3831
|
+
*/
|
|
3832
|
+
get endTime(): number | undefined;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
/**
|
|
3836
|
+
* Used with the Stopwatch class.
|
|
3837
|
+
*/
|
|
3838
|
+
declare enum StopwatchState {
|
|
3839
|
+
Stopped = 1,
|
|
3840
|
+
Started = 2
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3593
3843
|
declare enum VersionFormatForCommit {
|
|
3594
3844
|
wildcard = "wildcard",
|
|
3595
3845
|
original = "original"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ITerminal } from '@rushstack/node-core-library';
|
|
2
|
+
import { RushSession } from '../pluginFramework/RushSession';
|
|
3
|
+
import type { ICobuildLockProvider } from '../logic/cobuild/ICobuildLockProvider';
|
|
4
|
+
import type { RushConfiguration } from './RushConfiguration';
|
|
5
|
+
/**
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface ICobuildJson {
|
|
9
|
+
cobuildEnabled: boolean;
|
|
10
|
+
cobuildLockProvider: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export interface ICobuildConfigurationOptions {
|
|
16
|
+
cobuildJson: ICobuildJson;
|
|
17
|
+
rushConfiguration: RushConfiguration;
|
|
18
|
+
rushSession: RushSession;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Use this class to load and save the "common/config/rush/cobuild.json" config file.
|
|
22
|
+
* This file provides configuration options for the Rush Cobuild feature.
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export declare class CobuildConfiguration {
|
|
26
|
+
private static _jsonSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Indicates whether the cobuild feature is enabled.
|
|
29
|
+
* Typically it is enabled in the cobuild.json config file.
|
|
30
|
+
*
|
|
31
|
+
* Note: The orchestrator (or local users) should always have to opt into running with cobuilds by
|
|
32
|
+
* providing a cobuild context id. Even if cobuilds are "enabled" as a feature, they don't
|
|
33
|
+
* actually turn on for that particular build unless the cobuild context id is provided as an
|
|
34
|
+
* non-empty string.
|
|
35
|
+
*/
|
|
36
|
+
readonly cobuildEnabled: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Cobuild context id
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* The cobuild feature won't be enabled until the context id is provided as an non-empty string.
|
|
42
|
+
*/
|
|
43
|
+
readonly cobuildContextId: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* If true, Rush will automatically handle the leaf project with build cache "disabled" by writing
|
|
46
|
+
* to the cache in a special "log files only mode". This is useful when you want to use Cobuilds
|
|
47
|
+
* to improve the performance in CI validations and the leaf projects have not enabled cache.
|
|
48
|
+
*/
|
|
49
|
+
readonly cobuildLeafProjectLogOnlyAllowed: boolean;
|
|
50
|
+
readonly cobuildLockProvider: ICobuildLockProvider;
|
|
51
|
+
private constructor();
|
|
52
|
+
/**
|
|
53
|
+
* Attempts to load the cobuild.json data from the standard file path `common/config/rush/cobuild.json`.
|
|
54
|
+
* If the file has not been created yet, then undefined is returned.
|
|
55
|
+
*/
|
|
56
|
+
static tryLoadAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise<CobuildConfiguration | undefined>;
|
|
57
|
+
static getCobuildConfigFilePath(rushConfiguration: RushConfiguration): string;
|
|
58
|
+
private static _loadAsync;
|
|
59
|
+
get contextId(): string | undefined;
|
|
60
|
+
connectLockProviderAsync(): Promise<void>;
|
|
61
|
+
disconnectLockProviderAsync(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=CobuildConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../lib-shim/index")._rushSdk_loadInternalModule("api/CobuildConfiguration");
|
|
@@ -120,6 +120,29 @@ 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 opt into running with cobuilds.
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* If there is no cobuild configured, then this environment variable is ignored.
|
|
138
|
+
*/
|
|
139
|
+
readonly RUSH_COBUILD_CONTEXT_ID: "RUSH_COBUILD_CONTEXT_ID";
|
|
140
|
+
/**
|
|
141
|
+
* If this variable is set to "1", When getting distributed builds, Rush will automatically handle the leaf project
|
|
142
|
+
* with build cache "disabled" by writing to the cache in a special "log files only mode". This is useful when you
|
|
143
|
+
* want to use Cobuilds to improve the performance in CI validations and the leaf projects have not enabled cache.
|
|
144
|
+
*/
|
|
145
|
+
readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED";
|
|
123
146
|
/**
|
|
124
147
|
* Explicitly specifies the path for the Git binary that is invoked by certain Rush operations.
|
|
125
148
|
*/
|
|
@@ -164,6 +187,9 @@ export declare class EnvironmentConfiguration {
|
|
|
164
187
|
private static _buildCacheCredential;
|
|
165
188
|
private static _buildCacheEnabled;
|
|
166
189
|
private static _buildCacheWriteAllowed;
|
|
190
|
+
private static _cobuildEnabled;
|
|
191
|
+
private static _cobuildContextId;
|
|
192
|
+
private static _cobuildLeafProjectLogOnlyAllowed;
|
|
167
193
|
private static _gitBinaryPath;
|
|
168
194
|
private static _tarBinaryPath;
|
|
169
195
|
/**
|
|
@@ -219,6 +245,21 @@ export declare class EnvironmentConfiguration {
|
|
|
219
245
|
* See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED}
|
|
220
246
|
*/
|
|
221
247
|
static get buildCacheWriteAllowed(): boolean | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* If set, enables or disables the cobuild feature.
|
|
250
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_ENABLED}
|
|
251
|
+
*/
|
|
252
|
+
static get cobuildEnabled(): boolean | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* Provides a determined cobuild context id if configured
|
|
255
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}
|
|
256
|
+
*/
|
|
257
|
+
static get cobuildContextId(): string | undefined;
|
|
258
|
+
/**
|
|
259
|
+
* If set, enables or disables the cobuild leaf project log only feature.
|
|
260
|
+
* See {@link EnvironmentVariableNames.RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED}
|
|
261
|
+
*/
|
|
262
|
+
static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined;
|
|
222
263
|
/**
|
|
223
264
|
* Allows the git binary path to be explicitly provided.
|
|
224
265
|
* See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH}
|
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 } from './api/CommandLineConfiguration';
|
|
@@ -36,7 +37,7 @@ export { IOperationRunner, IOperationRunnerContext } from './logic/operations/IO
|
|
|
36
37
|
export { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
|
|
37
38
|
export { IOperationOptions, Operation } from './logic/operations/Operation';
|
|
38
39
|
export { OperationStatus } from './logic/operations/OperationStatus';
|
|
39
|
-
export { RushSession, IRushSessionOptions, CloudBuildCacheProviderFactory } from './pluginFramework/RushSession';
|
|
40
|
+
export { RushSession, IRushSessionOptions, CloudBuildCacheProviderFactory, CobuildLockProviderFactory } from './pluginFramework/RushSession';
|
|
40
41
|
export { IRushCommand, IGlobalCommand, IPhasedCommand, RushLifecycleHooks } from './pluginFramework/RushLifeCycle';
|
|
41
42
|
export { ICreateOperationsContext, PhasedCommandHooks } from './pluginFramework/PhasedCommandHooks';
|
|
42
43
|
export { IRushPlugin } from './pluginFramework/IRushPlugin';
|
|
@@ -44,6 +45,7 @@ export { IBuiltInPluginConfiguration as _IBuiltInPluginConfiguration } from './p
|
|
|
44
45
|
export { IRushPluginConfigurationBase as _IRushPluginConfigurationBase } from './api/RushPluginsConfiguration';
|
|
45
46
|
export { ILogger } from './pluginFramework/logging/Logger';
|
|
46
47
|
export { ICloudBuildCacheProvider } from './logic/buildCache/ICloudBuildCacheProvider';
|
|
48
|
+
export { ICobuildLockProvider, ICobuildContext, ICobuildCompletedState } from './logic/cobuild/ICobuildLockProvider';
|
|
47
49
|
export { ICredentialCacheOptions, ICredentialCacheEntry, CredentialCache } from './logic/CredentialCache';
|
|
48
50
|
export type { ITelemetryData, ITelemetryMachineInfo, ITelemetryOperationResult } from './logic/Telemetry';
|
|
49
51
|
export { IStopwatchResult } from './utilities/Stopwatch';
|
|
@@ -148,6 +148,15 @@ export declare class RushConstants {
|
|
|
148
148
|
* Changing this ensures that cache entries generated by an old version will no longer register as a cache hit.
|
|
149
149
|
*/
|
|
150
150
|
static readonly buildCacheVersion: number;
|
|
151
|
+
/**
|
|
152
|
+
* Cobuild configuration file.
|
|
153
|
+
*/
|
|
154
|
+
static readonly cobuildFilename: string;
|
|
155
|
+
/**
|
|
156
|
+
* Cobuild version number, incremented when the logic to create cobuild lock changes.
|
|
157
|
+
* Changing this ensures that lock generated by an old version will no longer access as a cobuild lock.
|
|
158
|
+
*/
|
|
159
|
+
static readonly cobuildLockVersion: number;
|
|
151
160
|
/**
|
|
152
161
|
* Per-project configuration filename.
|
|
153
162
|
*/
|
|
@@ -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,24 @@
|
|
|
1
|
+
import type { CobuildConfiguration } from '../../api/CobuildConfiguration';
|
|
2
|
+
import type { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
|
|
3
|
+
import type { OperationStatus } from '../operations/OperationStatus';
|
|
4
|
+
import type { ICobuildContext } from './ICobuildLockProvider';
|
|
5
|
+
export interface ICobuildLockOptions {
|
|
6
|
+
cobuildConfiguration: CobuildConfiguration;
|
|
7
|
+
projectBuildCache: ProjectBuildCache;
|
|
8
|
+
}
|
|
9
|
+
export interface ICobuildCompletedState {
|
|
10
|
+
status: OperationStatus.Success | OperationStatus.SuccessWithWarning | OperationStatus.Failure;
|
|
11
|
+
cacheId: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class CobuildLock {
|
|
14
|
+
readonly projectBuildCache: ProjectBuildCache;
|
|
15
|
+
readonly cobuildConfiguration: CobuildConfiguration;
|
|
16
|
+
private _cobuildContext;
|
|
17
|
+
constructor(options: ICobuildLockOptions);
|
|
18
|
+
setCompletedStateAsync(state: ICobuildCompletedState): Promise<void>;
|
|
19
|
+
getCompletedStateAsync(): Promise<ICobuildCompletedState | undefined>;
|
|
20
|
+
tryAcquireLockAsync(): Promise<boolean>;
|
|
21
|
+
renewLockAsync(): Promise<void>;
|
|
22
|
+
get cobuildContext(): ICobuildContext;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=CobuildLock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/cobuild/CobuildLock");
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { OperationStatus } from '../operations/OperationStatus';
|
|
2
|
+
/**
|
|
3
|
+
* @beta
|
|
4
|
+
*/
|
|
5
|
+
export interface ICobuildContext {
|
|
6
|
+
/**
|
|
7
|
+
* The contextId is provided by the monorepo maintainer, it reads from environment variable {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}.
|
|
8
|
+
* It ensure only the builds from the same given contextId cooperated. If user was more permissive,
|
|
9
|
+
* and wanted all PR and CI builds building anything with the same contextId to cooperate, then just
|
|
10
|
+
* set it to a static value.
|
|
11
|
+
*/
|
|
12
|
+
contextId: string;
|
|
13
|
+
/**
|
|
14
|
+
* The id of cache. It should be keep same as the normal cacheId from ProjectBuildCache.
|
|
15
|
+
* Otherwise, there is a discrepancy in the success case then turning on cobuilds will
|
|
16
|
+
* fail to populate the normal build cache.
|
|
17
|
+
*/
|
|
18
|
+
cacheId: string;
|
|
19
|
+
/**
|
|
20
|
+
* {@inheritdoc RushConstants.cobuildLockVersion}
|
|
21
|
+
*/
|
|
22
|
+
version: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
export interface ICobuildCompletedState {
|
|
28
|
+
status: OperationStatus.Success | OperationStatus.SuccessWithWarning | OperationStatus.Failure;
|
|
29
|
+
/**
|
|
30
|
+
* Completed state points to the cache id that was used to store the build cache.
|
|
31
|
+
* Note: Cache failed builds in a separate cache id
|
|
32
|
+
*/
|
|
33
|
+
cacheId: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @beta
|
|
37
|
+
*/
|
|
38
|
+
export interface ICobuildLockProvider {
|
|
39
|
+
connectAsync(): Promise<void>;
|
|
40
|
+
disconnectAsync(): Promise<void>;
|
|
41
|
+
acquireLockAsync(context: ICobuildContext): Promise<boolean>;
|
|
42
|
+
renewLockAsync(context: ICobuildContext): Promise<void>;
|
|
43
|
+
setCompletedStateAsync(context: ICobuildContext, state: ICobuildCompletedState): Promise<void>;
|
|
44
|
+
getCompletedStateAsync(context: ICobuildContext): Promise<ICobuildCompletedState | undefined>;
|
|
45
|
+
}
|
|
46
|
+
//# 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 declare 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,21 @@
|
|
|
1
|
+
import { CobuildLock } from '../cobuild/CobuildLock';
|
|
2
|
+
import { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
|
|
3
|
+
import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
|
|
4
|
+
export interface IOperationBuildCacheContext {
|
|
5
|
+
isCacheWriteAllowed: boolean;
|
|
6
|
+
isCacheReadAllowed: boolean;
|
|
7
|
+
isSkipAllowed: boolean;
|
|
8
|
+
projectBuildCache: ProjectBuildCache | undefined;
|
|
9
|
+
cobuildLock: CobuildLock | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare class CacheableOperationPlugin implements IPhasedCommandPlugin {
|
|
12
|
+
private _buildCacheContextByOperationRunner;
|
|
13
|
+
apply(hooks: PhasedCommandHooks): void;
|
|
14
|
+
private _applyShellOperationRunner;
|
|
15
|
+
private _getBuildCacheContextByRunner;
|
|
16
|
+
private _getBuildCacheContextByRunnerOrThrow;
|
|
17
|
+
private _tryGetProjectBuildCacheAsync;
|
|
18
|
+
private _tryGetLogOnlyProjectBuildCacheAsync;
|
|
19
|
+
private _tryGetCobuildLockAsync;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=CacheableOperationPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/CacheableOperationPlugin");
|
|
@@ -2,7 +2,7 @@ import type { StdioSummarizer } from '@rushstack/terminal';
|
|
|
2
2
|
import type { CollatedWriter } from '@rushstack/stream-collator';
|
|
3
3
|
import type { OperationStatus } from './OperationStatus';
|
|
4
4
|
import type { OperationMetadataManager } from './OperationMetadataManager';
|
|
5
|
-
import type {
|
|
5
|
+
import type { Stopwatch } from '../../utilities/Stopwatch';
|
|
6
6
|
/**
|
|
7
7
|
* Information passed to the executing `IOperationRunner`
|
|
8
8
|
*
|
|
@@ -34,7 +34,34 @@ export interface IOperationRunnerContext {
|
|
|
34
34
|
/**
|
|
35
35
|
* Object used to track elapsed time.
|
|
36
36
|
*/
|
|
37
|
-
stopwatch:
|
|
37
|
+
stopwatch: Stopwatch;
|
|
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
|
+
* The set of operations that depend on this operation.
|
|
52
|
+
*/
|
|
53
|
+
readonly consumers: Set<IOperationRunnerContext>;
|
|
54
|
+
/**
|
|
55
|
+
* The operation runner that is executing this operation.
|
|
56
|
+
*/
|
|
57
|
+
readonly runner: IOperationRunner;
|
|
58
|
+
/**
|
|
59
|
+
* Normally the incremental build logic will rebuild changed projects as well as
|
|
60
|
+
* any projects that directly or indirectly depend on a changed project.
|
|
61
|
+
* If true, then the incremental build logic will only rebuild changed projects and
|
|
62
|
+
* ignore dependent projects.
|
|
63
|
+
*/
|
|
64
|
+
readonly changedProjectsOnly: boolean;
|
|
38
65
|
}
|
|
39
66
|
/**
|
|
40
67
|
* The `Operation` class is a node in the dependency graph of work that needs to be scheduled by the
|
|
@@ -48,10 +75,6 @@ export interface IOperationRunner {
|
|
|
48
75
|
* Name of the operation, for logging.
|
|
49
76
|
*/
|
|
50
77
|
readonly name: string;
|
|
51
|
-
/**
|
|
52
|
-
* This flag determines if the operation is allowed to be skipped if up to date.
|
|
53
|
-
*/
|
|
54
|
-
isSkipAllowed: boolean;
|
|
55
78
|
/**
|
|
56
79
|
* Indicates that this runner's duration has meaning.
|
|
57
80
|
*/
|
|
@@ -65,10 +88,6 @@ export interface IOperationRunner {
|
|
|
65
88
|
* exit code
|
|
66
89
|
*/
|
|
67
90
|
warningsAreAllowed: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Indicates if the output of this operation may be written to the cache
|
|
70
|
-
*/
|
|
71
|
-
isCacheWriteAllowed: boolean;
|
|
72
91
|
/**
|
|
73
92
|
* Method to be executed for the operation.
|
|
74
93
|
*/
|
|
@@ -8,6 +8,8 @@ export interface IOperationExecutionManagerOptions {
|
|
|
8
8
|
parallelism: number;
|
|
9
9
|
changedProjectsOnly: boolean;
|
|
10
10
|
destination?: TerminalWritable;
|
|
11
|
+
beforeExecuteOperation?: (operation: OperationExecutionRecord) => Promise<void>;
|
|
12
|
+
afterExecuteOperation?: (operation: OperationExecutionRecord) => Promise<void>;
|
|
11
13
|
onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
|
|
12
14
|
beforeExecuteOperations?: (records: Map<Operation, OperationExecutionRecord>) => Promise<void>;
|
|
13
15
|
}
|
|
@@ -27,11 +29,14 @@ export declare class OperationExecutionManager {
|
|
|
27
29
|
private readonly _colorsNewlinesTransform;
|
|
28
30
|
private readonly _streamCollator;
|
|
29
31
|
private readonly _terminal;
|
|
32
|
+
private readonly _beforeExecuteOperation?;
|
|
33
|
+
private readonly _afterExecuteOperation?;
|
|
30
34
|
private readonly _onOperationStatusChanged?;
|
|
31
35
|
private readonly _beforeExecuteOperations?;
|
|
32
36
|
private _hasAnyFailures;
|
|
33
37
|
private _hasAnyNonAllowedWarnings;
|
|
34
38
|
private _completedOperations;
|
|
39
|
+
private _executionQueue;
|
|
35
40
|
constructor(operations: Set<Operation>, options: IOperationExecutionManagerOptions);
|
|
36
41
|
private _streamCollator_onWriterActive;
|
|
37
42
|
/**
|
|
@@ -10,9 +10,12 @@ export interface IOperationExecutionRecordContext {
|
|
|
10
10
|
onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
|
|
11
11
|
debugMode: boolean;
|
|
12
12
|
quietMode: boolean;
|
|
13
|
+
changedProjectsOnly: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Internal class representing everything about executing an operation
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
16
19
|
*/
|
|
17
20
|
export declare class OperationExecutionRecord implements IOperationRunnerContext {
|
|
18
21
|
/**
|
|
@@ -37,6 +40,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
|
|
|
37
40
|
* operation to execute, the operation with the highest criticalPathLength is chosen.
|
|
38
41
|
*
|
|
39
42
|
* Example:
|
|
43
|
+
* ```
|
|
40
44
|
* (0) A
|
|
41
45
|
* \
|
|
42
46
|
* (1) B C (0) (applications)
|
|
@@ -53,6 +57,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
|
|
|
53
57
|
* X has a score of 1, since the only package which depends on it is A
|
|
54
58
|
* Z has a score of 2, since only X depends on it, and X has a score of 1
|
|
55
59
|
* Y has a score of 2, since the chain Y->X->C is longer than Y->C
|
|
60
|
+
* ```
|
|
56
61
|
*
|
|
57
62
|
* The algorithm is implemented in AsyncOperationQueue.ts as calculateCriticalPathLength()
|
|
58
63
|
*/
|
|
@@ -76,8 +81,9 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
|
|
|
76
81
|
get name(): string;
|
|
77
82
|
get debugMode(): boolean;
|
|
78
83
|
get quietMode(): boolean;
|
|
84
|
+
get changedProjectsOnly(): boolean;
|
|
79
85
|
get collatedWriter(): CollatedWriter;
|
|
80
86
|
get nonCachedDurationMs(): number | undefined;
|
|
81
|
-
executeAsync(onResult: (record: OperationExecutionRecord) => void): Promise<void>;
|
|
87
|
+
executeAsync(onResult: (record: OperationExecutionRecord) => Promise<void>): Promise<void>;
|
|
82
88
|
}
|
|
83
89
|
//# sourceMappingURL=OperationExecutionRecord.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AsyncSeriesWaterfallHook } from 'tapable';
|
|
2
|
+
import type { ITerminal } from '@rushstack/node-core-library';
|
|
3
|
+
import type { IOperationRunnerContext } from './IOperationRunner';
|
|
4
|
+
import type { OperationStatus } from './OperationStatus';
|
|
5
|
+
import type { IProjectDeps, ShellOperationRunner } from './ShellOperationRunner';
|
|
6
|
+
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
7
|
+
import type { IPhase } from '../../api/CommandLineConfiguration';
|
|
8
|
+
/**
|
|
9
|
+
* A plugin tht interacts with a operation runner
|
|
10
|
+
*/
|
|
11
|
+
export interface IOperationRunnerPlugin {
|
|
12
|
+
/**
|
|
13
|
+
* Applies this plugin.
|
|
14
|
+
*/
|
|
15
|
+
apply(hooks: OperationRunnerHooks): void;
|
|
16
|
+
}
|
|
17
|
+
export interface IOperationRunnerBeforeExecuteContext {
|
|
18
|
+
context: IOperationRunnerContext;
|
|
19
|
+
runner: ShellOperationRunner;
|
|
20
|
+
earlyReturnStatus: OperationStatus | undefined;
|
|
21
|
+
terminal: ITerminal;
|
|
22
|
+
projectDeps: IProjectDeps | undefined;
|
|
23
|
+
lastProjectDeps: IProjectDeps | undefined;
|
|
24
|
+
trackedProjectFiles: string[] | undefined;
|
|
25
|
+
logPath: string;
|
|
26
|
+
errorLogPath: string;
|
|
27
|
+
rushProject: RushConfigurationProject;
|
|
28
|
+
phase: IPhase;
|
|
29
|
+
commandName: string;
|
|
30
|
+
commandToRun: string;
|
|
31
|
+
}
|
|
32
|
+
export interface IOperationRunnerAfterExecuteContext {
|
|
33
|
+
context: IOperationRunnerContext;
|
|
34
|
+
terminal: ITerminal;
|
|
35
|
+
/**
|
|
36
|
+
* Exit code of the operation command
|
|
37
|
+
*/
|
|
38
|
+
exitCode: number;
|
|
39
|
+
status: OperationStatus;
|
|
40
|
+
taskIsSuccessful: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Hooks into the lifecycle of the operation runner
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export declare class OperationRunnerHooks {
|
|
47
|
+
beforeExecute: AsyncSeriesWaterfallHook<IOperationRunnerBeforeExecuteContext>;
|
|
48
|
+
afterExecute: AsyncSeriesWaterfallHook<IOperationRunnerAfterExecuteContext>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=OperationRunnerHooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/OperationRunnerHooks");
|
|
@@ -7,10 +7,18 @@ export declare enum OperationStatus {
|
|
|
7
7
|
* The Operation is on the queue, ready to execute (but may be waiting for dependencies)
|
|
8
8
|
*/
|
|
9
9
|
Ready = "READY",
|
|
10
|
+
/**
|
|
11
|
+
* The Operation is Queued
|
|
12
|
+
*/
|
|
13
|
+
Queued = "QUEUED",
|
|
10
14
|
/**
|
|
11
15
|
* The Operation is currently executing
|
|
12
16
|
*/
|
|
13
17
|
Executing = "EXECUTING",
|
|
18
|
+
/**
|
|
19
|
+
* The Operation is currently executing by a remote process
|
|
20
|
+
*/
|
|
21
|
+
RemoteExecuting = "REMOTE EXECUTING",
|
|
14
22
|
/**
|
|
15
23
|
* The Operation completed successfully and did not write to standard output
|
|
16
24
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare type ICallbackFn = () => Promise<void> | void;
|
|
2
|
+
export interface IPeriodicCallbackOptions {
|
|
3
|
+
interval: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A help class to run callbacks in a loop with a specified interval.
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare class PeriodicCallback {
|
|
11
|
+
private _callbacks;
|
|
12
|
+
private _interval;
|
|
13
|
+
private _intervalId;
|
|
14
|
+
private _isRunning;
|
|
15
|
+
constructor(options: IPeriodicCallbackOptions);
|
|
16
|
+
addCallback(callback: ICallbackFn): void;
|
|
17
|
+
start(): void;
|
|
18
|
+
stop(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=PeriodicCallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/PeriodicCallback");
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { OperationStatus } from './OperationStatus';
|
|
2
2
|
import { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
|
|
3
|
+
import { PeriodicCallback } from './PeriodicCallback';
|
|
4
|
+
import { OperationRunnerHooks } from './OperationRunnerHooks';
|
|
3
5
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
4
6
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
5
7
|
import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
|
|
6
|
-
import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
|
|
7
8
|
import type { IPhase } from '../../api/CommandLineConfiguration';
|
|
8
9
|
export interface IProjectDeps {
|
|
9
10
|
files: {
|
|
@@ -14,9 +15,7 @@ export interface IProjectDeps {
|
|
|
14
15
|
export interface IOperationRunnerOptions {
|
|
15
16
|
rushProject: RushConfigurationProject;
|
|
16
17
|
rushConfiguration: RushConfiguration;
|
|
17
|
-
buildCacheConfiguration: BuildCacheConfiguration | undefined;
|
|
18
18
|
commandToRun: string;
|
|
19
|
-
isIncrementalBuildAllowed: boolean;
|
|
20
19
|
projectChangeAnalyzer: ProjectChangeAnalyzer;
|
|
21
20
|
displayName: string;
|
|
22
21
|
phase: IPhase;
|
|
@@ -32,31 +31,23 @@ export interface IOperationRunnerOptions {
|
|
|
32
31
|
*/
|
|
33
32
|
export declare class ShellOperationRunner implements IOperationRunner {
|
|
34
33
|
readonly name: string;
|
|
35
|
-
isCacheWriteAllowed: boolean;
|
|
36
|
-
isSkipAllowed: boolean;
|
|
37
34
|
readonly reportTiming: boolean;
|
|
38
35
|
readonly silent: boolean;
|
|
39
36
|
readonly warningsAreAllowed: boolean;
|
|
37
|
+
readonly hooks: OperationRunnerHooks;
|
|
38
|
+
readonly periodicCallback: PeriodicCallback;
|
|
40
39
|
private readonly _rushProject;
|
|
41
40
|
private readonly _phase;
|
|
42
41
|
private readonly _rushConfiguration;
|
|
43
|
-
private readonly _buildCacheConfiguration;
|
|
44
42
|
private readonly _commandName;
|
|
45
43
|
private readonly _commandToRun;
|
|
46
|
-
private readonly _isCacheReadAllowed;
|
|
47
44
|
private readonly _projectChangeAnalyzer;
|
|
48
45
|
private readonly _packageDepsFilename;
|
|
49
46
|
private readonly _logFilenameIdentifier;
|
|
50
47
|
private readonly _selectedPhases;
|
|
51
|
-
/**
|
|
52
|
-
* UNINITIALIZED === we haven't tried to initialize yet
|
|
53
|
-
* undefined === we didn't create one because the feature is not enabled
|
|
54
|
-
*/
|
|
55
|
-
private _projectBuildCache;
|
|
56
48
|
constructor(options: IOperationRunnerOptions);
|
|
57
49
|
executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
|
|
58
50
|
private _executeAsync;
|
|
59
|
-
private _tryGetProjectBuildCacheAsync;
|
|
60
51
|
}
|
|
61
52
|
/**
|
|
62
53
|
* When running a command from the "scripts" block in package.json, if the command
|
|
@@ -6,7 +6,9 @@ import type { RushConfiguration } from '../api/RushConfiguration';
|
|
|
6
6
|
import type { RushConfigurationProject } from '../api/RushConfigurationProject';
|
|
7
7
|
import type { Operation } from '../logic/operations/Operation';
|
|
8
8
|
import type { ProjectChangeAnalyzer } from '../logic/ProjectChangeAnalyzer';
|
|
9
|
-
import { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
|
|
9
|
+
import type { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
|
|
10
|
+
import type { CobuildConfiguration } from '../api/CobuildConfiguration';
|
|
11
|
+
import type { IOperationRunnerContext } from '../logic/operations/IOperationRunner';
|
|
10
12
|
/**
|
|
11
13
|
* A plugin that interacts with a phased commands.
|
|
12
14
|
* @alpha
|
|
@@ -26,6 +28,10 @@ export interface ICreateOperationsContext {
|
|
|
26
28
|
* The configuration for the build cache, if the feature is enabled.
|
|
27
29
|
*/
|
|
28
30
|
readonly buildCacheConfiguration: BuildCacheConfiguration | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The configuration for the cobuild, if cobuild feature and build cache feature are both enabled.
|
|
33
|
+
*/
|
|
34
|
+
readonly cobuildConfiguration: CobuildConfiguration | undefined;
|
|
29
35
|
/**
|
|
30
36
|
* The set of custom parameters for the executing command.
|
|
31
37
|
* Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
|
|
@@ -97,6 +103,14 @@ export declare class PhasedCommandHooks {
|
|
|
97
103
|
* Hook is series for stable output.
|
|
98
104
|
*/
|
|
99
105
|
readonly afterExecuteOperations: AsyncSeriesHook<[IExecutionResult, ICreateOperationsContext]>;
|
|
106
|
+
/**
|
|
107
|
+
* Hook invoked before executing a operation.
|
|
108
|
+
*/
|
|
109
|
+
readonly beforeExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
|
|
110
|
+
/**
|
|
111
|
+
* Hook invoked after executing a operation.
|
|
112
|
+
*/
|
|
113
|
+
readonly afterExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
|
|
100
114
|
/**
|
|
101
115
|
* Hook invoked after a run has finished and the command is watching for changes.
|
|
102
116
|
* May be used to display additional relevant data to the user.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ITerminalProvider } from '@rushstack/node-core-library';
|
|
2
|
-
import { IBuildCacheJson } from '../api/BuildCacheConfiguration';
|
|
3
|
-
import { ICloudBuildCacheProvider } from '../logic/buildCache/ICloudBuildCacheProvider';
|
|
4
2
|
import { ILogger } from './logging/Logger';
|
|
5
3
|
import { RushLifecycleHooks } from './RushLifeCycle';
|
|
4
|
+
import type { IBuildCacheJson } from '../api/BuildCacheConfiguration';
|
|
5
|
+
import type { ICloudBuildCacheProvider } from '../logic/buildCache/ICloudBuildCacheProvider';
|
|
6
|
+
import type { ICobuildJson } from '../api/CobuildConfiguration';
|
|
7
|
+
import type { ICobuildLockProvider } from '../logic/cobuild/ICobuildLockProvider';
|
|
6
8
|
/**
|
|
7
9
|
* @beta
|
|
8
10
|
*/
|
|
@@ -14,17 +16,24 @@ export interface IRushSessionOptions {
|
|
|
14
16
|
* @beta
|
|
15
17
|
*/
|
|
16
18
|
export declare type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) => ICloudBuildCacheProvider;
|
|
19
|
+
/**
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
export declare type CobuildLockProviderFactory = (cobuildJson: ICobuildJson) => ICobuildLockProvider;
|
|
17
23
|
/**
|
|
18
24
|
* @beta
|
|
19
25
|
*/
|
|
20
26
|
export declare class RushSession {
|
|
21
27
|
private readonly _options;
|
|
22
28
|
private readonly _cloudBuildCacheProviderFactories;
|
|
29
|
+
private readonly _cobuildLockProviderFactories;
|
|
23
30
|
readonly hooks: RushLifecycleHooks;
|
|
24
31
|
constructor(options: IRushSessionOptions);
|
|
25
32
|
getLogger(name: string): ILogger;
|
|
26
33
|
get terminalProvider(): ITerminalProvider;
|
|
27
34
|
registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void;
|
|
28
35
|
getCloudBuildCacheProviderFactory(cacheProviderName: string): CloudBuildCacheProviderFactory | undefined;
|
|
36
|
+
registerCobuildLockProviderFactory(cobuildLockProviderName: string, factory: CobuildLockProviderFactory): void;
|
|
37
|
+
getCobuildLockProviderFactory(cobuildLockProviderName: string): CobuildLockProviderFactory | undefined;
|
|
29
38
|
}
|
|
30
39
|
//# sourceMappingURL=RushSession.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/rush-sdk",
|
|
3
|
-
"version": "5.97.0",
|
|
3
|
+
"version": "5.97.1-pr3949.0",
|
|
4
4
|
"description": "An API for interacting with the Rush engine",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@types/heft-jest": "1.0.1",
|
|
21
21
|
"@types/semver": "7.3.5",
|
|
22
22
|
"@types/webpack-env": "1.18.0",
|
|
23
|
-
"@microsoft/rush-lib": "5.97.0",
|
|
23
|
+
"@microsoft/rush-lib": "5.97.1-pr3949.0",
|
|
24
24
|
"@rushstack/eslint-config": "3.2.0",
|
|
25
25
|
"@rushstack/heft": "0.50.0",
|
|
26
26
|
"@rushstack/heft-node-rig": "1.12.6",
|