@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.
Files changed (36) hide show
  1. package/dist/rush-lib.d.ts +419 -10
  2. package/lib/api/CobuildConfiguration.d.ts +71 -0
  3. package/lib/api/CobuildConfiguration.js +1 -0
  4. package/lib/api/EnvironmentConfiguration.d.ts +45 -0
  5. package/lib/api/RushProjectConfiguration.d.ts +19 -5
  6. package/lib/index.d.ts +5 -2
  7. package/lib/logic/RushConstants.d.ts +4 -0
  8. package/lib/logic/buildCache/ProjectBuildCache.d.ts +6 -7
  9. package/lib/logic/cobuild/CobuildLock.d.ts +43 -0
  10. package/lib/logic/cobuild/CobuildLock.js +1 -0
  11. package/lib/logic/cobuild/DisjointSet.d.ts +28 -0
  12. package/lib/logic/cobuild/DisjointSet.js +1 -0
  13. package/lib/logic/cobuild/ICobuildLockProvider.d.ts +99 -0
  14. package/lib/logic/cobuild/ICobuildLockProvider.js +1 -0
  15. package/lib/logic/operations/AsyncOperationQueue.d.ts +23 -4
  16. package/lib/logic/operations/CacheableOperationPlugin.d.ts +51 -0
  17. package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
  18. package/lib/logic/operations/IOperationExecutionResult.d.ts +9 -1
  19. package/lib/logic/operations/IOperationRunner.d.ts +25 -6
  20. package/lib/logic/operations/LegacySkipPlugin.d.ts +22 -0
  21. package/lib/logic/operations/LegacySkipPlugin.js +1 -0
  22. package/lib/logic/operations/NullOperationRunner.d.ts +2 -2
  23. package/lib/logic/operations/OperationExecutionManager.d.ts +6 -0
  24. package/lib/logic/operations/OperationExecutionRecord.d.ts +19 -1
  25. package/lib/logic/operations/OperationMetadataManager.d.ts +3 -1
  26. package/lib/logic/operations/OperationStateFile.d.ts +2 -0
  27. package/lib/logic/operations/OperationStatus.d.ts +8 -0
  28. package/lib/logic/operations/PeriodicCallback.d.ts +20 -0
  29. package/lib/logic/operations/PeriodicCallback.js +1 -0
  30. package/lib/logic/operations/ProjectLogWritable.d.ts +11 -0
  31. package/lib/logic/operations/ShellOperationRunner.d.ts +4 -26
  32. package/lib/pluginFramework/PhasedCommandHooks.d.ts +31 -4
  33. package/lib/pluginFramework/RushSession.d.ts +11 -2
  34. package/lib/utilities/NullTerminalProvider.d.ts +10 -0
  35. package/lib/utilities/NullTerminalProvider.js +1 -0
  36. package/package.json +2 -2
@@ -6,6 +6,7 @@
6
6
  /// <reference types="node" />
7
7
 
8
8
  import { AsyncParallelHook } from 'tapable';
9
+ import { AsyncSeriesBailHook } from 'tapable';
9
10
  import { AsyncSeriesHook } from 'tapable';
10
11
  import { AsyncSeriesWaterfallHook } from 'tapable';
11
12
  import type { CollatedWriter } from '@rushstack/stream-collator';
@@ -209,6 +210,62 @@ export declare class ChangeManager {
209
210
  */
210
211
  export declare type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) => ICloudBuildCacheProvider | Promise<ICloudBuildCacheProvider>;
