@rushstack/rush-sdk 5.96.0 → 5.97.1-pr3949

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.
Files changed (29) hide show
  1. package/dist/rush-lib.d.ts +279 -29
  2. package/lib/api/CobuildConfiguration.d.ts +63 -0
  3. package/lib/api/CobuildConfiguration.js +1 -0
  4. package/lib/api/EnvironmentConfiguration.d.ts +61 -20
  5. package/lib/index.d.ts +3 -1
  6. package/lib/logic/RushConstants.d.ts +9 -0
  7. package/lib/logic/buildCache/ProjectBuildCache.d.ts +5 -4
  8. package/lib/logic/cobuild/CobuildLock.d.ts +24 -0
  9. package/lib/logic/cobuild/CobuildLock.js +1 -0
  10. package/lib/logic/cobuild/ICobuildLockProvider.d.ts +46 -0
  11. package/lib/logic/cobuild/ICobuildLockProvider.js +1 -0
  12. package/lib/logic/operations/AsyncOperationQueue.d.ts +23 -4
  13. package/lib/logic/operations/CacheableOperationPlugin.d.ts +21 -0
  14. package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
  15. package/lib/logic/operations/IOperationRunner.d.ts +29 -10
  16. package/lib/logic/operations/OperationExecutionManager.d.ts +5 -0
  17. package/lib/logic/operations/OperationExecutionRecord.d.ts +7 -1
  18. package/lib/logic/operations/OperationRunnerHooks.d.ts +50 -0
  19. package/lib/logic/operations/OperationRunnerHooks.js +1 -0
  20. package/lib/logic/operations/OperationStatus.d.ts +8 -0
  21. package/lib/logic/operations/PeriodicCallback.d.ts +20 -0
  22. package/lib/logic/operations/PeriodicCallback.js +1 -0
  23. package/lib/logic/operations/ShellOperationRunner.d.ts +4 -13
  24. package/lib/pluginFramework/PhasedCommandHooks.d.ts +15 -1
  25. package/lib/pluginFramework/RushSession.d.ts +11 -2
  26. package/lib-shim/index.d.ts.map +1 -1
  27. package/lib-shim/index.js +5 -5
  28. package/lib-shim/index.js.map +1 -1
  29. package/package.json +5 -5
