Skip to content

Commit d96b30b

Browse files
committed
Rename "cobuildEnabled" to "cobuildFeatureEnabled" in "cobuild.json"
1 parent 5c659f6 commit d96b30b

File tree

7 files changed

+24
-23
lines changed

7 files changed

+24
-23
lines changed

build-tests/rush-redis-cobuild-plugin-integration-test/sandbox/repo/common/config/rush/cobuild.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* RUSH_COBUILD_CONTEXT_ID should always be specified as an environment variable with an non-empty string,
1111
* otherwise the cobuild feature will be disabled.
1212
*/
13-
"cobuildEnabled": true,
13+
"cobuildFeatureEnabled": true,
1414

1515
/**
1616
* (Required) Choose where cobuild lock will be acquired.

common/reviews/api/rush-lib.api.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) =
9797
// @beta
9898
export class CobuildConfiguration {
9999
readonly cobuildContextId: string | undefined;
100-
readonly cobuildEnabled: boolean;
100+
readonly cobuildFeatureEnabled: boolean;
101101
readonly cobuildLeafProjectLogOnlyAllowed: boolean;
102102
// (undocumented)
103103
get cobuildLockProvider(): ICobuildLockProvider;
@@ -182,7 +182,7 @@ export class EnvironmentConfiguration {
182182
static get buildCacheEnabled(): boolean | undefined;
183183
static get buildCacheWriteAllowed(): boolean | undefined;
184184
static get cobuildContextId(): string | undefined;
185-
static get cobuildEnabled(): boolean | undefined;
185+
static get cobuildFeatureEnabled(): boolean | undefined;
186186
static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined;
187187
static get cobuildRunnerId(): string | undefined;
188188
// Warning: (ae-forgotten-export) The symbol "IEnvironment" needs to be exported by the entry point index.d.ts
@@ -308,7 +308,7 @@ export interface ICobuildContext {
308308
// @beta (undocumented)
309309
export interface ICobuildJson {
310310
// (undocumented)
311-
cobuildEnabled: boolean;
311+
cobuildFeatureEnabled: boolean;
312312
// (undocumented)
313313
cobuildLockProvider: string;
314314
}

libraries/rush-lib/assets/rush-init/common/config/rush/cobuild.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* RUSH_COBUILD_CONTEXT_ID should always be specified as an environment variable with an non-empty string,
1111
* otherwise the cobuild feature will be disabled.
1212
*/
13-
"cobuildEnabled": false,
13+
"cobuildFeatureEnabled": false,
1414

1515
/**
1616
* (Required) Choose where cobuild lock will be acquired.

libraries/rush-lib/src/api/CobuildConfiguration.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import schemaJson from '../schemas/cobuild.schema.json';
1515
* @beta
1616
*/
1717
export interface ICobuildJson {
18-
cobuildEnabled: boolean;
18+
cobuildFeatureEnabled: boolean;
1919
cobuildLockProvider: string;
2020
}
2121