211
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 cobuildFeatureEnabled: 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
+ * This is a name of the participating cobuild runner. It can be specified by the environment variable
239
+ * RUSH_COBUILD_RUNNER_ID. If it is not provided, a random id will be generated to identify the runner.
240
+ */
241
+ readonly cobuildRunnerId: string;
242
+ /**
243
+ * If true, Rush will automatically handle the leaf project with build cache "disabled" by writing
244
+ * to the cache in a special "log files only mode". This is useful when you want to use Cobuilds
245
+ * to improve the performance in CI validations and the leaf projects have not enabled cache.
246
+ */
247
+ readonly cobuildLeafProjectLogOnlyAllowed: boolean;
248
+ private _cobuildLockProvider;
249
+ private readonly _cobuildLockProviderFactory;
250
+ private readonly _cobuildJson;
251
+ private constructor();
252
+ /**
253
+ * Attempts to load the cobuild.json data from the standard file path `common/config/rush/cobuild.json`.
254
+ * If the file has not been created yet, then undefined is returned.
255
+ */
256
+ static tryLoadAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise<CobuildConfiguration | undefined>;
257
+ static getCobuildConfigFilePath(rushConfiguration: RushConfiguration): string;
258
+ private static _loadAsync;
259
+ createLockProviderAsync(terminal: ITerminal): Promise<void>;
260
+ destroyLockProviderAsync(): Promise<void>;
261
+ getCobuildLockProvider(): ICobuildLockProvider;
262
+ }
263
+
264
+ /**
265
+ * @beta
266
+ */
267
+ export declare type CobuildLockProviderFactory = (cobuildJson: ICobuildJson) => ICobuildLockProvider | Promise<ICobuildLockProvider>;
268
+
212
269
  /**
213
270
  * Use this class to load and save the "common/config/rush/common-versions.json" config file.
214
271
  * This config file stores dependency version information that affects all projects in the repo.
@@ -390,6 +447,9 @@ export declare class EnvironmentConfiguration {
390
447
  private static _buildCacheCredential;
391
448
  private static _buildCacheEnabled;
392
449
  private static _buildCacheWriteAllowed;
450
+ private static _cobuildContextId;
451
+ private static _cobuildRunnerId;
452
+ private static _cobuildLeafProjectLogOnlyAllowed;
393
453
  private static _gitBinaryPath;
394
454
  private static _tarBinaryPath;
395
455
  /**
@@ -445,6 +505,21 @@ export declare class EnvironmentConfiguration {
445
505
  * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED}
446
506
  */
447
507
  static get buildCacheWriteAllowed(): boolean | undefined;
508
+ /**
509
+ * Provides a determined cobuild context id if configured
510
+ * See {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}
511
+ */
512
+ static get cobuildContextId(): string | undefined;
513
+ /**
514
+ * Provides a determined cobuild runner id if configured
515
+ * See {@link EnvironmentVariableNames.RUSH_COBUILD_RUNNER_ID}
516
+ */
517
+ static get cobuildRunnerId(): string | undefined;
518
+ /**
519
+ * If set, enables or disables the cobuild leaf project log only feature.
520
+ * See {@link EnvironmentVariableNames.RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED}
521
+ */
522
+ static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined;
448
523
  /**
449
524
  * Allows the git binary path to be explicitly provided.
450
525
  * See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH}
@@ -602,6 +677,33 @@ export declare const EnvironmentVariableNames: {
602
677
  * this environment variable is ignored.
603
678
  */
604
679
  readonly RUSH_BUILD_CACHE_WRITE_ALLOWED: "RUSH_BUILD_CACHE_WRITE_ALLOWED";
680
+ /**
681
+ * Setting this environment variable opts into running with cobuilds. The context id should be the same across
682
+ * multiple VMs, but changed when it is a new round of cobuilds.
683
+ *
684
+ * e.g. `Build.BuildNumber` in Azure DevOps Pipeline.
685
+ *
686
+ * @remarks
687
+ * If there is no cobuild configured, then this environment variable is ignored.
688
+ */
689
+ readonly RUSH_COBUILD_CONTEXT_ID: "RUSH_COBUILD_CONTEXT_ID";
690
+ /**
691
+ * Explicitly specifies a name for each participating cobuild runner.
692
+ *
693
+ * Setting this environment variable opts into running with cobuilds.
694
+ *
695
+ * @remarks
696
+ * This environment variable is optional, if it is not provided, a random id is used.
697
+ *
698
+ * If there is no cobuild configured, then this environment variable is ignored.
699
+ */
700
+ readonly RUSH_COBUILD_RUNNER_ID: "RUSH_COBUILD_RUNNER_ID";
701
+ /**
702
+ * If this variable is set to "1", When getting distributed builds, Rush will automatically handle the leaf project
703
+ * with build cache "disabled" by writing to the cache in a special "log files only mode". This is useful when you
704
+ * want to use Cobuilds to improve the performance in CI validations and the leaf projects have not enabled cache.
705
+ */
706
+ readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED";
605
707
  /**
606
708
  * Explicitly specifies the path for the Git binary that is invoked by certain Rush operations.
607
709
  */
