Skip to content

Commit

Permalink
build: remove experimental build event protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
kyliau authored and clydin committed Sep 11, 2020
1 parent 79f13bd commit 297fc92
Show file tree
Hide file tree
Showing 21 changed files with 14 additions and 1,454 deletions.
18 changes: 0 additions & 18 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,13 @@ 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",
sha256 = "10fffa29f687aa4d8eb6dfe8731ab5beb63811ab00981fc84a93899641fd4af1",
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")

Expand Down Expand Up @@ -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 #
##########################
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions packages/angular/cli/commands/build-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 changes: 1 addition & 10 deletions packages/angular/cli/commands/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 0 additions & 5 deletions packages/angular/cli/commands/serve-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
}
}
11 changes: 1 addition & 10 deletions packages/angular/cli/commands/serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
]
}
68 changes: 10 additions & 58 deletions packages/angular/cli/models/architect-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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[],
Expand Down Expand Up @@ -256,31 +220,19 @@ 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,
});

const { error, success } = await run.output.toPromise();
await run.stop();
const run = await this._architect.scheduleTarget(target, overrides as json.JsonObject, {
logger: this.logger,
analytics: isPackageNameSafeForAnalytics(builderConf) ? this.analytics : undefined,
});

if (error) {
this.logger.error(error);
}
const { error, success } = await run.output.toPromise();
await run.stop();

return success ? 0 : 1;
if (error) {
this.logger.error(error);
}

return success ? 0 : 1;
}

protected async runArchitectTarget(
Expand Down
68 changes: 0 additions & 68 deletions packages/angular/cli/utilities/bep.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/angular_devkit/core/src/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export enum NgCliAnalyticsDimensions {
RamInGigabytes = 3,
NodeVersion = 4,
NgAddCollection = 6,
/** @deprecated */
NgBuildBuildEventLog = 7,
NgIvyEnabled = 8,
BuildErrors = 20,
Expand Down Expand Up @@ -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'],
};
Expand Down
10 changes: 0 additions & 10 deletions tests/legacy-cli/e2e/tests/experimental/bep.ts

This file was deleted.

13 changes: 0 additions & 13 deletions third_party/README.md

This file was deleted.

This file was deleted.

0 comments on commit 297fc92

Please sign in to comment.