@@ -46,7 +46,8 @@ export class CobuildConfiguration {
4646
* actually turn on for that particular build unless the cobuild context id is provided as an
4747
* non-empty string.
4848
*/
49-
public readonly cobuildEnabled: boolean;
49+
public readonly cobuildFeatureEnabled: boolean;
50+
5051
/**
5152
* Cobuild context id
5253
*
@@ -75,8 +76,8 @@ export class CobuildConfiguration {
7576
const { cobuildJson, cobuildLockProviderFactory } = options;
7677

7778
this.cobuildContextId = EnvironmentConfiguration.cobuildContextId;
78-
this.cobuildEnabled = this.cobuildContextId
79-
? EnvironmentConfiguration.cobuildEnabled ?? cobuildJson.cobuildEnabled
79+
this.cobuildFeatureEnabled = this.cobuildContextId
80+
? EnvironmentConfiguration.cobuildFeatureEnabled ?? cobuildJson.cobuildFeatureEnabled
8081
: false;
8182
this.cobuildRunnerId = EnvironmentConfiguration.cobuildRunnerId || uuidv4();
8283
this.cobuildLeafProjectLogOnlyAllowed =
@@ -144,7 +145,7 @@ export class CobuildConfiguration {
144145
}
145146

146147
public async createLockProviderAsync(terminal: ITerminal): Promise<void> {
147-
if (this.cobuildEnabled) {
148+
if (this.cobuildFeatureEnabled) {
148149
terminal.writeLine(`Running cobuild (runner ${this.cobuildContextId}/${this.cobuildRunnerId})`);
149150
const cobuildLockProvider: ICobuildLockProvider = await this._cobuildLockProviderFactory(
150151
this._cobuildJson
@@ -155,7 +156,7 @@ export class CobuildConfiguration {
155156
}
156157

157158
public async destroyLockProviderAsync(): Promise<void> {
158-
if (this.cobuildEnabled) {
159+
if (this.cobuildFeatureEnabled) {
159160
await this._cobuildLockProvider?.disconnectAsync();
160161
}
161162
}

libraries/rush-lib/src/api/EnvironmentConfiguration.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ export const EnvironmentVariableNames = {
145145
RUSH_BUILD_CACHE_WRITE_ALLOWED: 'RUSH_BUILD_CACHE_WRITE_ALLOWED',
146146

147147
/**
148-
* Setting this environment variable overrides the value of `cobuildEnabled` in the `cobuild.json`
148+
* Setting this environment variable overrides the value of `cobuildFeatureEnabled` in the `cobuild.json`
149149
* configuration file.
150150
*
151151
* @remarks
152-
* Specify `1` to enable the cobuild or `0` to disable it.
152+
* Specify `1` to enable the cobuild feature or `0` to disable it.
153153
*
154154
* If there is no cobuild configured, then this environment variable is ignored.
155155
*/
@@ -244,7 +244,7 @@ export class EnvironmentConfiguration {
244244

245245
private static _buildCacheWriteAllowed: boolean | undefined;
246246

247-
private static _cobuildEnabled: boolean | undefined;
247+
private static _cobuildFeatureEnabled: boolean | undefined;
248248

249249
private static _cobuildContextId: string | undefined;
250250

@@ -353,9 +353,9 @@ export class EnvironmentConfiguration {
353353
* If set, enables or disables the cobuild feature.
354354
* See {@link EnvironmentVariableNames.RUSH_COBUILD_ENABLED}
355355
*/
356-
public static get cobuildEnabled(): boolean | undefined {
356+
public static get cobuildFeatureEnabled(): boolean | undefined {
357357
EnvironmentConfiguration._ensureValidated();
358-
return EnvironmentConfiguration._cobuildEnabled;
358+
return EnvironmentConfiguration._cobuildFeatureEnabled;
359359
}
360360

361361
/**
@@ -516,7 +516,7 @@ export class EnvironmentConfiguration {
516516
}
517517

518518
case EnvironmentVariableNames.RUSH_COBUILD_ENABLED: {
519-
EnvironmentConfiguration._cobuildEnabled =
519+
EnvironmentConfiguration._cobuildFeatureEnabled =
520520
EnvironmentConfiguration.parseBooleanEnvironmentVariable(
521521
EnvironmentVariableNames.RUSH_COBUILD_ENABLED,
522522
value

libraries/rush-lib/src/logic/operations/CacheableOperationPlugin.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
9797

9898
this._createContext = context;
9999

100-
const disjointSet: DisjointSet<Operation> | undefined = cobuildConfiguration?.cobuildEnabled
100+
const disjointSet: DisjointSet<Operation> | undefined = cobuildConfiguration?.cobuildFeatureEnabled
101101
? new DisjointSet()
102102
: undefined;
103103

@@ -182,7 +182,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
182182
}
183183

184184
for (const operationSet of disjointSet.getAllSets()) {
185-
if (cobuildConfiguration?.cobuildEnabled && cobuildConfiguration.cobuildContextId) {
185+
if (cobuildConfiguration?.cobuildFeatureEnabled && cobuildConfiguration.cobuildContextId) {
186186
// Get a deterministic ordered array of operations, which is important to get a deterministic cluster id.
187187
const groupedOperations: Operation[] = Array.from(operationSet);
188188
Sort.sortBy(groupedOperations, (operation: Operation) => {
@@ -292,7 +292,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
292292

293293
// Try to acquire the cobuild lock
294294
let cobuildLock: CobuildLock | undefined;
295-
if (cobuildConfiguration?.cobuildEnabled) {
295+
if (cobuildConfiguration?.cobuildFeatureEnabled) {
296296
if (
297297
cobuildConfiguration?.cobuildLeafProjectLogOnlyAllowed &&
298298
record.operation.consumers.size === 0 &&
@@ -740,7 +740,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
740740
phaseName: string;
741741
}): Promise<CobuildLock | undefined> {
742742
if (!buildCacheContext.cobuildLock) {
743-
if (projectBuildCache && cobuildConfiguration?.cobuildEnabled) {
743+
if (projectBuildCache && cobuildConfiguration?.cobuildFeatureEnabled) {
744744
if (!buildCacheContext.cobuildClusterId) {
745745
// This should not happen
746746
throw new InternalError('Cobuild cluster id is not defined');

libraries/rush-lib/src/schemas/cobuild.schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
{
1616
"type": "object",
1717
"additionalProperties": false,
18-
"required": ["cobuildEnabled", "cobuildLockProvider"],
18+
"required": ["cobuildFeatureEnabled", "cobuildLockProvider"],
1919
"properties": {
2020
"$schema": {
2121
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
2222
"type": "string"
2323
},
24-
"cobuildEnabled": {
24+
"cobuildFeatureEnabled": {
2525
"description": "Set this to true to enable the cobuild feature.",
2626
"type": "boolean"
2727
},

0 commit comments

Comments
 (0)