@@ -765,6 +867,114 @@ export declare interface ICloudBuildCacheProvider {
765
867
  deleteCachedCredentialsAsync(terminal: ITerminal): Promise<void>;
766
868
  }
767
869
 
870
+ /**
871
+ * @beta
872
+ */
873
+ export declare interface ICobuildCompletedState {
874
+ status: OperationStatus.Success | OperationStatus.SuccessWithWarning | OperationStatus.Failure;
875
+ /**
876
+ * Completed state points to the cache id that was used to store the build cache.
877
+ * Note: Cache failed builds in a separate cache id
878
+ */
879
+ cacheId: string;
880
+ }
881
+
882
+ /**
883
+ * @beta
884
+ */
885
+ export declare interface ICobuildContext {
886
+ /**
887
+ * The key for acquiring lock.
888
+ */
889
+ lockKey: string;
890
+ /**
891
+ * The expire time of the lock in seconds.
892
+ */
893
+ lockExpireTimeInSeconds: number;
894
+ /**
895
+ * The key for storing completed state.
896
+ */
897
+ completedStateKey: string;
898
+ /**
899
+ * The contextId is provided by the monorepo maintainer, it reads from environment variable {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}.
900
+ * It ensure only the builds from the same given contextId cooperated.
901
+ */
902
+ contextId: string;
903
+ /**
904
+ * The id of the cluster. The operations in the same cluster share the same clusterId and
905
+ * will be executed on the same machine.
906
+ */
907
+ clusterId: string;
908
+ /**
909
+ * The id of the runner. The identifier for the running machine.
910
+ *
911
+ * It can be specified via assigning `RUSH_COBUILD_RUNNER_ID` environment variable.
912
+ */
913
+ runnerId: string;
914
+ /**
915
+ * The id of the cache entry. It should be kept the same as the normal cacheId from ProjectBuildCache.
916
+ * Otherwise, there is a discrepancy in the success case wherein turning on cobuilds will
917
+ * fail to populate the normal build cache.
918
+ */
919
+ cacheId: string;
920
+ /**
921
+ * The name of NPM package
922
+ *
923
+ * Example: `@scope/MyProject`
924
+ */
925
+ packageName: string;
926
+ /**
927
+ * The name of the phase.
928
+ *
929
+ * Example: _phase:build
930
+ */
931
+ phaseName: string;
932
+ }
933
+
934
+ /**
935
+ * @beta
936
+ */
937
+ export declare interface ICobuildJson {
938
+ cobuildFeatureEnabled: boolean;
939
+ cobuildLockProvider: string;
940
+ }
941
+
942
+ /**
943
+ * @beta
944
+ */
945
+ export declare interface ICobuildLockProvider {
946
+ /**
947
+ * The callback function invoked to connect to the lock provider.
948
+ * For example, initializing the connection to the redis server.
949
+ */
950
+ connectAsync(): Promise<void>;
951
+ /**
952
+ * The callback function invoked to disconnect the lock provider.
953
+ */
954
+ disconnectAsync(): Promise<void>;
955
+ /**
956
+ * The callback function to acquire a lock with a lock key and specific contexts.
957
+ *
958
+ * NOTE: This lock implementation must be a ReentrantLock. It says the lock might be acquired
959
+ * multiple times, since tasks in the same cluster can be run in the same VM.
960
+ */
961
+ acquireLockAsync(context: Readonly<ICobuildContext>): Promise<boolean>;
962
+ /**
963
+ * The callback function to renew a lock with a lock key and specific contexts.
964
+ *
965
+ * NOTE: If the lock key expired
966
+ */
967
+ renewLockAsync(context: Readonly<ICobuildContext>): Promise<void>;
968
+ /**
969
+ * The callback function to set completed state.
970
+ */
971
+ setCompletedStateAsync(context: Readonly<ICobuildContext>, state: ICobuildCompletedState): Promise<void>;
972
+ /**
973
+ * The callback function to get completed state.
974
+ */
975
+ getCompletedStateAsync(context: Readonly<ICobuildContext>): Promise<ICobuildCompletedState | undefined>;
976
+ }
977
+
768
978
  /**
769
979
  * A collection of environment variables
770
980
  * @public
@@ -802,6 +1012,10 @@ export declare interface ICreateOperationsContext {
802
1012
  * The configuration for the build cache, if the feature is enabled.
803
1013
  */