@@ -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}
@@ -440,7 +507,7 @@ export declare class EnvironmentConfiguration {
440
507
  * Names of environment variables used by Rush.
441
508
  * @beta
442
509
  */
443
- export declare enum EnvironmentVariableNames {
510
+ export declare const EnvironmentVariableNames: {
444
511
  /**
445
512
  * This variable overrides the temporary folder used by Rush.
446
513
  * The default value is "common/temp" under the repository root.
@@ -448,43 +515,43 @@ export declare enum EnvironmentVariableNames {
448
515
  * @remarks This environment variable is not compatible with workspace installs. If attempting
449
516
  * to move the PNPM store path, see the `RUSH_PNPM_STORE_PATH` environment variable.
450
517
  */
451
- RUSH_TEMP_FOLDER = "RUSH_TEMP_FOLDER",
518
+ readonly RUSH_TEMP_FOLDER: "RUSH_TEMP_FOLDER";
452
519
  /**
453
520
  * This variable overrides the version of Rush that will be installed by
454
521
  * the version selector. The default value is determined by the "rushVersion"
455
522
  * field from rush.json.
456
523
  */
457
- RUSH_PREVIEW_VERSION = "RUSH_PREVIEW_VERSION",
524
+ readonly RUSH_PREVIEW_VERSION: "RUSH_PREVIEW_VERSION";
458
525
  /**
459
526
  * If this variable is set to "1", Rush will not fail the build when running a version
460
527
  * of Node that does not match the criteria specified in the "nodeSupportedVersionRange"
461
528
  * field from rush.json.
462
529
  */
463
- RUSH_ALLOW_UNSUPPORTED_NODEJS = "RUSH_ALLOW_UNSUPPORTED_NODEJS",
530
+ readonly RUSH_ALLOW_UNSUPPORTED_NODEJS: "RUSH_ALLOW_UNSUPPORTED_NODEJS";
464
531
  /**
465
532
  * Setting this environment variable overrides the value of `allowWarningsInSuccessfulBuild`
466
533
  * in the `command-line.json` configuration file. Specify `1` to allow warnings in a successful build,
467
534
  * or `0` to disallow them. (See the comments in the command-line.json file for more information).
468
535
  */
469
- RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD = "RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD",
536
+ readonly RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD: "RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD";
470
537
  /**
471
538
  * This variable selects a specific installation variant for Rush to use when installing
472
539
  * and linking package dependencies.
473
540
  * For more information, see the command-line help for the `--variant` parameter
474
541
  * and this article: https://rushjs.io/pages/advanced/installation_variants/
475
542
  */
476
- RUSH_VARIANT = "RUSH_VARIANT",
543
+ readonly RUSH_VARIANT: "RUSH_VARIANT";
477
544
  /**
478
545
  * Specifies the maximum number of concurrent processes to launch during a build.
479
546
  * For more information, see the command-line help for the `--parallelism` parameter for "rush build".
480
547
  */
481
- RUSH_PARALLELISM = "RUSH_PARALLELISM",
548
+ readonly RUSH_PARALLELISM: "RUSH_PARALLELISM";
482
549
  /**
483
550
  * If this variable is set to "1", Rush will create symlinks with absolute paths instead
484
551
  * of relative paths. This can be necessary when a repository is moved during a build or
485
552
  * if parts of a repository are moved into a sandbox.
486
553
  */
487
- RUSH_ABSOLUTE_SYMLINKS = "RUSH_ABSOLUTE_SYMLINKS",
554
+ readonly RUSH_ABSOLUTE_SYMLINKS: "RUSH_ABSOLUTE_SYMLINKS";
488
555
  /**
489
556
  * When using PNPM as the package manager, this variable can be used to configure the path that
490
557
  * PNPM will use as the store directory.
@@ -492,18 +559,18 @@ export declare enum EnvironmentVariableNames {
492
559
  * If a relative path is used, then the store path will be resolved relative to the process's
493
560
  * current working directory. An absolute path is recommended.
494
561
  */
495
- RUSH_PNPM_STORE_PATH = "RUSH_PNPM_STORE_PATH",
562
+ readonly RUSH_PNPM_STORE_PATH: "RUSH_PNPM_STORE_PATH";
496
563
  /**
497
564
  * When using PNPM as the package manager, this variable can be used to control whether or not PNPM
498
565
  * validates the integrity of the PNPM store during installation. The value of this environment variable must be
499
566
  * `1` (for true) or `0` (for false). If not specified, defaults to the value in .npmrc.
500
567
  */
501
- RUSH_PNPM_VERIFY_STORE_INTEGRITY = "RUSH_PNPM_VERIFY_STORE_INTEGRITY",
568
+ readonly RUSH_PNPM_VERIFY_STORE_INTEGRITY: "RUSH_PNPM_VERIFY_STORE_INTEGRITY";
502
569
  /**
503
570
  * This environment variable can be used to specify the `--target-folder` parameter
504
571
  * for the "rush deploy" command.
505
572
  */
506
- RUSH_DEPLOY_TARGET_FOLDER = "RUSH_DEPLOY_TARGET_FOLDER",
573
+ readonly RUSH_DEPLOY_TARGET_FOLDER: "RUSH_DEPLOY_TARGET_FOLDER";
507
574
  /**
508
575
  * Overrides the location of the `~/.rush` global folder where Rush stores temporary files.
509
576
  *
@@ -520,7 +587,7 @@ export declare enum EnvironmentVariableNames {
520
587
  *
521
588
  * POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
522
589
  */
523
- RUSH_GLOBAL_FOLDER = "RUSH_GLOBAL_FOLDER",
590
+ readonly RUSH_GLOBAL_FOLDER: "RUSH_GLOBAL_FOLDER";
524
591
  /**
525
592
  * Provides a credential for a remote build cache, if configured. This credential overrides any cached credentials.
526
593
  *
@@ -534,7 +601,7 @@ export declare enum EnvironmentVariableNames {
534
601
  *
535
602
  * For information on SAS tokens, see here: https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview
536
603
  */
537
- RUSH_BUILD_CACHE_CREDENTIAL = "RUSH_BUILD_CACHE_CREDENTIAL",
604
+ readonly RUSH_BUILD_CACHE_CREDENTIAL: "RUSH_BUILD_CACHE_CREDENTIAL";
538
605
  /**
539
606
  * Setting this environment variable overrides the value of `buildCacheEnabled` in the `build-cache.json`
540
607
  * configuration file.
@@ -544,26 +611,49 @@ export declare enum EnvironmentVariableNames {
544
611
  *
545
612
  * If there is no build cache configured, then this environment variable is ignored.
546
613
  */
547
- RUSH_BUILD_CACHE_ENABLED = "RUSH_BUILD_CACHE_ENABLED",
614
+ readonly RUSH_BUILD_CACHE_ENABLED: "RUSH_BUILD_CACHE_ENABLED";
548
615
  /**
549
616
  * Overrides the value of `isCacheWriteAllowed` in the `build-cache.json` configuration file. The value of this
550
617
  * environment variable must be `1` (for true) or `0` (for false). If there is no build cache configured, then
551
618
  * this environment variable is ignored.
552
619
  */
553
- RUSH_BUILD_CACHE_WRITE_ALLOWED = "RUSH_BUILD_CACHE_WRITE_ALLOWED",
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
  */
557
- RUSH_GIT_BINARY_PATH = "RUSH_GIT_BINARY_PATH",
647
+ readonly RUSH_GIT_BINARY_PATH: "RUSH_GIT_BINARY_PATH";
558
648
  /**
559
649
  * Explicitly specifies the path for the `tar` binary that is invoked by certain Rush operations.
560
650
  */
561
- RUSH_TAR_BINARY_PATH = "RUSH_TAR_BINARY_PATH",
651
+ readonly RUSH_TAR_BINARY_PATH: "RUSH_TAR_BINARY_PATH";
562
652
  /**
563
653
  * Internal variable that explicitly specifies the path for the version of `@microsoft/rush-lib` being executed.
564
654
  * Will be set upon loading Rush.
565
655
  */
566
- RUSH_LIB_PATH = "_RUSH_LIB_PATH",
656
+ readonly RUSH_LIB_PATH: "_RUSH_LIB_PATH";
567
657
  /**
568
658
  * When Rush executes shell scripts, it sometimes changes the working directory to be a project folder or
569
659
  * the repository root folder. The original working directory (where the Rush command was invoked) is assigned
@@ -573,8 +663,8 @@ export declare enum EnvironmentVariableNames {
573
663
  * The `RUSH_INVOKED_FOLDER` variable is the same idea as the `INIT_CWD` variable that package managers
574
664
  * assign when they execute lifecycle scripts.
575
665
  */
576
- RUSH_INVOKED_FOLDER = "RUSH_INVOKED_FOLDER"
577
- }
666
+ readonly RUSH_INVOKED_FOLDER: "RUSH_INVOKED_FOLDER";
667
+ };
578
668
 
579
669
  /**
580
670
  * Events happen during Rush runs.
@@ -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: IStopwatchResult;
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");