feat(bazel): Eject Bazel (#29167)
Add command line flag to expose Bazel files on disk. `ng build --leaveBazelFilesOnDisk` PR Close #29167
This commit is contained in:
parent
5ad2097be8
commit
36a1550e00
@ -20,7 +20,7 @@ class BazelBuilder implements Builder<Schema> {
|
|||||||
run(config: BuilderConfiguration<Partial<Schema>>): Observable<BuildEvent> {
|
run(config: BuilderConfiguration<Partial<Schema>>): Observable<BuildEvent> {
|
||||||
const {host, logger, workspace} = this.context;
|
const {host, logger, workspace} = this.context;
|
||||||
const root: Path = workspace.root;
|
const root: Path = workspace.root;
|
||||||
const {bazelCommand, targetLabel, watch} = config.options as Schema;
|
const {bazelCommand, leaveBazelFilesOnDisk, targetLabel, watch} = config.options as Schema;
|
||||||
const executable = watch ? 'ibazel' : 'bazel';
|
const executable = watch ? 'ibazel' : 'bazel';
|
||||||
const binary = checkInstallation(executable, root) as Path;
|
const binary = checkInstallation(executable, root) as Path;
|
||||||
|
|
||||||
@ -35,7 +35,9 @@ class BazelBuilder implements Builder<Schema> {
|
|||||||
logger.error(err.message);
|
logger.error(err.message);
|
||||||
return {success: false};
|
return {success: false};
|
||||||
} finally {
|
} finally {
|
||||||
await deleteBazelFiles(host, bazelFiles); // this will never throw
|
if (!leaveBazelFilesOnDisk) {
|
||||||
|
await deleteBazelFiles(host, bazelFiles); // this will never throw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
13
packages/bazel/src/builders/schema.d.ts
vendored
13
packages/bazel/src/builders/schema.d.ts
vendored
@ -9,14 +9,27 @@
|
|||||||
* Options for Bazel Builder
|
* Options for Bazel Builder
|
||||||
*/
|
*/
|
||||||
export interface Schema {
|
export interface Schema {
|
||||||
|
/**
|
||||||
|
* Common commands supported by Bazel.
|
||||||
|
*/
|
||||||
bazelCommand: BazelCommand;
|
bazelCommand: BazelCommand;
|
||||||
|
/**
|
||||||
|
* If true, leave Bazel files on disk after running command.
|
||||||
|
*/
|
||||||
|
leaveBazelFilesOnDisk?: boolean;
|
||||||
/**
|
/**
|
||||||
* Target to be executed under Bazel.
|
* Target to be executed under Bazel.
|
||||||
*/
|
*/
|
||||||
targetLabel: string;
|
targetLabel: string;
|
||||||
|
/**
|
||||||
|
* If true, watch the filesystem using ibazel.
|
||||||
|
*/
|
||||||
watch?: boolean;
|
watch?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common commands supported by Bazel.
|
||||||
|
*/
|
||||||
export enum BazelCommand {
|
export enum BazelCommand {
|
||||||
Build = 'build',
|
Build = 'build',
|
||||||
Run = 'run',
|
Run = 'run',
|
||||||
|
@ -1,29 +1,36 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/schema",
|
"$schema": "http://json-schema.org/schema",
|
||||||
"title": "Bazel builder schema",
|
"title": "Bazel builder schema",
|
||||||
"description": "Options for Bazel Builder",
|
"description": "Options for Bazel Builder",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"targetLabel": {
|
"targetLabel": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Target to be executed under Bazel."
|
"description": "Target to be executed under Bazel."
|
||||||
},
|
|
||||||
"bazelCommand": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"run",
|
|
||||||
"build",
|
|
||||||
"test"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"watch": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"bazelCommand": {
|
||||||
"required": [
|
"type": "string",
|
||||||
"targetLabel",
|
"description": "Common commands supported by Bazel.",
|
||||||
"bazelCommand"
|
"enum": [
|
||||||
]
|
"run",
|
||||||
|
"build",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"watch": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "If true, watch the filesystem using ibazel.",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"leaveBazelFilesOnDisk": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "If true, leave Bazel files on disk after running command.",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": [
|
||||||
|
"targetLabel",
|
||||||
|
"bazelCommand"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user