804
1014
  readonly buildCacheConfiguration: BuildCacheConfiguration | undefined;
1015
+ /**
1016
+ * The configuration for the cobuild, if cobuild feature and build cache feature are both enabled.
1017
+ */
1018
+ readonly cobuildConfiguration: CobuildConfiguration | undefined;
805
1019
  /**
806
1020
  * The set of custom parameters for the executing command.
807
1021
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
@@ -837,6 +1051,10 @@ export declare interface ICreateOperationsContext {
837
1051
  * The set of Rush projects selected for the current command execution.
838
1052
  */
839
1053
  readonly projectSelection: ReadonlySet<RushConfigurationProject>;
1054
+ /**
1055
+ * All successfully loaded rush-project.json data for selected projects.
1056
+ */
1057
+ readonly projectConfigurations: ReadonlyMap<RushConfigurationProject, RushProjectConfiguration>;
840
1058
  /**
841
1059
  * The set of Rush projects that have not been built in the current process since they were last modified.
842
1060
  * When `isInitial` is true, this will be an exact match of `projectSelection`.
@@ -1182,6 +1400,10 @@ export declare interface _INpmOptionsJson extends IPackageManagerOptionsJsonBase
1182
1400
  * @alpha
1183
1401
  */
1184
1402
  export declare interface IOperationExecutionResult {
1403
+ /**
1404
+ * The operation itself
1405
+ */
1406
+ readonly operation: Operation;
1185
1407
  /**
1186
1408
  * The current execution status of an operation. Operations start in the 'ready' state,
1187
1409
  * but can be 'blocked' if an upstream operation failed. It is 'executing' when
@@ -1206,6 +1428,10 @@ export declare interface IOperationExecutionResult {
1206
1428
  * The value indicates the duration of the same operation without cache hit.
1207
1429
  */
1208
1430
  readonly nonCachedDurationMs: number | undefined;
1431
+ /**
1432
+ * The id of the runner which actually runs the building process in cobuild mode.
1433
+ */
1434
+ readonly cobuildRunnerId: string | undefined;
1209
1435
  }
1210
1436
 
1211
1437
  /**
@@ -1215,6 +1441,8 @@ export declare interface _IOperationMetadata {
1215
1441
  durationInSeconds: number;
1216
1442
  logPath: string;
1217
1443
  errorLogPath: string;
1444
+ cobuildContextId: string | undefined;
1445
+ cobuildRunnerId: string | undefined;
1218
1446
  }
1219
1447
 
1220
1448
  /**
@@ -1258,9 +1486,9 @@ export declare interface IOperationRunner {
1258
1486
  */
1259
1487
  readonly name: string;
1260
1488
  /**
1261
- * This flag determines if the operation is allowed to be skipped if up to date.
1489
+ * Whether or not the operation is cacheable. If false, all cache engines will be disabled for this operation.
1262
1490
  */
1263
- isSkipAllowed: boolean;
1491
+ cacheable: boolean;
1264
1492
  /**
1265
1493
  * Indicates that this runner's duration has meaning.
1266
1494
  */
@@ -1274,14 +1502,14 @@ export declare interface IOperationRunner {
1274
1502
  * exit code
1275
1503
  */
1276
1504
  warningsAreAllowed: boolean;
1277
- /**
1278
- * Indicates if the output of this operation may be written to the cache
1279
- */
1280
- isCacheWriteAllowed: boolean;
1281
1505
  /**
1282
1506
  * Method to be executed for the operation.
1283
1507
  */
1284
1508
  executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
1509
+ /**
1510
+ * Return a hash of the configuration that affects the operation.
1511
+ */
1512
+ getConfigHash(): string;
1285
1513
  }
1286
1514
 
1287
1515
  /**
@@ -1316,6 +1544,73 @@ export declare interface IOperationRunnerContext {
1316
1544
  * Object used to track elapsed time.
1317
1545
  */
1318
1546
  stopwatch: IStopwatchResult;
