mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
build: remove experimental build event protocol
This commit is contained in:
parent
79f13bddb2
commit
297fc923ab
18
WORKSPACE
18
WORKSPACE
@ -4,7 +4,6 @@ workspace(
|
||||
)
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
|
||||
http_archive(
|
||||
name = "build_bazel_rules_nodejs",
|
||||
@ -12,18 +11,6 @@ http_archive(
|
||||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.0.3/rules_nodejs-2.0.3.tar.gz"],
|
||||
)
|
||||
|
||||
# We use protocol buffers for the Build Event Protocol
|
||||
git_repository(
|
||||
name = "com_google_protobuf",
|
||||
commit = "6263268b8c1b78a8a9b65acd6f5dd5c04dd9b0e1",
|
||||
remote = "https://github.com/protocolbuffers/protobuf",
|
||||
shallow_since = "1576607245 -0800",
|
||||
)
|
||||
|
||||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
|
||||
|
||||
protobuf_deps()
|
||||
|
||||
# Check the bazel version and download npm dependencies
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version", "check_rules_nodejs_version", "node_repositories", "yarn_install")
|
||||
|
||||
@ -82,11 +69,6 @@ load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
|
||||
|
||||
install_bazel_dependencies(suppress_warning = True)
|
||||
|
||||
# Load labs dependencies
|
||||
load("@npm//@bazel/labs:package.bzl", "npm_bazel_labs_dependencies")
|
||||
|
||||
npm_bazel_labs_dependencies()
|
||||
|
||||
##########################
|
||||
# Remote Execution Setup #
|
||||
##########################
|
||||
|
@ -89,7 +89,6 @@
|
||||
"@bazel/bazelisk": "1.6.1",
|
||||
"@bazel/buildifier": "3.4.0",
|
||||
"@bazel/jasmine": "2.0.3",
|
||||
"@bazel/labs": "2.0.3",
|
||||
"@bazel/typescript": "2.0.3",
|
||||
"@jsdevtools/coverage-istanbul-loader": "3.0.3",
|
||||
"@types/babel__core": "7.1.9",
|
||||
|
@ -5,7 +5,6 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { analytics } from '@angular-devkit/core';
|
||||
import { ArchitectCommand, ArchitectCommandOptions } from '../models/architect-command';
|
||||
import { Arguments } from '../models/interface';
|
||||
import { Schema as BuildCommandSchema } from './build';
|
||||
@ -23,10 +22,6 @@ export class BuildCommand extends ArchitectCommand<BuildCommandSchema> {
|
||||
dimensions: (boolean | number | string)[] = [],
|
||||
metrics: (boolean | number | string)[] = [],
|
||||
): Promise<void> {
|
||||
if (options.buildEventLog !== undefined) {
|
||||
dimensions[analytics.NgCliAnalyticsDimensions.NgBuildBuildEventLog] = true;
|
||||
}
|
||||
|
||||
return super.reportAnalytics(paths, options, dimensions, metrics);
|
||||
}
|
||||
}
|
||||
|
@ -11,15 +11,6 @@
|
||||
|
||||
"allOf": [
|
||||
{ "$ref": "./definitions.json#/definitions/architect" },
|
||||
{ "$ref": "./definitions.json#/definitions/base" },
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"buildEventLog": {
|
||||
"type": "string",
|
||||
"description": "**EXPERIMENTAL** Output file path for Build Event Protocol events"
|
||||
}
|
||||
}
|
||||
}
|
||||
{ "$ref": "./definitions.json#/definitions/base" }
|
||||
]
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { analytics } from '@angular-devkit/core';
|
||||
import { ArchitectCommand, ArchitectCommandOptions } from '../models/architect-command';
|
||||
import { Arguments } from '../models/interface';
|
||||
import { Schema as BuildCommandSchema } from './build';
|
||||
@ -28,10 +27,6 @@ export class ServeCommand extends ArchitectCommand<ServeCommandSchema> {
|
||||
dimensions: (boolean | number | string)[] = [],
|
||||
metrics: (boolean | number | string)[] = [],
|
||||
): Promise<void> {
|
||||
if (options.buildEventLog !== undefined) {
|
||||
dimensions[analytics.NgCliAnalyticsDimensions.NgBuildBuildEventLog] = true;
|
||||
}
|
||||
|
||||
return super.reportAnalytics(paths, options, dimensions, metrics);
|
||||
}
|
||||
}
|
||||
|
@ -12,15 +12,6 @@
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{ "$ref": "./definitions.json#/definitions/architect" },
|
||||
{ "$ref": "./definitions.json#/definitions/base" },
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"buildEventLog": {
|
||||
"type": "string",
|
||||
"description": "**EXPERIMENTAL** Output file path for Build Event Protocol events"
|
||||
}
|
||||
}
|
||||
}
|
||||
{ "$ref": "./definitions.json#/definitions/base" }
|
||||
]
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import { Architect, Target } from '@angular-devkit/architect';
|
||||
import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
|
||||
import { json, schema, tags, workspaces } from '@angular-devkit/core';
|
||||
import { NodeJsSyncHost } from '@angular-devkit/core/node';
|
||||
import { BepJsonWriter } from '../utilities/bep';
|
||||
import { parseJsonSchemaToOptions } from '../utilities/json-schema';
|
||||
import { isPackageNameSafeForAnalytics } from './analytics';
|
||||
import { BaseCommandOptions, Command } from './command';
|
||||
@ -194,41 +193,6 @@ export abstract class ArchitectCommand<
|
||||
return await this.runArchitectTarget(options);
|
||||
}
|
||||
|
||||
protected async runBepTarget(
|
||||
command: string,
|
||||
configuration: Target,
|
||||
overrides: json.JsonObject,
|
||||
buildEventLog: string,
|
||||
): Promise<number> {
|
||||
const bep = new BepJsonWriter(buildEventLog);
|
||||
|
||||
// Send start
|
||||
bep.writeBuildStarted(command);
|
||||
|
||||
let last = 1;
|
||||
let rebuild = false;
|
||||
const run = await this._architect.scheduleTarget(configuration, overrides, {
|
||||
logger: this.logger,
|
||||
});
|
||||
await run.output.forEach(event => {
|
||||
last = event.success ? 0 : 1;
|
||||
|
||||
if (rebuild) {
|
||||
// NOTE: This will have an incorrect timestamp but this cannot be fixed
|
||||
// until builders report additional status events
|
||||
bep.writeBuildStarted(command);
|
||||
} else {
|
||||
rebuild = true;
|
||||
}
|
||||
|
||||
bep.writeBuildFinished(last);
|
||||
});
|
||||
|
||||
await run.stop();
|
||||
|
||||
return last;
|
||||
}
|
||||
|
||||
protected async runSingleTarget(
|
||||
target: Target,
|
||||
targetOptions: string[],
|
||||
@ -256,17 +220,6 @@ export abstract class ArchitectCommand<
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (commandOptions.buildEventLog && ['build', 'serve'].includes(this.description.name)) {
|
||||
// The build/serve commands supports BEP messaging
|
||||
this.logger.warn('BEP support is experimental and subject to change.');
|
||||
|
||||
return this.runBepTarget(
|
||||
this.description.name,
|
||||
target,
|
||||
overrides as json.JsonObject,
|
||||
commandOptions.buildEventLog as string,
|
||||
);
|
||||
} else {
|
||||
const run = await this._architect.scheduleTarget(target, overrides as json.JsonObject, {
|
||||
logger: this.logger,
|
||||
analytics: isPackageNameSafeForAnalytics(builderConf) ? this.analytics : undefined,
|
||||
@ -281,7 +234,6 @@ export abstract class ArchitectCommand<
|
||||
|
||||
return success ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
protected async runArchitectTarget(
|
||||
options: ArchitectCommandOptions & Arguments,
|
||||
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import * as fs from 'fs';
|
||||
|
||||
|
||||
export interface BuildEventMessage {
|
||||
id: {};
|
||||
[key: string]: {};
|
||||
}
|
||||
|
||||
export class BepGenerator {
|
||||
private constructor() {}
|
||||
|
||||
static createBuildStarted(command: string, time?: number): BuildEventMessage {
|
||||
return {
|
||||
id: { started: {} },
|
||||
started: {
|
||||
command,
|
||||
start_time_millis: time == undefined ? Date.now() : time,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
static createBuildFinished(code: number, time?: number): BuildEventMessage {
|
||||
return {
|
||||
id: { finished: {} },
|
||||
finished: {
|
||||
finish_time_millis: time == undefined ? Date.now() : time,
|
||||
exit_code: { code },
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class BepJsonWriter {
|
||||
private stream = fs.createWriteStream(this.filename);
|
||||
|
||||
constructor(public readonly filename: string) {
|
||||
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.stream.close();
|
||||
}
|
||||
|
||||
writeEvent(event: BuildEventMessage): void {
|
||||
const raw = JSON.stringify(event);
|
||||
|
||||
this.stream.write(raw + '\n');
|
||||
}
|
||||
|
||||
writeBuildStarted(command: string, time?: number): void {
|
||||
const event = BepGenerator.createBuildStarted(command, time);
|
||||
|
||||
this.writeEvent(event);
|
||||
}
|
||||
|
||||
writeBuildFinished(code: number, time?: number): void {
|
||||
const event = BepGenerator.createBuildFinished(code, time);
|
||||
|
||||
this.writeEvent(event);
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ export enum NgCliAnalyticsDimensions {
|
||||
RamInGigabytes = 3,
|
||||
NodeVersion = 4,
|
||||
NgAddCollection = 6,
|
||||
/** @deprecated */
|
||||
NgBuildBuildEventLog = 7,
|
||||
NgIvyEnabled = 8,
|
||||
BuildErrors = 20,
|
||||
@ -56,7 +57,7 @@ export const NgCliAnalyticsDimensionsFlagInfo: { [name: string]: [string, string
|
||||
RamInGigabytes: ['RAM (In GB)', 'number'],
|
||||
NodeVersion: ['Node Version', 'number'],
|
||||
NgAddCollection: ['--collection', 'string'],
|
||||
NgBuildBuildEventLog: ['--buildEventLog', 'boolean'],
|
||||
NgBuildBuildEventLog: ['--buildEventLog', 'boolean'], // deprecated
|
||||
NgIvyEnabled: ['Ivy Enabled', 'boolean'],
|
||||
BuildErrors: ['Build Errors (comma separated)', 'string'],
|
||||
};
|
||||
|
@ -1,10 +0,0 @@
|
||||
import { ng } from '../../utils/process';
|
||||
import { expectFileToMatch } from '../../utils/fs';
|
||||
|
||||
|
||||
export default async function() {
|
||||
await ng('build', '--build-event-log', 'bep-log.txt');
|
||||
|
||||
await expectFileToMatch('bep-log.txt', '{"id":{"started":{}},"started":{"command":"build",');
|
||||
await expectFileToMatch('bep-log.txt', '{"id":{"finished":{}},"finished":{"finish_time_millis":');
|
||||
}
|
13
third_party/README.md
vendored
13
third_party/README.md
vendored
@ -1,13 +0,0 @@
|
||||
# third_party vendored sources in Angular CLI
|
||||
|
||||
Note, other third_party directories under subpackages currently exist to support the legacy pre-bazel build system.
|
||||
|
||||
For example, `/packages/angular_devkit/core/third_party`
|
||||
|
||||
## TL;DR: don't copy sources into this repo
|
||||
|
||||
All sources in this repo should be authored from scratch by the committer.
|
||||
Don't copy sources you've found in any other location.
|
||||
|
||||
For more info, see the longer version of this README:
|
||||
https://github.com/angular/angular/blob/master/third_party/README.md
|
@ -1,13 +0,0 @@
|
||||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
package(default_visibility = ["//:__subpackages__"])
|
||||
|
||||
licenses(["notice"]) # Apache 2.0
|
||||
|
||||
proto_library(
|
||||
name = "proto",
|
||||
srcs = glob(["*.proto"]),
|
||||
deps = ["//third_party/github.com/bazelbuild/bazel/src/main/protobuf"],
|
||||
)
|
@ -1,700 +0,0 @@
|
||||
// Copyright 2016 The Bazel Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package build_event_stream;
|
||||
|
||||
option java_package = "com.google.devtools.build.lib.buildeventstream";
|
||||
option java_outer_classname = "BuildEventStreamProtos";
|
||||
|
||||
// LOCAL MOD: change import path
|
||||
import "third_party/github.com/bazelbuild/bazel/src/main/protobuf/invocation_policy.proto";
|
||||
import "third_party/github.com/bazelbuild/bazel/src/main/protobuf/command_line.proto";
|
||||
|
||||
// Identifier for a build event. It is deliberately structured to also provide
|
||||
// information about which build target etc the event is related to.
|
||||
//
|
||||
// Events are chained via the event id as follows: each event has an id and a
|
||||
// set of ids of children events such that apart from the initial event each
|
||||
// event has an id that is mentioned as child id in an earlier event and a build
|
||||
// invocation is complete if and only if all direct and indirect children of the
|
||||
// initial event have been posted.
|
||||
message BuildEventId {
|
||||
// Generic identifier for a build event. This is the default type of
|
||||
// BuildEventId, but should not be used outside testing; nevertheless,
|
||||
// tools should handle build events with this kind of id gracefully.
|
||||
message UnknownBuildEventId {
|
||||
string details = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event reporting progress. Those events are also used to
|
||||
// chain in events that come early.
|
||||
message ProgressId {
|
||||
// Unique identifier. No assumption should be made about how the ids are
|
||||
// assigned; the only meaningful operation on this field is test for
|
||||
// equality.
|
||||
int32 opaque_count = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event indicating the beginning of a build; this will
|
||||
// normally be the first event.
|
||||
message BuildStartedId {
|
||||
}
|
||||
|
||||
// Identifier on an event indicating the original commandline received by
|
||||
// the bazel server.
|
||||
message UnstructuredCommandLineId {
|
||||
}
|
||||
|
||||
// Identifier on an event describing the commandline received by Bazel.
|
||||
message StructuredCommandLineId {
|
||||
// A title for this command line value, as there may be multiple.
|
||||
// For example, a single invocation may wish to report both the literal and
|
||||
// canonical command lines, and this label would be used to differentiate
|
||||
// between both versions.
|
||||
string command_line_label = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event indicating the workspace status.
|
||||
message WorkspaceStatusId {
|
||||
}
|
||||
|
||||
// Identifier on an event reporting on the options included in the command
|
||||
// line, both explicitly and implicitly.
|
||||
message OptionsParsedId {
|
||||
}
|
||||
|
||||
// Identifier of an event reporting that an external resource was fetched
|
||||
// from.
|
||||
message FetchId {
|
||||
// The external resource that was fetched from.
|
||||
string url = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event indicating that a target pattern has been expanded
|
||||
// further.
|
||||
// Messages of this shape are also used to describe parts of a pattern that
|
||||
// have been skipped for some reason, if the actual expansion was still
|
||||
// carried out (e.g., if keep_going is set). In this case, the
|
||||
// pattern_skipped choice in the id field is to be made.
|
||||
message PatternExpandedId {
|
||||
repeated string pattern = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event indicating that a target has been expanded by
|
||||
// identifying for which configurations it should be build.
|
||||
message TargetConfiguredId {
|
||||
string label = 1;
|
||||
|
||||
// If not empty, the id refers to the expansion of the target for a given
|
||||
// aspect.
|
||||
string aspect = 2;
|
||||
}
|
||||
|
||||
// Identifier of an event introducing a named set of files (usually artifacts)
|
||||
// to be referred to in later messages.
|
||||
message NamedSetOfFilesId {
|
||||
// Identifier of the file set; this is an opaque string valid only for the
|
||||
// particular instance of the event stream.
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event introducing a configuration.
|
||||
message ConfigurationId {
|
||||
// Identifier of the configuration; users of the protocol should not make
|
||||
// any assumptions about it having any structure, or equality of the
|
||||
// identifier between different streams.
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event indicating that a target was built completely; this
|
||||
// does not include running the test if the target is a test target.
|
||||
message TargetCompletedId {
|
||||
string label = 1;
|
||||
|
||||
// The configuration for which the target was built.
|
||||
ConfigurationId configuration = 3;
|
||||
|
||||
// If not empty, the id refers to the completion of the target for a given
|
||||
// aspect.
|
||||
string aspect = 2;
|
||||
}
|
||||
|
||||
// Identifier of an event reporting that an action was completed (not all
|
||||
// actions are reported, only the ones that can be considered important;
|
||||
// this includes all failed actions).
|
||||
message ActionCompletedId {
|
||||
string primary_output = 1;
|
||||
// Optional, the label of the owner of the action, for reference.
|
||||
string label = 2;
|
||||
// Optional, the id of the configuration of the action owner.
|
||||
ConfigurationId configuration = 3;
|
||||
}
|
||||
|
||||
// Identifier of an event reporting an event associated with an unconfigured
|
||||
// label. Usually, this indicates a failure due to a missing input file. In
|
||||
// any case, it will report some form of error (i.e., the payload will be an
|
||||
// Aborted event); there are no regular events using this identifier. The
|
||||
// purpose of those events is to serve as the root cause of a failed target.
|
||||
message UnconfiguredLabelId {
|
||||
string label = 1;
|
||||
}
|
||||
|
||||
// Identifier of an event reporting an event associated with a configured
|
||||
// label, usually a visibility error. In any case, an event with such an
|
||||
// id will always report some form of error (i.e., the payload will be an
|
||||
// Aborted event); there are no regular events using this identifier.
|
||||
message ConfiguredLabelId {
|
||||
string label = 1;
|
||||
ConfigurationId configuration = 2;
|
||||
}
|
||||
|
||||
// Identifier of an event reporting on an individual test run. The label
|
||||
// identifies the test that is reported about, the remaining fields are
|
||||
// in such a way as to uniquely identify the action within a build. In fact,
|
||||
// attempts for the same test, run, shard triple are counted sequentially,
|
||||
// starting with 1.
|
||||
message TestResultId {
|
||||
string label = 1;
|
||||
ConfigurationId configuration = 5;
|
||||
int32 run = 2;
|
||||
int32 shard = 3;
|
||||
int32 attempt = 4;
|
||||
}
|
||||
|
||||
// Identifier of an event reporting the summary of a test.
|
||||
message TestSummaryId {
|
||||
string label = 1;
|
||||
ConfigurationId configuration = 2;
|
||||
}
|
||||
|
||||
// Identifier of the BuildFinished event, indicating the end of a build.
|
||||
message BuildFinishedId {
|
||||
}
|
||||
|
||||
// Identifier of an event providing additional logs/statistics after
|
||||
// completion of the build.
|
||||
message BuildToolLogsId {
|
||||
}
|
||||
|
||||
// Identifier of an event providing build metrics after completion
|
||||
// of the build.
|
||||
message BuildMetricsId {
|
||||
}
|
||||
|
||||
oneof id {
|
||||
UnknownBuildEventId unknown = 1;
|
||||
ProgressId progress = 2;
|
||||
BuildStartedId started = 3;
|
||||
UnstructuredCommandLineId unstructured_command_line = 11;
|
||||
StructuredCommandLineId structured_command_line = 18;
|
||||
WorkspaceStatusId workspace_status = 14;
|
||||
OptionsParsedId options_parsed = 12;
|
||||
FetchId fetch = 17;
|
||||
ConfigurationId configuration = 15;
|
||||
TargetConfiguredId target_configured = 16;
|
||||
PatternExpandedId pattern = 4;
|
||||
PatternExpandedId pattern_skipped = 10;
|
||||
NamedSetOfFilesId named_set = 13;
|
||||
TargetCompletedId target_completed = 5;
|
||||
ActionCompletedId action_completed = 6;
|
||||
UnconfiguredLabelId unconfigured_label = 19;
|
||||
ConfiguredLabelId configured_label = 21;
|
||||
TestResultId test_result = 8;
|
||||
TestSummaryId test_summary = 7;
|
||||
BuildFinishedId build_finished = 9;
|
||||
BuildToolLogsId build_tool_logs = 20;
|
||||
BuildMetricsId build_metrics = 22;
|
||||
}
|
||||
}
|
||||
|
||||
// Payload of an event summarizing the progress of the build so far. Those
|
||||
// events are also used to be parents of events where the more logical parent
|
||||
// event cannot be posted yet as the needed information is not yet complete.
|
||||
message Progress {
|
||||
// The next chunk of stdout that bazel produced since the last progress event
|
||||
// or the beginning of the build.
|
||||
string stdout = 1;
|
||||
|
||||
// The next chunk of stderr that bazel produced since the last progress event
|
||||
// or the beginning of the build.
|
||||
string stderr = 2;
|
||||
}
|
||||
|
||||
// Payload of an event indicating that an expected event will not come, as
|
||||
// the build is aborted prematurely for some reason.
|
||||
message Aborted {
|
||||
enum AbortReason {
|
||||
UNKNOWN = 0;
|
||||
|
||||
// The user requested the build to be aborted (e.g., by hitting Ctl-C).
|
||||
USER_INTERRUPTED = 1;
|
||||
|
||||
// The user requested that no analysis be performed.
|
||||
NO_ANALYZE = 8;
|
||||
|
||||
// The user requested that no build be carried out.
|
||||
NO_BUILD = 9;
|
||||
|
||||
// The build or target was aborted as a timeout was exceeded.
|
||||
TIME_OUT = 2;
|
||||
|
||||
// The build or target was aborted as some remote environment (e.g., for
|
||||
// remote execution of actions) was not available in the expected way.
|
||||
REMOTE_ENVIRONMENT_FAILURE = 3;
|
||||
|
||||
// Failure due to reasons entirely internal to the build tool, e.g.,
|
||||
// running out of memory.
|
||||
INTERNAL = 4;
|
||||
|
||||
// A Failure occurred in the loading phase of a target.
|
||||
LOADING_FAILURE = 5;
|
||||
|
||||
// A Failure occurred in the analysis phase of a target.
|
||||
ANALYSIS_FAILURE = 6;
|
||||
|
||||
// Target build was skipped (e.g. due to incompatible CPU constraints).
|
||||
SKIPPED = 7;
|
||||
}
|
||||
AbortReason reason = 1;
|
||||
|
||||
// A human readable description with more details about there reason, where
|
||||
// available and useful.
|
||||
string description = 2;
|
||||
}
|
||||
|
||||
// Payload of an event indicating the beginning of a new build. Usually, events
|
||||
// of those type start a new build-event stream. The target pattern requested
|
||||
// to be build is contained in one of the announced child events; it is an
|
||||
// invariant that precisely one of the announced child events has a non-empty
|
||||
// target pattern.
|
||||
message BuildStarted {
|
||||
string uuid = 1;
|
||||
|
||||
// Start of the build in ms since the epoch.
|
||||
// TODO(buchgr): Use google.protobuf.TimeStamp once bazel's protoc supports
|
||||
// it.
|
||||
int64 start_time_millis = 2;
|
||||
|
||||
// Version of the build tool that is running.
|
||||
string build_tool_version = 3;
|
||||
|
||||
// A human-readable description of all the non-default option settings
|
||||
string options_description = 4;
|
||||
|
||||
// The name of the command that the user invoked.
|
||||
string command = 5;
|
||||
|
||||
// The working directory from which the build tool was invoked.
|
||||
string working_directory = 6;
|
||||
|
||||
// The directory of the workspace.
|
||||
string workspace_directory = 7;
|
||||
|
||||
// The process ID of the Bazel server.
|
||||
int64 server_pid = 8;
|
||||
}
|
||||
|
||||
// Payload of an event reporting the command-line of the invocation as
|
||||
// originally received by the server. Note that this is not the command-line
|
||||
// given by the user, as the client adds information about the invocation,
|
||||
// like name and relevant entries of rc-files and client environment variables.
|
||||
// However, it does contain enough information to reproduce the build
|
||||
// invocation.
|
||||
message UnstructuredCommandLine {
|
||||
repeated string args = 1;
|
||||
}
|
||||
|
||||
// Payload of an event reporting on the parsed options, grouped in various ways.
|
||||
message OptionsParsed {
|
||||
repeated string startup_options = 1;
|
||||
repeated string explicit_startup_options = 2;
|
||||
repeated string cmd_line = 3;
|
||||
repeated string explicit_cmd_line = 4;
|
||||
blaze.invocation_policy.InvocationPolicy invocation_policy = 5;
|
||||
string tool_tag = 6;
|
||||
}
|
||||
|
||||
// Payload of an event indicating that an external resource was fetched. This
|
||||
// event will only occur in streams where an actual fetch happened, not in ones
|
||||
// where a cached copy of the entity to be fetched was used.
|
||||
message Fetch {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
// Payload of an event reporting the workspace status. Key-value pairs can be
|
||||
// provided by specifying the workspace_status_command to an executable that
|
||||
// returns one key-value pair per line of output (key and value separated by a
|
||||
// space).
|
||||
message WorkspaceStatus {
|
||||
message Item {
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
repeated Item item = 1;
|
||||
}
|
||||
|
||||
// Payload of an event reporting details of a given configuration.
|
||||
message Configuration {
|
||||
string mnemonic = 1;
|
||||
string platform_name = 2;
|
||||
string cpu = 3;
|
||||
map<string, string> make_variable = 4;
|
||||
}
|
||||
|
||||
// Payload of the event indicating the expansion of a target pattern.
|
||||
// The main information is in the chaining part: the id will contain the
|
||||
// target pattern that was expanded and the children id will contain the
|
||||
// target or target pattern it was expanded to.
|
||||
message PatternExpanded {
|
||||
}
|
||||
|
||||
// Enumeration type characterizing the size of a test, as specified by the
|
||||
// test rule.
|
||||
enum TestSize {
|
||||
UNKNOWN = 0;
|
||||
SMALL = 1;
|
||||
MEDIUM = 2;
|
||||
LARGE = 3;
|
||||
ENORMOUS = 4;
|
||||
}
|
||||
|
||||
// Payload of the event indicating that the configurations for a target have
|
||||
// been identified. As with pattern expansion the main information is in the
|
||||
// chaining part: the id will contain the target that was configured and the
|
||||
// children id will contain the configured targets it was configured to.
|
||||
message TargetConfigured {
|
||||
// The kind of target (e.g., e.g. "cc_library rule", "source file",
|
||||
// "generated file") where the completion is reported.
|
||||
string target_kind = 1;
|
||||
|
||||
// The size of the test, if the target is a test target. Unset otherwise.
|
||||
TestSize test_size = 2;
|
||||
|
||||
// List of all tags associated with this target (for all possible
|
||||
// configurations).
|
||||
repeated string tag = 3;
|
||||
}
|
||||
|
||||
message File {
|
||||
// identifier indicating the nature of the file (e.g., "stdout", "stderr")
|
||||
string name = 1;
|
||||
|
||||
oneof file {
|
||||
// A location where the contents of the file can be found. The string is
|
||||
// encoded according to RFC2396.
|
||||
string uri = 2;
|
||||
// The contents of the file, if they are guaranteed to be short.
|
||||
bytes contents = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Payload of a message to describe a set of files, usually build artifacts, to
|
||||
// be referred to later by their name. In this way, files that occur identically
|
||||
// as outputs of several targets have to be named only once.
|
||||
message NamedSetOfFiles {
|
||||
// Files that belong to this named set of files.
|
||||
repeated File files = 1;
|
||||
|
||||
// Other named sets whose members also belong to this set.
|
||||
repeated BuildEventId.NamedSetOfFilesId file_sets = 2;
|
||||
}
|
||||
|
||||
// Payload of the event indicating the completion of an action. The main purpose
|
||||
// of posting those events is to provide details on the root cause for a target
|
||||
// failing; however, consumers of the build-event protocol must not assume
|
||||
// that only failed actions are posted.
|
||||
message ActionExecuted {
|
||||
bool success = 1;
|
||||
|
||||
// The mnemonic of the action that was executed
|
||||
string type = 8;
|
||||
|
||||
// The exit code of the action, if it is available.
|
||||
int32 exit_code = 2;
|
||||
|
||||
// Location where to find the standard output of the action
|
||||
// (e.g., a file path).
|
||||
File stdout = 3;
|
||||
|
||||
// Location where to find the standard error of the action
|
||||
// (e.g., a file path).
|
||||
File stderr = 4;
|
||||
|
||||
// Deprecated. This field is now present on ActionCompletedId.
|
||||
string label = 5 [deprecated = true];
|
||||
|
||||
// Deprecated. This field is now present on ActionCompletedId.
|
||||
BuildEventId.ConfigurationId configuration = 7 [deprecated = true];
|
||||
|
||||
// Primary output; only provided for successful actions.
|
||||
File primary_output = 6;
|
||||
|
||||
// The command-line of the action, if the action is a command.
|
||||
repeated string command_line = 9;
|
||||
}
|
||||
|
||||
// Collection of all output files belonging to that output group.
|
||||
message OutputGroup {
|
||||
// Ids of fields that have been removed.
|
||||
reserved 2;
|
||||
|
||||
// Name of the output group
|
||||
string name = 1;
|
||||
|
||||
// List of file sets that belong to this output group as well.
|
||||
repeated BuildEventId.NamedSetOfFilesId file_sets = 3;
|
||||
}
|
||||
|
||||
// Payload of the event indicating the completion of a target. The target is
|
||||
// specified in the id. If the target failed the root causes are provided as
|
||||
// children events.
|
||||
message TargetComplete {
|
||||
bool success = 1;
|
||||
|
||||
// The kind of target (e.g., e.g. "cc_library rule", "source file",
|
||||
// "generated file") where the completion is reported.
|
||||
// Deprecated: use the target_kind field in TargetConfigured instead.
|
||||
string target_kind = 5 [deprecated = true];
|
||||
|
||||
// The size of the test, if the target is a test target. Unset otherwise.
|
||||
// Deprecated: use the test_size field in TargetConfigured instead.
|
||||
TestSize test_size = 6 [deprecated = true];
|
||||
|
||||
// The output files are arranged by their output group. If an output file
|
||||
// is part of multiple output groups, it appears once in each output
|
||||
// group.
|
||||
repeated OutputGroup output_group = 2;
|
||||
|
||||
// Temporarily, also report the important outputs directly. This is only to
|
||||
// allow existing clients help transition to the deduplicated representation;
|
||||
// new clients should not use it.
|
||||
repeated File important_output = 4 [deprecated = true];
|
||||
|
||||
// List of tags associated with this configured target.
|
||||
repeated string tag = 3;
|
||||
|
||||
// The timeout specified for test actions under this configured target.
|
||||
int64 test_timeout_seconds = 7;
|
||||
}
|
||||
|
||||
enum TestStatus {
|
||||
NO_STATUS = 0;
|
||||
PASSED = 1;
|
||||
FLAKY = 2;
|
||||
TIMEOUT = 3;
|
||||
FAILED = 4;
|
||||
INCOMPLETE = 5;
|
||||
REMOTE_FAILURE = 6;
|
||||
FAILED_TO_BUILD = 7;
|
||||
TOOL_HALTED_BEFORE_TESTING = 8;
|
||||
};
|
||||
|
||||
// Payload on events reporting about individual test action.
|
||||
message TestResult {
|
||||
reserved 1;
|
||||
|
||||
// The status of this test.
|
||||
TestStatus status = 5;
|
||||
|
||||
// Additional details about the status of the test. This is intended for
|
||||
// user display and must not be parsed.
|
||||
string status_details = 9;
|
||||
|
||||
// True, if the reported attempt is taken from the tool's local cache.
|
||||
bool cached_locally = 4;
|
||||
|
||||
// Time in milliseconds since the epoch at which the test attempt was started.
|
||||
// Note: for cached test results, this is time can be before the start of the
|
||||
// build.
|
||||
int64 test_attempt_start_millis_epoch = 6;
|
||||
|
||||
// Time the test took to run. For locally cached results, this is the time
|
||||
// the cached invocation took when it was invoked.
|
||||
int64 test_attempt_duration_millis = 3;
|
||||
|
||||
// Files (logs, test.xml, undeclared outputs, etc) generated by that test
|
||||
// action.
|
||||
repeated File test_action_output = 2;
|
||||
|
||||
// Warnings generated by that test action.
|
||||
repeated string warning = 7;
|
||||
|
||||
// Message providing optional meta data on the execution of the test action,
|
||||
// if available.
|
||||
message ExecutionInfo {
|
||||
// Deprecated, use TargetComplete.test_timeout_seconds instead.
|
||||
int32 timeout_seconds = 1 [deprecated = true];
|
||||
|
||||
// Name of the strategy to execute this test action (e.g., "local",
|
||||
// "remote")
|
||||
string strategy = 2;
|
||||
|
||||
// True, if the reported attempt was a cache hit in a remote cache.
|
||||
bool cached_remotely = 6;
|
||||
|
||||
// The exit code of the test action.
|
||||
int32 exit_code = 7;
|
||||
|
||||
// The hostname of the machine where the test action was executed (in case
|
||||
// of remote execution), if known.
|
||||
string hostname = 3;
|
||||
|
||||
// Represents a hierarchical timing breakdown of an activity.
|
||||
// The top level time should be the total time of the activity.
|
||||
// Invariant: time_millis >= sum of time_millis of all direct children.
|
||||
message TimingBreakdown {
|
||||
repeated TimingBreakdown child = 1;
|
||||
string name = 2;
|
||||
int64 time_millis = 3;
|
||||
}
|
||||
TimingBreakdown timing_breakdown = 4;
|
||||
|
||||
message ResourceUsage {
|
||||
string name = 1;
|
||||
int64 value = 2;
|
||||
}
|
||||
repeated ResourceUsage resource_usage = 5;
|
||||
}
|
||||
ExecutionInfo execution_info = 8;
|
||||
}
|
||||
|
||||
// Payload of the event summarizing a test.
|
||||
// TODO(aehlig): extend event with additional information as soon as we known
|
||||
// which additional information we need for test summaries.
|
||||
message TestSummary {
|
||||
// Wrapper around BlazeTestStatus to support importing that enum to proto3.
|
||||
// Overall status of test, accumulated over all runs, shards, and attempts.
|
||||
TestStatus overall_status = 5;
|
||||
|
||||
// Total number of runs
|
||||
int32 total_run_count = 1;
|
||||
|
||||
// Path to logs of passed runs.
|
||||
repeated File passed = 3;
|
||||
|
||||
// Path to logs of failed runs;
|
||||
repeated File failed = 4;
|
||||
|
||||
// Total number of cached test actions
|
||||
int32 total_num_cached = 6;
|
||||
}
|
||||
|
||||
// Event indicating the end of a build.
|
||||
message BuildFinished {
|
||||
// Exit code of a build. The possible values correspond to the predefined
|
||||
// codes in bazel's lib.ExitCode class, as well as any custom exit code a
|
||||
// module might define. The predefined exit codes are subject to change (but
|
||||
// rarely do) and are not part of the public API.
|
||||
//
|
||||
// A build was successful iff ExitCode.code equals 0.
|
||||
message ExitCode {
|
||||
// The name of the exit code.
|
||||
string name = 1;
|
||||
|
||||
// The exit code.
|
||||
int32 code = 2;
|
||||
}
|
||||
|
||||
// If the build succeeded or failed.
|
||||
bool overall_success = 1 [deprecated = true];
|
||||
|
||||
// The overall status of the build. A build was successful iff
|
||||
// ExitCode.code equals 0.
|
||||
ExitCode exit_code = 3;
|
||||
|
||||
// Time in milliseconds since the epoch.
|
||||
// TODO(buchgr): Use google.protobuf.Timestamp once bazel's protoc supports
|
||||
// it.
|
||||
int64 finish_time_millis = 2;
|
||||
}
|
||||
|
||||
message BuildMetrics {
|
||||
message ActionSummary {
|
||||
// The total number of actions created and registered during the build.
|
||||
// This includes unused actions that were constructed but
|
||||
// not executed during this build.
|
||||
int64 actions_created = 1;
|
||||
|
||||
// The total number of actions executed during the build.
|
||||
// This includes any remote cache hits, but excludes
|
||||
// local action cache hits.
|
||||
int64 actions_executed = 2;
|
||||
}
|
||||
ActionSummary action_summary = 1;
|
||||
|
||||
message MemoryMetrics {
|
||||
// Size of the JVM heap post build in bytes. This is only collected if
|
||||
// --bep_publish_used_heap_size_post_build is set,
|
||||
// since it forces a full GC.
|
||||
int64 used_heap_size_post_build = 1;
|
||||
}
|
||||
MemoryMetrics memory_metrics = 2;
|
||||
|
||||
message TargetMetrics {
|
||||
// Number of targets loaded during this build.
|
||||
int64 targets_loaded = 1;
|
||||
|
||||
// Number of targets configured during this build. This can
|
||||
// be greater than targets_loaded if the same target is configured
|
||||
// multiple times.
|
||||
int64 targets_configured = 2;
|
||||
}
|
||||
TargetMetrics target_metrics = 3;
|
||||
|
||||
message PackageMetrics {
|
||||
// Number of BUILD files (aka packages) loaded during this build.
|
||||
int64 packages_loaded = 1;
|
||||
}
|
||||
PackageMetrics package_metrics = 4;
|
||||
}
|
||||
|
||||
// Event providing additional statistics/logs after completion of the build.
|
||||
message BuildToolLogs {
|
||||
repeated File log = 1;
|
||||
}
|
||||
|
||||
// Message describing a build event. Events will have an identifier that
|
||||
// is unique within a given build invocation; they also announce follow-up
|
||||
// events as children. More details, which are specific to the kind of event
|
||||
// that is observed, is provided in the payload. More options for the payload
|
||||
// might be added in the future.
|
||||
message BuildEvent {
|
||||
reserved 11, 19;
|
||||
BuildEventId id = 1;
|
||||
repeated BuildEventId children = 2;
|
||||
bool last_message = 20;
|
||||
oneof payload {
|
||||
Progress progress = 3;
|
||||
Aborted aborted = 4;
|
||||
BuildStarted started = 5;
|
||||
UnstructuredCommandLine unstructured_command_line = 12;
|
||||
command_line.CommandLine structured_command_line = 22;
|
||||
OptionsParsed options_parsed = 13;
|
||||
WorkspaceStatus workspace_status = 16;
|
||||
Fetch fetch = 21;
|
||||
Configuration configuration = 17;
|
||||
PatternExpanded expanded = 6;
|
||||
TargetConfigured configured = 18;
|
||||
ActionExecuted action = 7;
|
||||
NamedSetOfFiles named_set_of_files = 15;
|
||||
TargetComplete completed = 8;
|
||||
TestResult test_result = 10;
|
||||
TestSummary test_summary = 9;
|
||||
BuildFinished finished = 14;
|
||||
BuildToolLogs build_tool_logs = 23;
|
||||
BuildMetrics build_metrics = 24;
|
||||
};
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
package(default_visibility = ["//:__subpackages__"])
|
||||
|
||||
licenses(["notice"]) # Apache 2.0
|
||||
|
||||
proto_library(
|
||||
name = "protobuf",
|
||||
srcs = glob(["*.proto"]),
|
||||
)
|
@ -1,103 +0,0 @@
|
||||
// Copyright 2017 The Bazel Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
package command_line;
|
||||
|
||||
// option java_api_version = 2;
|
||||
option java_package = "com.google.devtools.build.lib.runtime.proto";
|
||||
|
||||
// LOCAL MOD: change import path
|
||||
import "third_party/github.com/bazelbuild/bazel/src/main/protobuf/option_filters.proto";
|
||||
|
||||
// Representation of a Bazel command line.
|
||||
message CommandLine {
|
||||
// A title for this command line value, to differentiate it from others.
|
||||
// In particular, a single invocation may wish to report both the literal and
|
||||
// canonical command lines, and this label would be used to differentiate
|
||||
// between both versions. This is a string for flexibility.
|
||||
string command_line_label = 1;
|
||||
|
||||
// A Bazel command line is made of distinct parts. For example,
|
||||
// `bazel --nomaster_bazelrc test --nocache_test_results //foo:aTest`
|
||||
// has the executable "bazel", a startup flag, a command "test", a command
|
||||
// flag, and a test target. There could be many more flags and targets, or
|
||||
// none (`bazel info` for example), but the basic structure is there. The
|
||||
// command line should be broken down into these logical sections here.
|
||||
repeated CommandLineSection sections = 2;
|
||||
}
|
||||
|
||||
// A section of the Bazel command line.
|
||||
message CommandLineSection {
|
||||
// The name of this section, such as "startup_option" or "command".
|
||||
string section_label = 1;
|
||||
|
||||
oneof section_type {
|
||||
// Sections with non-options, such as the list of targets or the command,
|
||||
// should use simple string chunks.
|
||||
ChunkList chunk_list = 2;
|
||||
|
||||
// Startup and command options are lists of options and belong here.
|
||||
OptionList option_list = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Wrapper to allow a list of strings in the "oneof" section_type.
|
||||
message ChunkList {
|
||||
repeated string chunk = 1;
|
||||
}
|
||||
|
||||
// Wrapper to allow a list of options in the "oneof" section_type.
|
||||
message OptionList {
|
||||
repeated Option option = 1;
|
||||
}
|
||||
|
||||
// A single command line option.
|
||||
//
|
||||
// This represents the option itself, but does not take into account the type of
|
||||
// option or how the parser interpreted it. If this option is part of a command
|
||||
// line that represents the actual input that Bazel received, it would, for
|
||||
// example, include expansion flags as they are. However, if this option
|
||||
// represents the canonical form of the command line, with the values as Bazel
|
||||
// understands them, then the expansion flag, which has no value, would not
|
||||
// appear, and the flags it expands to would.
|
||||
message Option {
|
||||
// How the option looks with the option and its value combined. Depending on
|
||||
// the purpose of this command line report, this could be the canonical
|
||||
// form, or the way that the flag was set.
|
||||
//
|
||||
// Some examples: this might be `--foo=bar` form, or `--foo bar` with a space;
|
||||
// for boolean flags, `--nobaz` is accepted on top of `--baz=false` and other
|
||||
// negating values, or for a positive value, the unqualified `--baz` form
|
||||
// is also accepted. This could also be a short `-b`, if the flag has an
|
||||
// abbreviated form.
|
||||
string combined_form = 1;
|
||||
|
||||
// The canonical name of the option, without the preceding dashes.
|
||||
string option_name = 2;
|
||||
|
||||
// The value of the flag, or unset for flags that do not take values.
|
||||
// Especially for boolean flags, this should be in canonical form, the
|
||||
// combined_form field above gives room for showing the flag as it was set
|
||||
// if that is preferred.
|
||||
string option_value = 3;
|
||||
|
||||
// This flag's tagged effects. See OptionEffectTag's java documentation for
|
||||
// details.
|
||||
repeated options.OptionEffectTag effect_tags = 4;
|
||||
|
||||
// Metadata about the flag. See OptionMetadataTag's java documentation for
|
||||
// details.
|
||||
repeated options.OptionMetadataTag metadata_tags = 5;
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
// Copyright 2015 The Bazel Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto2";
|
||||
package blaze.invocation_policy;
|
||||
|
||||
// option java_api_version = 2;
|
||||
option java_package = "com.google.devtools.build.lib.runtime.proto";
|
||||
|
||||
// The --invocation_policy flag takes a base64-encoded binary-serialized or text
|
||||
// formatted InvocationPolicy message.
|
||||
message InvocationPolicy {
|
||||
// Order matters.
|
||||
// After expanding policies on expansion flags or flags with implicit
|
||||
// requirements, only the final policy on a specific flag will be enforced
|
||||
// onto the user's command line.
|
||||
repeated FlagPolicy flag_policies = 1;
|
||||
}
|
||||
|
||||
// A policy for controlling the value of a flag.
|
||||
message FlagPolicy {
|
||||
// The name of the flag to enforce this policy on.
|
||||
//
|
||||
// Note that this should be the full name of the flag, not the abbreviated
|
||||
// name of the flag. If the user specifies the abbreviated name of a flag,
|
||||
// that flag will be matched using its full name.
|
||||
//
|
||||
// The "no" prefix will not be parsed, so for boolean flags, use
|
||||
// the flag's full name and explicitly set it to true or false.
|
||||
optional string flag_name = 1;
|
||||
|
||||
// If set, this flag policy is applied only if one of the given commands or a
|
||||
// command that inherits from one of the given commands is being run. For
|
||||
// instance, if "build" is one of the commands here, then this policy will
|
||||
// apply to any command that inherits from build, such as info, coverage, or
|
||||
// test. If empty, this flag policy is applied for all commands. This allows
|
||||
// the policy setter to add all policies to the proto without having to
|
||||
// determine which Bazel command the user is actually running. Additionally,
|
||||
// Bazel allows multiple flags to be defined by the same name, and the
|
||||
// specific flag definition is determined by the command.
|
||||
repeated string commands = 2;
|
||||
|
||||
oneof operation {
|
||||
SetValue set_value = 3;
|
||||
UseDefault use_default = 4;
|
||||
DisallowValues disallow_values = 5;
|
||||
AllowValues allow_values = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message SetValue {
|
||||
// Use this value for the specified flag, overriding any default or user-set
|
||||
// value (unless append is set to true for repeatable flags).
|
||||
//
|
||||
// This field is repeated for repeatable flags. It is an error to set
|
||||
// multiple values for a flag that is not actually a repeatable flag.
|
||||
// This requires at least 1 value, if even the empty string.
|
||||
//
|
||||
// If the flag allows multiple values, all of its values are replaced with the
|
||||
// value or values from the policy (i.e., no diffing or merging is performed),
|
||||
// unless the append field (see below) is set to true.
|
||||
//
|
||||
// Note that some flags are tricky. For example, some flags look like boolean
|
||||
// flags, but are actually Void expansion flags that expand into other flags.
|
||||
// The Bazel flag parser will accept "--void_flag=false", but because
|
||||
// the flag is Void, the "=false" is ignored. It can get even trickier, like
|
||||
// "--novoid_flag" which is also an expansion flag with the type Void whose
|
||||
// name is explicitly "novoid_flag" and which expands into other flags that
|
||||
// are the opposite of "--void_flag". For expansion flags, it's best to
|
||||
// explicitly override the flags they expand into.
|
||||
//
|
||||
// Other flags may be differently tricky: A flag could have a converter that
|
||||
// converts some string to a list of values, but that flag may not itself have
|
||||
// allowMultiple set to true.
|
||||
//
|
||||
// An example is "--test_tag_filters": this flag sets its converter to
|
||||
// CommaSeparatedOptionListConverter, but does not set allowMultiple to true.
|
||||
// So "--test_tag_filters=foo,bar" results in ["foo", "bar"], however
|
||||
// "--test_tag_filters=foo --test_tag_filters=bar" results in just ["bar"]
|
||||
// since the 2nd value overrides the 1st.
|
||||
//
|
||||
// Similarly, "--test_tag_filters=foo,bar --test_tag_filters=baz,qux" results
|
||||
// in ["baz", "qux"]. For flags like these, the policy should specify
|
||||
// "foo,bar" instead of separately specifying "foo" and "bar" so that the
|
||||
// converter is appropriately invoked.
|
||||
//
|
||||
// Note that the opposite is not necessarily
|
||||
// true: for a flag that specifies allowMultiple=true, "--flag=foo,bar"
|
||||
// may fail to parse or result in an unexpected value.
|
||||
repeated string flag_value = 1;
|
||||
|
||||
// Whether to allow this policy to be overridden by user-specified values.
|
||||
// When set, if the user specified a value for this flag, use the value
|
||||
// from the user, otherwise use the value specified in this policy.
|
||||
optional bool overridable = 2;
|
||||
|
||||
// If true, and if the flag named in the policy is a repeatable flag, then
|
||||
// the values listed in flag_value do not replace all the user-set or default
|
||||
// values of the flag, but instead append to them. If the flag is not
|
||||
// repeatable, then this has no effect.
|
||||
optional bool append = 3;
|
||||
}
|
||||
|
||||
message UseDefault {
|
||||
// Use the default value of the flag, as defined by Bazel (or equivalently, do
|
||||
// not allow the user to set this flag).
|
||||
//
|
||||
// Note on implementation: UseDefault sets the default by clearing the flag,
|
||||
// so that when the value is requested and no flag is found, the flag parser
|
||||
// returns the default. This is mostly relevant for expansion flags: it will
|
||||
// erase user values in *all* flags that the expansion flag expands to. Only
|
||||
// use this on expansion flags if this is acceptable behavior. Since the last
|
||||
// policy wins, later policies on this same flag will still remove the
|
||||
// expanded UseDefault, so there is a way around, but it's really best not to
|
||||
// use this on expansion flags at all.
|
||||
}
|
||||
|
||||
message DisallowValues {
|
||||
// Obsolete new_default_value field.
|
||||
reserved 2;
|
||||
|
||||
// It is an error for the user to use any of these values (that is, the Bazel
|
||||
// command will fail), unless new_value or use_default is set.
|
||||
//
|
||||
// For repeatable flags, if any one of the values in the flag matches a value
|
||||
// in the list of disallowed values, an error is thrown.
|
||||
//
|
||||
// Care must be taken for flags with complicated converters. For example,
|
||||
// it's possible for a repeated flag to be of type List<List<T>>, so that
|
||||
// "--foo=a,b --foo=c,d" results in foo=[["a","b"], ["c", "d"]]. In this case,
|
||||
// it is not possible to disallow just "b", nor will ["b", "a"] match, nor
|
||||
// will ["b", "c"] (but ["a", "b"] will still match).
|
||||
repeated string disallowed_values = 1;
|
||||
|
||||
oneof replacement_value {
|
||||
// If set and if the value of the flag is disallowed (including the default
|
||||
// value of the flag if the user doesn't specify a value), use this value as
|
||||
// the value of the flag instead of raising an error. This does not apply to
|
||||
// repeatable flags and is ignored if the flag is a repeatable flag.
|
||||
string new_value = 3;
|
||||
|
||||
// If set and if the value of the flag is disallowed, use the default value
|
||||
// of the flag instead of raising an error. Unlike new_value, this works for
|
||||
// repeatable flags, but note that the default value for repeatable flags is
|
||||
// always empty.
|
||||
//
|
||||
// Note that it is an error to disallow the default value of the flag and
|
||||
// to set use_default, unless the flag is a repeatable flag where the
|
||||
// default value is always the empty list.
|
||||
UseDefault use_default = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message AllowValues {
|
||||
// Obsolete new_default_value field.
|
||||
reserved 2;
|
||||
|
||||
// It is an error for the user to use any value not in this list, unless
|
||||
// new_value or use_default is set.
|
||||
repeated string allowed_values = 1;
|
||||
|
||||
oneof replacement_value {
|
||||
// If set and if the value of the flag is disallowed (including the default
|
||||
// value of the flag if the user doesn't specify a value), use this value as
|
||||
// the value of the flag instead of raising an error. This does not apply to
|
||||
// repeatable flags and is ignored if the flag is a repeatable flag.
|
||||
string new_value = 3;
|
||||
|
||||
// If set and if the value of the flag is disallowed, use the default value
|
||||
// of the flag instead of raising an error. Unlike new_value, this works for
|
||||
// repeatable flags, but note that the default value for repeatable flags is
|
||||
// always empty.
|
||||
//
|
||||
// Note that it is an error to disallow the default value of the flag and
|
||||
// to set use_default, unless the flag is a repeatable flag where the
|
||||
// default value is always the empty list.
|
||||
UseDefault use_default = 4;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
// Copyright 2017 The Bazel Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
syntax = "proto3";
|
||||
package options;
|
||||
|
||||
// option java_api_version = 2;
|
||||
option java_package = "com.google.devtools.common.options.proto";
|
||||
|
||||
// IMPORTANT NOTE: These two enums must be kept in sync with their Java
|
||||
// equivalents in src/main/java/com/google/devtools/common/options.
|
||||
// Changing this proto has specific compatibility requirements, please see the
|
||||
// Java documentation for details.
|
||||
|
||||
// Docs in java enum.
|
||||
enum OptionEffectTag {
|
||||
// This option's effect or intent is unknown.
|
||||
UNKNOWN = 0;
|
||||
|
||||
// This flag has literally no effect.
|
||||
NO_OP = 1;
|
||||
|
||||
LOSES_INCREMENTAL_STATE = 2;
|
||||
CHANGES_INPUTS = 3;
|
||||
AFFECTS_OUTPUTS = 4;
|
||||
BUILD_FILE_SEMANTICS = 5;
|
||||
BAZEL_INTERNAL_CONFIGURATION = 6;
|
||||
LOADING_AND_ANALYSIS = 7;
|
||||
EXECUTION = 8;
|
||||
HOST_MACHINE_RESOURCE_OPTIMIZATIONS = 9;
|
||||
EAGERNESS_TO_EXIT = 10;
|
||||
BAZEL_MONITORING = 11;
|
||||
TERMINAL_OUTPUT = 12;
|
||||
ACTION_COMMAND_LINES = 13;
|
||||
TEST_RUNNER = 14;
|
||||
}
|
||||
|
||||
// Docs in java enum.
|
||||
enum OptionMetadataTag {
|
||||
EXPERIMENTAL = 0;
|
||||
INCOMPATIBLE_CHANGE = 1;
|
||||
DEPRECATED = 2;
|
||||
HIDDEN = 3;
|
||||
INTERNAL = 4;
|
||||
TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES = 5;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
load("@npm//@bazel/labs//:index.bzl", "ts_proto_library")
|
||||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
|
||||
|
||||
ts_proto_library(
|
||||
name = "build_event_stream",
|
||||
proto = "//third_party/github.com/bazelbuild/bazel/src/main/java/com/google/devtools/build/lib/buildeventstream/proto",
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "parse_bep",
|
||||
srcs = ["parse_bep.ts"],
|
||||
devmode_module = "commonjs",
|
||||
devmode_target = "es2018",
|
||||
deps = [
|
||||
":build_event_stream",
|
||||
"@npm//@types/node",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
nodejs_binary(
|
||||
name = "parse",
|
||||
data = [":parse_bep"],
|
||||
entry_point = "angular_devkit/tools/build_event_protocol/parse_bep",
|
||||
)
|
@ -1,26 +0,0 @@
|
||||
# build_event_protocol
|
||||
|
||||
This protocol is used to make streaming build results available for machines to
|
||||
read and process.
|
||||
|
||||
See https://docs.bazel.build/versions/master/build-event-protocol.html
|
||||
|
||||
This directory contains an example program that parses a streaming JSON file
|
||||
containing build events. It's useful for manually testing a program that emits
|
||||
the build event protocol.
|
||||
|
||||
## Try it
|
||||
|
||||
First build the tool:
|
||||
|
||||
```sh
|
||||
$ bazel build //tools/build_event_protocol:parse
|
||||
```
|
||||
|
||||
Then produce a build event json file:
|
||||
|
||||
$ bazel test //... --build_event_json_file=bep.json
|
||||
|
||||
as soon as that process has started, you should be able to run in another window
|
||||
|
||||
$ bazel-bin/tools/build_event_protocol/parse bep.json
|
@ -1,120 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview simple program to read the build event protocol and convert to
|
||||
* UI quasi-events.
|
||||
*
|
||||
* See the README.md in this directory for usage
|
||||
*/
|
||||
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import {BuildEvent} from 'angular_cli/third_party/github.com/bazelbuild/bazel/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream_pb';
|
||||
|
||||
function updateUi(s: string, ...more: Array<{}>) {
|
||||
console.error('-->', s, ...more);
|
||||
}
|
||||
|
||||
// typeof bes.BuildEventId.id
|
||||
type payloadType = 'unknown'|'progress'|'started'|'unstructuredCommandLine'|
|
||||
'structuredCommandLine'|'workspaceStatus'|'optionsParsed'|'fetch'|
|
||||
'configuration'|'targetConfigured'|'pattern'|'patternSkipped'|'namedSet'|
|
||||
'targetCompleted'|'actionCompleted'|'unconfiguredLabel'|'configuredLabel'|
|
||||
'testResult'|'testSummary'|'buildFinished'|'buildToolLogs'|'buildMetrics';
|
||||
|
||||
function filterType(s: payloadType) {
|
||||
return filter((evt: BuildEvent) => {
|
||||
const id = evt.getId();
|
||||
if (!id) {
|
||||
throw new Error(`expected BuildEvent to contain id
|
||||
${JSON.stringify(evt)}`);
|
||||
}
|
||||
return Object.keys(id)[0] === s;
|
||||
});
|
||||
}
|
||||
|
||||
async function main(argv: string[]): Promise<0|1> {
|
||||
const s = new Subject<BuildEvent>();
|
||||
const o: Observable<BuildEvent> = s.asObservable();
|
||||
o.pipe(filterType('testSummary')).subscribe({
|
||||
next: (evt: BuildEvent) => {
|
||||
const id = evt.getId();
|
||||
if (!id || !id.getTestSummary() || !evt.getTestSummary()) {
|
||||
throw new Error(
|
||||
`expected BuildEvent to contain id, testSummary, id.testSummary
|
||||
${JSON.stringify(evt)}`);
|
||||
}
|
||||
updateUi('Test result', {
|
||||
label: id.getTestSummary()!.getLabel(),
|
||||
overallStatus: evt.getTestSummary()!.getOverallStatus(),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
o.pipe(filterType('buildFinished')).subscribe({
|
||||
next: (evt: BuildEvent) => {
|
||||
const finished = evt.getFinished();
|
||||
if (!finished || !finished.getExitCode()) {
|
||||
throw new Error(
|
||||
`expected BuildEvent to contain finished, finished.exitCode
|
||||
${JSON.stringify(evt)}`);
|
||||
}
|
||||
const exitName = finished.getExitCode()!.getName();
|
||||
switch (exitName) {
|
||||
case 'SUCCESS':
|
||||
updateUi('Thumbs up');
|
||||
break;
|
||||
case 'TESTS_FAILED':
|
||||
updateUi('Some tests failed');
|
||||
break;
|
||||
case 'INTERRUPTED':
|
||||
updateUi('Cancelled');
|
||||
break;
|
||||
case 'PARSING_FAILURE':
|
||||
updateUi('Error in build configuration file, report to expert', {
|
||||
someDebugThatsUsefulToTheExpert: 'a-file-path',
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unhandled exitName ${exitName}`);
|
||||
}
|
||||
},
|
||||
error: (e) => console.error('Unrecoverable error ', e)
|
||||
});
|
||||
|
||||
// Push values into the subject
|
||||
// TODO: should be streaming from file
|
||||
// const stream = fs.createReadStream(argv[0]);
|
||||
// stream.on('data')
|
||||
// stream.on('end)
|
||||
// etc.
|
||||
const content = fs.readFileSync(argv[0], {'encoding': 'utf-8'});
|
||||
content.split(/[\r\n]+/).filter(l => !!l).forEach(
|
||||
evt => s.next(JSON.parse(evt)));
|
||||
s.complete();
|
||||
|
||||
await o.toPromise();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (require.main === module) {
|
||||
// Allow this program to run under bazel run
|
||||
const wd = process.env['BUILD_WORKING_DIRECTORY'];
|
||||
if (wd) {
|
||||
process.chdir(wd);
|
||||
}
|
||||
|
||||
main(process.argv.slice(2))
|
||||
.then(exitCode => process.exitCode = exitCode, e => {
|
||||
throw new Error(e);
|
||||
});
|
||||
}
|
@ -1003,11 +1003,6 @@
|
||||
c8 "~7.1.0"
|
||||
jasmine-reporters "~2.3.2"
|
||||
|
||||
"@bazel/labs@2.0.3":
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/labs/-/labs-2.0.3.tgz#98c2a4c2055372ecf0020c55eb6a33f065e65252"
|
||||
integrity sha512-8E2gqSpi+RgJPdqeKgt3Jc/UGl8R22xROukdYddUGygLHbQxaYLVJ/LboLX00316S+pNIpA/t5S3+Y4CguWtOg==
|
||||
|
||||
"@bazel/typescript@2.0.3":
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-2.0.3.tgz#0be019014ef973f3a415c4671c65d943afc62023"
|
||||
|
Loading…
x
Reference in New Issue
Block a user