build: upgrade bazel rules to latest (#20768)

Add enough BUILD files to make it possible to
`bazel build packages/core/test`

Also re-format BUILD.bazel files with Buildifier.
Add a CI lint check that they stay formatted.

PR Close #20768
This commit is contained in:
Alex Eagle
2017-12-06 06:56:49 -08:00
committed by Jason Aden
parent 672733608b
commit 9dd60a5fb0
61 changed files with 757 additions and 131 deletions

View File

@ -1,13 +1,19 @@
package(default_visibility=["//visibility:public"])
package(default_visibility = ["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ng_module(
name = "core",
srcs = glob(["**/*.ts"], exclude=[
"test/**",
"testing/**",
]),
module_name = "@angular/core",
tsconfig = ":tsconfig-build.json",
)
name = "core",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/core",
tsconfig = "//packages:tsconfig",
deps = [
"@rxjs",
],
)

View File

@ -51,9 +51,6 @@ export class ReflectiveKey {
static get numberOfKeys(): number { return _globalKeyRegistry.numberOfKeys; }
}
/**
* @internal
*/
export class KeyRegistry {
private _allKeys = new Map<Object, ReflectiveKey>();

View File

@ -313,8 +313,6 @@ function onLeave(zone: NgZonePrivate) {
/**
* Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls
* to framework to perform rendering.
*
* @internal
*/
export class NoopNgZone implements NgZone {
readonly hasPendingMicrotasks: boolean = false;

View File

@ -0,0 +1,43 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
ts_library(
name = "test_lib",
testonly = 1,
srcs = glob(["**/*.ts"]),
tsconfig = "//packages:tsconfig",
deps = [
"//packages/animations",
"//packages/animations/browser",
"//packages/animations/browser/testing",
"//packages/common",
"//packages/compiler",
"//packages/compiler/test",
"//packages/compiler/testing",
"//packages/core",
"//packages/core/testing",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser/animations",
"//packages/platform-browser/testing",
"//packages/platform-server",
"//packages/router",
"//packages/router/testing",
"@rxjs",
],
)
# TODO(mhevery): re-enable when passing
jasmine_node_test(
name = "test",
srcs = [],
bootstrap = [
"zone.js/dist/zone-node.js",
],
tags = ["manual"],
deps = [
":test_lib",
],
)

View File

@ -15,13 +15,13 @@ export function main() {
it('should return true for `done`',
async(inject([ApplicationInitStatus], (status: ApplicationInitStatus) => {
status.runInitializers();
(status as any).runInitializers();
expect(status.done).toBe(true);
})));
it('should return a promise that resolves immediately for `donePromise`',
async(inject([ApplicationInitStatus], (status: ApplicationInitStatus) => {
status.runInitializers();
(status as any).runInitializers();
status.donePromise.then(() => { expect(status.done).toBe(true); });
})));
});
@ -53,7 +53,7 @@ export function main() {
it('should update the status once all async initializers are done',
async(inject([ApplicationInitStatus], (status: ApplicationInitStatus) => {
status.runInitializers();
(status as any).runInitializers();
setTimeout(() => {
completerResolver = true;

View File

@ -52,7 +52,7 @@ export function main() {
options = providersOrOptions || {};
}
const errorHandler = new ErrorHandler();
errorHandler._console = mockConsole as any;
(errorHandler as any)._console = mockConsole as any;
const platformModule = getDOM().supportsDOMEvents() ? BrowserModule : ServerModule;

View File

@ -19,7 +19,7 @@ export function main() {
function errorToString(error: any) {
const logger = new MockConsole();
const errorHandler = new ErrorHandler();
errorHandler._console = logger as any;
(errorHandler as any)._console = logger as any;
errorHandler.handleError(error);
return logger.res.map(line => line.join('#')).join('\n');
}
@ -62,7 +62,7 @@ ERROR CONTEXT#Context`);
const err = new Error('test');
const console = new MockConsole();
const errorHandler = new ErrorHandler();
errorHandler._console = console as any;
(errorHandler as any)._console = console as any;
const logger = jasmine.createSpy('logger');
(err as any)[ERROR_LOGGER] = logger;

View File

@ -409,7 +409,7 @@ function declareTestsUsingBootstrap() {
logger = new MockConsole();
errorHandler = new ErrorHandler();
errorHandler._console = logger as any;
(errorHandler as any)._console = logger as any;
}));
afterEach(() => { destroyPlatform(); });

View File

@ -0,0 +1,15 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "testing",
testonly = 1,
srcs = glob(["**/*.ts"]),
module_name = "@angular/core/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages:types",
"//packages/core",
],
)