1547
+ /**
1548
+ * The current execution status of an operation. Operations start in the 'ready' state,
1549
+ * but can be 'blocked' if an upstream operation failed. It is 'executing' when
1550
+ * the operation is executing. Once execution is complete, it is either 'success' or
1551
+ * 'failure'.
1552
+ */
1553
+ status: OperationStatus;
1554
+ /**
1555
+ * Error which occurred while executing this operation, this is stored in case we need
1556
+ * it later (for example to re-print errors at end of execution).
1557
+ */
1558
+ error?: Error;
1559
+ /**
1560
+ * Normally the incremental build logic will rebuild changed projects as well as
1561
+ * any projects that directly or indirectly depend on a changed project.
1562
+ * If true, then the incremental build logic will only rebuild changed projects and
1563
+ * ignore dependent projects.
1564
+ */
1565
+ readonly changedProjectsOnly: boolean;
1566
+ }
1567
+
1568
+ /**
1569
+ * @alpha
1570
+ */
1571
+ export declare interface IOperationSettings {
1572
+ /**
1573
+ * The name of the operation. This should be a key in the `package.json`'s `scripts` object.
1574
+ */
1575
+ operationName: string;
1576
+ /**
1577
+ * Specify the folders where this operation writes its output files. If enabled, the Rush build
1578
+ * cache will restore these folders from the cache. The strings are folder names under the project
1579
+ * root folder.
1580
+ *
1581
+ * These folders should not be tracked by Git. They must not contain symlinks.
1582
+ */
1583
+ outputFolderNames?: string[];
1584
+ /**
1585
+ * Disable caching for this operation. The operation will never be restored from cache.
1586
+ * This may be useful if this operation affects state outside of its folder.
1587
+ *
1588
+ * This option is only used when the build cache is enabled for the repo. You can set
1589
+ * disableBuildCacheForOperation=true to disable caching for a specific project operation.
1590
+ * This is a useful workaround if that project's build scripts violate the assumptions of the cache,
1591
+ * for example by writing files outside the project folder. Where possible, a better solution is to improve
1592
+ * the build scripts to be compatible with caching.
1593
+ */
1594
+ disableBuildCacheForOperation?: boolean;
1595
+ /**
1596
+ * An optional list of environment variables that can affect this operation. The values of
1597
+ * these environment variables will become part of the hash when reading and writing the build cache.
1598
+ *
1599
+ * Note: generally speaking, all environment variables available to Rush are also available to any
1600
+ * operations performed -- Rush assumes that environment variables do not affect build outputs unless
1601
+ * you list them here.
1602
+ */
1603
+ dependsOnEnvVars?: string[];
1604
+ /**
1605
+ * An optional list of glob (minimatch) patterns pointing to files that can affect this operation.
1606
+ * The hash values of the contents of these files will become part of the final hash when reading
1607
+ * and writing the build cache.
1608
+ *
1609
+ * Note: if a particular file will be matched by patterns provided by both `incrementalBuildIgnoredGlobs` and
1610
+ * `dependsOnAdditionalFiles` options - `dependsOnAdditionalFiles` will win and the file will be included
1611
+ * calculating final hash value when reading and writing the build cache
1612
+ */
1613
+ dependsOnAdditionalFiles?: string[];
1319
1614
  }
1320
1615
 
1321
1616
  /**
@@ -1331,6 +1626,8 @@ export declare interface _IOperationStateFileOptions {
1331
1626
  */
1332
1627
  export declare interface _IOperationStateJson {
1333
1628
  nonCachedDurationMs: number;
1629
+ cobuildContextId: string | undefined;
1630
+ cobuildRunnerId: string | undefined;
1334
1631
  }
1335
1632
 
1336
1633
  /**
@@ -1499,7 +1796,7 @@ export declare interface IPrefixMatch<TItem> {
1499
1796
  /**
1500
1797
  * @internal
1501
1798
  */
1502
- declare interface IRawRepoState {
1799
+ export declare interface _IRawRepoState {
1503
1800
  projectState: Map<RushConfigurationProject, Map<string, string>> | undefined;
1504
1801
  rootDir: string;
1505
1802
  rawHashes: Map<string, string>;
@@ -1620,6 +1917,33 @@ declare interface IRushPluginsConfigurationJson {
1620
1917
  plugins: IRushPluginConfiguration[];
1621
1918
  }
1622
1919
 
1920
+ /**
1921
+ * Describes the file structure for the `<project root>/config/rush-project.json` config file.
1922
+ * @internal
1923
+ */
1924
+ export declare interface _IRushProjectJson {
1925
+ /**
1926
+ * The incremental analyzer can skip Rush commands for projects whose input files have
1927
+ * not changed since the last build. Normally, every Git-tracked file under the project
1928
+ * folder is assumed to be an input. Set incrementalBuildIgnoredGlobs to ignore specific
1929
+ * files, specified as globs relative to the project folder. The list of file globs will
1930
+ * be interpreted the same way your .gitignore file is.
1931
+ */
1932
+ incrementalBuildIgnoredGlobs?: string[];
1933
+ /**
1934
+ * Disable caching for this project. The project will never be restored from cache.
1935
+ * This may be useful if this project affects state outside of its folder.
1936
+ *
1937
+ * This option is only used when the build cache is enabled for the repo. You can set
1938
+ * disableBuildCacheForProject=true to disable caching for a specific project. This is a useful workaround
1939
+ * if that project's build scripts violate the assumptions of the cache, for example by writing
1940
+ * files outside the project folder. Where possible, a better solution is to improve the build scripts
1941
+ * to be compatible with caching.
1942
+ */
1943
+ disableBuildCacheForProject?: boolean;
1944
+ operationSettings?: IOperationSettings[];
1945
+ }
1946
+
1623
1947
  declare type IRushRepositoryJson = IRushRepositoryJsonSingleUrl | IRushRepositoryJsonMultipleUrls;
1624
1948
 
1625
1949
  /**
@@ -2153,7 +2477,7 @@ export declare class _OperationMetadataManager {
2153
2477
  * Example: `.rush/temp/operation/_phase_build/error.log`
2154
2478
  */
2155
2479
  get relativeFilepaths(): string[];
2156
- saveAsync({ durationInSeconds, logPath, errorLogPath }: _IOperationMetadata): Promise<void>;
2480
+ saveAsync({ durationInSeconds, cobuildContextId, cobuildRunnerId, logPath, errorLogPath }: _IOperationMetadata): Promise<void>;
2157
2481
  tryRestoreAsync({ terminal, logPath, errorLogPath }: {
2158
2482
  terminal: ITerminal;
2159
2483
  logPath: string;
@@ -2196,10 +2520,18 @@ export declare enum OperationStatus {
2196
2520
  * The Operation is on the queue, ready to execute (but may be waiting for dependencies)
2197
2521
  */
2198
2522
  Ready = "READY",
2523
+ /**
2524
+ * The Operation is Queued
2525
+ */
2526
+ Queued = "QUEUED",
2199
2527
  /**
2200
2528
  * The Operation is currently executing
2201
2529
  */
2202
2530
  Executing = "EXECUTING",
2531
+ /**
2532
+ * The Operation is currently executing by a remote process
2533
+ */
2534
+ RemoteExecuting = "REMOTE EXECUTING",
2203
2535
  /**
2204
2536
  * The Operation completed successfully and did not write to standard output
2205
2537
  */
@@ -2357,7 +2689,10 @@ export declare class PhasedCommandHooks {
2357
2689
  * Hook invoked before operation start
2358
2690
  * Hook is series for stable output.
2359
2691
  */
2360
- readonly beforeExecuteOperations: AsyncSeriesHook<[Map<Operation, IOperationExecutionResult>]>;
2692
+ readonly beforeExecuteOperations: AsyncSeriesHook<[
2693
+ Map<Operation, IOperationExecutionResult>,
2694
+ ICreateOperationsContext
2695
+ ]>;
2361
2696
  /**
2362
2697
  * Hook invoked when operation status changed
2363
2698
  * Hook is series for stable output.
@@ -2369,6 +2704,18 @@ export declare class PhasedCommandHooks {
2369
2704
  * Hook is series for stable output.
2370
2705
  */
2371
2706
  readonly afterExecuteOperations: AsyncSeriesHook<[IExecutionResult, ICreateOperationsContext]>;
2707
+ /**
2708
+ * Hook invoked before executing a operation.
2709
+ */
2710
+ readonly beforeExecuteOperation: AsyncSeriesBailHook<[
2711
+ IOperationRunnerContext & IOperationExecutionResult
2712
+ ], OperationStatus | undefined>;
2713
+ /**
2714
+ * Hook invoked after executing a operation.
2715
+ */
2716
+ readonly afterExecuteOperation: AsyncSeriesHook<[
2717
+ IOperationRunnerContext & IOperationExecutionResult
2718
+ ]>;
2372
2719
  /**
2373
2720
  * Hook invoked after a run has finished and the command is watching for changes.
2374
2721
  * May be used to display additional relevant data to the user.
@@ -2581,7 +2928,7 @@ export declare class ProjectChangeAnalyzer {
2581
2928
  /**
2582
2929
  * @internal
2583
2930
  */
2584
- _ensureInitializedAsync(terminal: ITerminal): Promise<IRawRepoState | undefined>;
2931
+ _ensureInitializedAsync(terminal: ITerminal): Promise<_IRawRepoState | undefined>;
2585
2932
  /**
2586
2933
  * The project state hash is calculated in the following way:
2587
2934
  * - Project dependencies are collected (see ProjectChangeAnalyzer.getPackageDeps)
@@ -3528,6 +3875,10 @@ export declare class RushConstants {
3528
3875
  * Changing this ensures that cache entries generated by an old version will no longer register as a cache hit.
3529
3876
  */
3530
3877
  static readonly buildCacheVersion: number;
3878
+ /**
3879
+ * Cobuild configuration file.
3880
+ */
3881
+ static readonly cobuildFilename: string;
3531
3882
  /**
3532
3883
  * Per-project configuration filename.
3533
3884
  */
@@ -3691,18 +4042,76 @@ declare class RushPluginsConfiguration {
3691
4042
  constructor(jsonFilename: string);
3692
4043
  }
3693
4044
 
4045
+ /**
4046
+ * Use this class to load the "config/rush-project.json" config file.
4047
+ *
4048
+ * This file provides project-specific configuration options.
4049
+ * @alpha
4050
+ */
4051
+ export declare class RushProjectConfiguration {
4052
+ private static readonly _configCache;
4053
+ readonly project: RushConfigurationProject;
4054
+ /**
4055
+ * {@inheritdoc _IRushProjectJson.incrementalBuildIgnoredGlobs}
4056
+ */
4057
+ readonly incrementalBuildIgnoredGlobs: ReadonlyArray<string>;
4058
+ /**
4059
+ * {@inheritdoc _IRushProjectJson.disableBuildCacheForProject}
4060
+ */
4061
+ readonly disableBuildCacheForProject: boolean;
4062
+ readonly operationSettingsByOperationName: ReadonlyMap<string, Readonly<IOperationSettings>>;
4063
+ private readonly _validationCache;
4064
+ private constructor();
4065
+ /**
4066
+ * Validates that the requested phases are compatible.
4067
+ * Deferral of this logic to its own method means that Rush no longer eagerly validates
4068
+ * all defined commands in command-line.json. As such, while validation will be run for a given
4069
+ * command upon invoking that command, defining overlapping phases in "rush custom-command"
4070
+ * that are not used by "rush build" will not cause "rush build" to exit with an error.
4071
+ */
4072
+ validatePhaseConfiguration(phases: Iterable<IPhase>, terminal: ITerminal): void;
4073
+ /**
4074
+ * Examines the list of source files for the project and the target phase and returns a reason
4075
+ * why the project cannot enable the build cache for that phase, or undefined if it is safe to so do.
4076
+ */
4077
+ getCacheDisabledReason(trackedFileNames: Iterable<string>, phaseName: string): string | undefined;
4078
+ /**
4079
+ * Loads the rush-project.json data for the specified project.
4080
+ */
4081
+ static tryLoadForProjectAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<RushProjectConfiguration | undefined>;
4082
+ /**
4083
+ * Load only the `incrementalBuildIgnoredGlobs` property from the rush-project.json file, skipping
4084
+ * validation of other parts of the config file.
4085
+ *
4086
+ * @remarks
4087
+ * This function exists to allow the ProjectChangeAnalyzer to load just the ignore globs without
4088
+ * having to validate the rest of the `rush-project.json` file against the repo's command-line configuration.
4089
+ */
4090
+ static tryLoadIgnoreGlobsForProjectAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<ReadonlyArray<string> | undefined>;
4091
+ /**
4092
+ * Load the rush-project.json data for all selected projects.
4093
+ * Validate compatibility of output folders across all selected phases.
4094
+ */
4095
+ static tryLoadAndValidateForProjectsAsync(projects: Iterable<RushConfigurationProject>, phases: ReadonlySet<IPhase>, terminal: ITerminal): Promise<ReadonlyMap<RushConfigurationProject, RushProjectConfiguration>>;
4096
+ private static _tryLoadJsonForProjectAsync;
4097
+ private static _getRushProjectConfiguration;
4098
+ }
4099
+
3694
4100
  /**
3695
4101
  * @beta
3696
4102
  */
3697
4103
  export declare class RushSession {
3698
4104
  private readonly _options;
3699
4105
  private readonly _cloudBuildCacheProviderFactories;
4106
+ private readonly _cobuildLockProviderFactories;
3700
4107
  readonly hooks: RushLifecycleHooks;
3701
4108
  constructor(options: IRushSessionOptions);
3702
4109
  getLogger(name: string): ILogger;
3703
4110
  get terminalProvider(): ITerminalProvider;
3704
4111
  registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void;
3705
4112
  getCloudBuildCacheProviderFactory(cacheProviderName: string): CloudBuildCacheProviderFactory | undefined;
4113
+ registerCobuildLockProviderFactory(cobuildLockProviderName: string, factory: CobuildLockProviderFactory): void;
4114
+ getCobuildLockProviderFactory(cobuildLockProviderName: string): CobuildLockProviderFactory | undefined;
3706
4115
  }
3707
4116
 
3708
4117
  /**
@@ -0,0 +1,71 @@
1
+ import { ITerminal } from '@rushstack/node-core-library';
2
+ import { CobuildLockProviderFactory, 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
+ cobuildFeatureEnabled: boolean;
10
+ cobuildLockProvider: string;
11
+ }
12
+ /**
13
+ * @beta
14
+ */
15
+ export interface ICobuildConfigurationOptions {
16
+ cobuildJson: ICobuildJson;
17
+ rushConfiguration: RushConfiguration;
18
+ rushSession: RushSession;
19
+ cobuildLockProviderFactory: CobuildLockProviderFactory;
20
+ }
21
+ /**
22
+ * Use this class to load and save the "common/config/rush/cobuild.json" config file.
23
+ * This file provides configuration options for the Rush Cobuild feature.
24
+ * @beta
25
+ */
26
+ export declare class CobuildConfiguration {
27
+ private static _jsonSchema;
28
+ /**
29
+ * Indicates whether the cobuild feature is enabled.
30
+ * Typically it is enabled in the cobuild.json config file.
31
+ *
32
+ * Note: The orchestrator (or local users) should always have to opt into running with cobuilds by
33
+ * providing a cobuild context id. Even if cobuilds are "enabled" as a feature, they don't
34
+ * actually turn on for that particular build unless the cobuild context id is provided as an
35
+ * non-empty string.
36
+ */
37
+ readonly cobuildFeatureEnabled: boolean;
38
+ /**
39
+ * Cobuild context id
40
+ *
41
+ * @remarks
42
+ * The cobuild feature won't be enabled until the context id is provided as an non-empty string.
43
+ */
44
+ readonly cobuildContextId: string | undefined;
45
+ /**
46
+ * This is a name of the participating cobuild runner. It can be specified by the environment variable
47
+ * RUSH_COBUILD_RUNNER_ID. If it is not provided, a random id will be generated to identify the runner.
48
+ */
49
+ readonly cobuildRunnerId: string;
50
+ /**
51
+ * If true, Rush will automatically handle the leaf project with build cache "disabled" by writing
52
+ * to the cache in a special "log files only mode". This is useful when you want to use Cobuilds
53
+ * to improve the performance in CI validations and the leaf projects have not enabled cache.
54
+ */
55
+ readonly cobuildLeafProjectLogOnlyAllowed: boolean;
56
+ private _cobuildLockProvider;
57
+ private readonly _cobuildLockProviderFactory;
58
+ private readonly _cobuildJson;
59
+ private constructor();
60
+ /**
61
+ * Attempts to load the cobuild.json data from the standard file path `common/config/rush/cobuild.json`.
62
+ * If the file has not been created yet, then undefined is returned.
63
+ */
64
+ static tryLoadAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise<CobuildConfiguration | undefined>;
65
+ static getCobuildConfigFilePath(rushConfiguration: RushConfiguration): string;
66
+ private static _loadAsync;
67
+ createLockProviderAsync(terminal: ITerminal): Promise<void>;
68
+ destroyLockProviderAsync(): Promise<void>;
69
+ getCobuildLockProvider(): ICobuildLockProvider;
70
+ }
71
+ //# sourceMappingURL=CobuildConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../lib-shim/index")._rushSdk_loadInternalModule("api/CobuildConfiguration");