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 073f485c72
commit ef534c0cc1
61 changed files with 757 additions and 131 deletions

View File

@ -11,7 +11,7 @@
anchor_1: &job_defaults
working_directory: ~/ng
docker:
- image: angular/ngcontainer:0.0.6
- image: angular/ngcontainer:0.0.7
# After checkout, rebase on top of master.
# Similar to travis behavior, but not quite the same.
@ -26,6 +26,11 @@ jobs:
steps:
- checkout:
<<: *post_checkout
# Check BUILD.bazel formatting before we have a node_modules directory
# Then we don't need any exclude pattern to avoid checking those files
- run: buildifier -mode=diff $(find . -iname BUILD.bazel -type f)
- run: buildifier -mode=check $(find . -iname BUILD.bazel -type f)
- restore_cache:
key: angular-{{ .Branch }}-{{ checksum "yarn.lock" }}
@ -41,8 +46,8 @@ jobs:
key: angular-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run: bazel info release
- run: bazel run @yarn//:yarn
- run: bazel build packages/...
- run: bazel test @angular//...
- run: bazel build --config=ci packages/...
- run: bazel test --config=ci packages/... @angular//...
- save_cache:
key: angular-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:

View File

@ -1,4 +1,5 @@
package(default_visibility = ["//visibility:public"])
exports_files(["tsconfig.json"])
# This rule belongs in node_modules/BUILD
@ -11,17 +12,25 @@ filegroup(
# bazel query "deps(:node_modules)" | wc -l
# This won't scale in the general case.
# TODO(alexeagle): figure out what to do
srcs = glob(["/".join(["node_modules", pkg, "**", ext]) for pkg in [
srcs = glob(["/".join([
"node_modules",
pkg,
"**",
ext,
]) for pkg in [
"jasmine",
"typescript",
"zone.js",
"rxjs",
"@types",
"tsutils",
"@types/jasmine",
"@types/node",
"@types/source-map",
"tsickle",
"hammerjs",
"protobufjs",
"bytebuffer",
"reflect-metadata",
"source-map-support",
"minimist",
] for ext in [
"*.js",

View File

@ -5,19 +5,29 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "build_bazel_rules_nodejs",
remote = "https://github.com/bazelbuild/rules_nodejs.git",
commit = "0.2.1",
tag = "0.3.1",
)
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
node_repositories(package_json = ["//:package.json"])
local_repository(
git_repository(
name = "build_bazel_rules_typescript",
path = "node_modules/@bazel/typescript",
remote = "https://github.com/bazelbuild/rules_typescript.git",
tag = "0.6.0",
)
load("@build_bazel_rules_typescript//:defs.bzl", "ts_repositories")
ts_repositories()
local_repository(
name = "angular",
path = "packages/bazel",
)
local_repository(
name = "rxjs",
path = "node_modules/rxjs/src",
)

View File

@ -2,9 +2,25 @@ package(default_visibility = ["//visibility:public"])
filegroup(
name = "node_modules",
srcs = glob([
"node_modules/**/*.js",
"node_modules/**/*.d.ts",
"node_modules/**/*.json",
])
# Workaround https://github.com/bazelbuild/bazel/issues/4242
# Can't just glob(["node_modules/**/*.{js,d.ts,json}"])
srcs = glob(["/".join([
"node_modules",
pkg,
"**",
ext,
]) for pkg in [
"@angular",
"@types",
"bytebuffer",
"protobufjs",
"reflect-metadata",
"tsickle",
"typescript",
"zone.js",
] for ext in [
"*.js",
"*.json",
"*.d.ts",
]]),
)

View File

@ -1,24 +1,36 @@
workspace(name = "bazel_integration_test")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "build_bazel_rules_nodejs",
remote = "https://github.com/bazelbuild/rules_nodejs.git",
tag = "0.2.1",
tag = "0.3.1",
)
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
node_repositories(package_json = ["//:package.json"])
local_repository(
git_repository(
name = "build_bazel_rules_typescript",
path = "node_modules/@bazel/typescript",
remote = "https://github.com/bazelbuild/rules_typescript.git",
tag = "0.6.0",
)
load("@build_bazel_rules_typescript//:defs.bzl", "ts_repositories")
ts_repositories()
local_repository(
name = "angular",
path = "node_modules/@angular/bazel",
)
local_repository(
name = "rxjs",
path = "node_modules/rxjs/src",
)
git_repository(
name = "io_bazel_rules_sass",
remote = "https://github.com/bazelbuild/rules_sass.git",

View File

@ -20,6 +20,7 @@
},
"scripts": {
"postinstall": "ngc -p angular.tsconfig.json",
"test": "bazel build ... --noshow_progress"
"test": "WORKAROUND https://github.com/bazelbuild/bazel/issues/4242, can't build ...",
"test": "bazel build //src/... --noshow_progress"
}
}

View File

@ -6,6 +6,6 @@ exports_files(["tsconfig.json"])
ng_module(
name = "src",
srcs = glob(["*.ts"]),
deps = ["//src/hello-world"],
tsconfig = ":tsconfig.json",
deps = ["//src/hello-world"],
)

View File

@ -1,4 +1,5 @@
package(default_visibility = ["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
@ -10,6 +11,9 @@ sass_binary(
ng_module(
name = "hello-world",
srcs = glob(["*.ts"]),
tsconfig = "//src:tsconfig.json",
assets = [":hello-world-styles.css"],
tsconfig = "//src:tsconfig.json",
# FIXME(alexeagle): the rxjs dep should come from Angular, but if we use the
# npm distro of angular there is no ts_library rule to propagate the dep.
deps = ["@rxjs"],
)

View File

@ -23,7 +23,7 @@
"dependencies": {
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.5.2",
"rxjs": "5.5.5",
"tslib": "^1.7.1",
"zone.js": "^0.8.12"
},
@ -31,7 +31,7 @@
"fsevents": "1.1.2"
},
"devDependencies": {
"@bazel/typescript": "0.3.2",
"@bazel/ibazel": "^0.1.1",
"@types/angularjs": "1.5.14-alpha",
"@types/base64-js": "1.2.5",
"@types/chokidar": "1.7.3",
@ -97,6 +97,7 @@
"tsickle": "0.25.5",
"tslint": "5.7.0",
"tslint-eslint-rules": "4.1.1",
"tsutils": "2.12.1",
"typescript": "2.5.x",
"uglify-js": "2.8.29",
"universal-analytics": "0.4.15",

View File

@ -1 +1,20 @@
exports_files(["tsconfig-build.json"])
package(default_visibility = ["//visibility:public"])
exports_files([
"tsconfig-build.json",
"tsconfig.json",
])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config", "ts_library")
ts_config(
name = "tsconfig",
src = ":tsconfig-build.json",
deps = [],
)
ts_library(
name = "types",
srcs = glob(["*.ts"]),
tsconfig = ":tsconfig",
)

View File

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

View File

@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "browser",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/animations/browser",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/animations",
],
)

View File

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

View File

@ -53,13 +53,13 @@ export function main() {
player.onStart(() => log.push('started'));
player.onDone(() => log.push('done'));
player.triggerCallback('start');
(player as any).triggerCallback('start');
expect(log).toEqual(['started']);
player.play();
expect(log).toEqual(['started']);
player.triggerCallback('done');
(player as any).triggerCallback('done');
expect(log).toEqual(['started', 'done']);
player.finish();

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/animations/browser/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/animations",
"//packages/animations/browser",
],
)

View File

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

View File

@ -49,13 +49,13 @@ export function main() {
player.onDone(() => log.push('done'));
flushMicrotasks();
player.triggerCallback('start');
(player as any).triggerCallback('start');
expect(log).toEqual(['started']);
player.play();
expect(log).toEqual(['started']);
player.triggerCallback('done');
(player as any).triggerCallback('done');
expect(log).toEqual(['started', 'done']);
player.finish();

View File

@ -9,7 +9,6 @@
"typescript": ">=2.4.2 <2.6"
},
"dependencies": {
"@bazel/typescript": "0.3.2",
"@types/node": "6.0.84"
},
"repository": {

View File

@ -4,41 +4,42 @@ load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "ngc_lib",
srcs = [
"index.ts",
"extract_i18n.ts",
"index.ts",
],
module_name = "@angular/bazel",
tsconfig = ":tsconfig.json",
visibility = ["//test/ngc-wrapped:__subpackages__"],
deps = [
# BEGIN-INTERNAL
# Only needed when compiling within the Angular repo.
# Users will get this dependency from node_modules.
"@//packages/compiler-cli",
# END-INTERNAL
"@build_bazel_rules_typescript//internal/tsc_wrapped"
"@build_bazel_rules_typescript//internal/tsc_wrapped",
],
tsconfig = ":tsconfig.json",
visibility = ["//test/ngc-wrapped:__subpackages__"],
)
nodejs_binary(
name = "ngc-wrapped",
data = [
":ngc_lib",
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
],
# Entry point assumes the user is outside this WORKSPACE,
# and references our rules with @angular//src/ngc-wrapped
entry_point = "angular/src/ngc-wrapped/index.js",
data = [
":ngc_lib",
"@build_bazel_rules_typescript//internal:worker_protocol.proto"
],
node_modules = "@build_bazel_rules_typescript_deps//:node_modules",
visibility = ["//visibility:public"],
)
nodejs_binary(
name = "xi18n",
# Entry point assumes the user is outside this WORKSPACE,
# and references our rules with @angular//src/ngc-wrapped
entry_point = "angular/src/ngc-wrapped/index.js/extract_i18n.js",
data = [
":ngc_lib",
],
# Entry point assumes the user is outside this WORKSPACE,
# and references our rules with @angular//src/ngc-wrapped
entry_point = "angular/src/ngc-wrapped/index.js/extract_i18n.js",
visibility = ["//visibility:public"],
)

View File

@ -8,32 +8,32 @@ ts_library(
"test_support.ts",
"tsconfig_template.ts",
],
tsconfig = ":tsconfig.json",
deps = [
# BEGIN-INTERNAL
# Only needed when compiling within the Angular repo.
# Users will get this dependency from node_modules.
"@//packages/compiler-cli",
# END-INTERNAL
"//src/ngc-wrapped:ngc_lib"
"//src/ngc-wrapped:ngc_lib",
],
tsconfig = ":tsconfig.json",
)
# We need a filegroup so that we can refer
# .d.ts files (by default, jasmine_node_test would get the .js files).
filegroup(
name = "angular_core",
srcs = ["@//packages/core"]
srcs = ["@//packages/core"],
)
jasmine_node_test(
name = "ngc_test",
size = "small",
srcs = [":ngc_test_lib"],
data = [
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
":angular_core",
"//test/ngc-wrapped/empty:empty_tsconfig.json",
"//test/ngc-wrapped/empty:tsconfig.json",
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
],
size="small",
)

View File

@ -1,10 +1,10 @@
load("@angular//:index.bzl", "ng_module")
package(default_visibility=["//test:__subpackages__"])
package(default_visibility = ["//test:__subpackages__"])
ng_module(
name = "empty",
srcs = ["empty.ts"],
deps = ["@//packages/core"],
tsconfig = ":tsconfig.json",
deps = ["@//packages/core"],
)

View File

@ -40,7 +40,7 @@ export function setup(
bazelBin?: string,
tsconfig?: string,
} = {}): TestSupport {
const runfilesPath = process.env['RUNFILES'];
const runfilesPath = process.env['TEST_SRCDIR'];
const basePath = makeTempDir(runfilesPath);
@ -150,7 +150,7 @@ function makeTempDir(baseDir): string {
}
export function listFilesRecursive(dir: string, fileList: string[] = []) {
fs.readdirSync(dir).map(file => {
fs.readdirSync(dir).forEach(file => {
if (fs.statSync(path.join(dir, file)).isDirectory()) {
listFilesRecursive(path.join(dir, file), fileList);
} else {

View File

@ -68,6 +68,9 @@ export function createTsConfig(options: TsConfigOptions) {
// Because we ask for :empty_tsconfig.json, we get the ES6 version which
// expects to write externs, yet that doesn't work under this fixture.
'tsickleExternsPath': '',
// we don't copy the node_modules into our tmp dir, so we should look in
// the original workspace directory for it
'nodeModulesPrefix': '../angular_src/node_modules',
},
'files': options.files,
'angularCompilerOptions': {

View File

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

View File

@ -0,0 +1,20 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "http",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/common/http",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/common",
"//packages/core",
"@rxjs",
],
)

View File

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

View File

@ -0,0 +1,16 @@
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/common/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/common",
"//packages/core",
"@rxjs",
],
)

View File

@ -1,21 +1,24 @@
package(default_visibility=["//visibility:public"])
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_config")
ts_config(
name = "tsconfig",
src = "tsconfig-build.json",
deps = ["//packages:tsconfig-build.json"]
deps = ["//packages:tsconfig-build.json"],
)
ts_library(
name = "compiler-cli",
srcs = glob(["**/*.ts"], exclude=[
"integrationtest/**",
"test/**",
]),
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/compiler-cli",
deps = [
"//packages/compiler"
],
tsconfig = ":tsconfig",
deps = [
"//packages/compiler",
],
)

View File

@ -1,12 +1,15 @@
package(default_visibility=["//visibility:public"])
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "compiler",
srcs = glob(["**/*.ts"], exclude=[
"test/**",
"testing/**",
]),
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/compiler",
tsconfig = ":tsconfig-build.json",
tsconfig = "//packages:tsconfig",
)

View File

@ -43,8 +43,6 @@ const TAG_TO_PLACEHOLDER_NAMES: {[k: string]: string} = {
* Creates unique names for placeholder with different content.
*
* Returns the same placeholder name when the content is identical.
*
* @internal
*/
export class PlaceholderRegistry {
// Count the occurrence of the base name top generate a unique name

View File

@ -0,0 +1,22 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "test",
testonly = 1,
srcs = glob(["**/*.ts"]),
tsconfig = "//packages:tsconfig",
deps = [
"//packages:types",
"//packages/common",
"//packages/compiler",
"//packages/compiler-cli",
"//packages/compiler/testing",
"//packages/core",
"//packages/core/testing",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser/testing",
],
)

View File

@ -33,7 +33,7 @@ describe('StaticReflector', () => {
beforeEach(() => init());
function simplify(context: StaticSymbol, value: any) {
return reflector.simplify(context, value);
return (reflector as any).simplify(context, value);
}
it('should get annotations for NgFor', () => {
@ -1079,11 +1079,11 @@ describe('StaticReflector', () => {
'/tmp/root.ts': ``,
'/tmp/a.ts': `export const x = 1;`,
});
let symbol =
reflector.resolveExternalReference({moduleName: './a', name: 'x'}, '/tmp/root.ts');
let symbol = reflector.resolveExternalReference(
{moduleName: './a', name: 'x', runtime: null}, '/tmp/root.ts');
expect(symbolResolver.getKnownModuleName(symbol.filePath)).toBeFalsy();
symbol = reflector.resolveExternalReference({moduleName: 'a', name: 'x'});
symbol = reflector.resolveExternalReference({moduleName: 'a', name: 'x', runtime: null});
expect(symbolResolver.getKnownModuleName(symbol.filePath)).toBe('a');
});
});

View File

@ -0,0 +1,12 @@
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/compiler/testing",
tsconfig = "//packages:tsconfig",
deps = ["//packages/compiler"],
)

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",
],
)

20
packages/http/BUILD.bazel Normal file
View File

@ -0,0 +1,20 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "http",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/http",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/core",
"//packages/platform-browser",
"@rxjs",
],
)

View File

@ -0,0 +1,16 @@
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/http/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/core",
"//packages/http",
"@rxjs",
],
)

View File

@ -0,0 +1,23 @@
package(default_visibility = ["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "platform-browser-dynamic",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/platform-browser-dynamic",
tsconfig = "//packages:tsconfig",
deps = [
"//packages:types",
"//packages/common",
"//packages/compiler",
"//packages/core",
"//packages/platform-browser",
],
)

View File

@ -0,0 +1,20 @@
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/platform-browser-dynamic/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/compiler",
"//packages/compiler/testing",
"//packages/core",
"//packages/core/testing",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser/testing",
],
)

View File

@ -0,0 +1,21 @@
package(default_visibility = ["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "platform-browser",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/platform-browser",
tsconfig = "//packages:tsconfig",
deps = [
"//packages:types",
"//packages/common",
"//packages/core",
],
)

View File

@ -0,0 +1,21 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "animations",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/platform-browser/animations",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/animations",
"//packages/animations/browser",
"//packages/core",
"//packages/platform-browser",
],
)

View File

@ -0,0 +1,16 @@
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/platform-browser/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/core",
"//packages/platform-browser",
"@rxjs",
],
)

View File

@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "platform-server",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/platform-server",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/animations/browser",
"//packages/common",
"//packages/common/http",
"//packages/compiler",
"//packages/core",
"//packages/http",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser/animations",
"@rxjs",
],
)

View File

@ -0,0 +1,17 @@
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/platform-server/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/core",
"//packages/platform-browser-dynamic/testing",
"//packages/platform-browser/animations",
"//packages/platform-server",
],
)

View File

@ -0,0 +1,22 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "router",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/router",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/common",
"//packages/core",
"//packages/platform-browser",
"//packages/upgrade/static",
"@rxjs",
],
)

View File

@ -0,0 +1,17 @@
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/router/testing",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/common",
"//packages/common/testing",
"//packages/core",
"//packages/router",
],
)

View File

@ -0,0 +1,20 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "service-worker",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
module_name = "@angular/service-worker",
tsconfig = "//packages:tsconfig",
deps = [
"//packages/common",
"//packages/core",
"@rxjs",
],
)

View File

@ -0,0 +1,21 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "worker",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
exclude = ["main.ts"],
),
tsconfig = ":tsconfig.json",
)
ts_library(
name = "main",
srcs = ["main.ts"],
deps = [":worker"],
)

View File

@ -0,0 +1,28 @@
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:types",
"//packages/service-worker/worker",
"//packages/service-worker/worker/testing",
],
)
jasmine_node_test(
name = "test",
srcs = [],
# TODO(alxhub): re-enable when need for main() is removed
tags = ["manual"],
deps = [
":test_lib",
],
)

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"]),
tsconfig = "//packages:tsconfig",
deps = [
"//packages:types",
"//packages/service-worker/worker",
"@rxjs",
],
)

View File

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

View File

@ -2,4 +2,4 @@
set -u -e -o pipefail
bazel build packages/...
bazel build --config=ci packages/...

View File

@ -7,6 +7,9 @@
build --strategy=TypeScriptCompile=worker
build --strategy=AngularTemplateCompile=worker
# Enable debugging tests with --config=debug
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
###############################
# Filesystem interactions #
###############################
@ -44,3 +47,6 @@ test --test_output=errors
# Helps to demonstrate that bazel uses all the cores on the machine.
build --experimental_ui
test --experimental_ui
# Don't be spammy in the continuous integration logs
build:ci --noshow_progress

View File

@ -2,15 +2,9 @@
# yarn lockfile v1
"@bazel/typescript@0.3.2":
version "0.3.2"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.3.2.tgz#b4721b7f9e4c447a553555eab4a437f538a9496d"
dependencies:
"@types/node" "7.0.18"
"@types/source-map" "^0.5.1"
protobufjs "5.0.0"
tsickle "0.25.x"
typescript "2.5.x"
"@bazel/ibazel@^0.1.1":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.1.1.tgz#f970c08b4e4efb0ab17e04ade3cc610554f33bed"
"@google-cloud/common@^0.13.0":
version "0.13.5"
@ -119,10 +113,6 @@
version "6.0.88"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.88.tgz#f618f11a944f6a18d92b5c472028728a3e3d4b66"
"@types/node@7.0.18":
version "7.0.18"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.18.tgz#cd67f27d3dc0cfb746f0bdd5e086c4c5d55be173"
"@types/q@^0.0.32":
version "0.0.32"
resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.32.tgz#bd284e57c84f1325da702babfc82a5328190c0c5"
@ -2985,7 +2975,7 @@ glob@^4.3.1:
minimatch "^2.0.1"
once "^1.3.0"
glob@^5.0.10, glob@^5.0.14, glob@^5.0.15, glob@~5.0.0:
glob@^5.0.14, glob@^5.0.15, glob@~5.0.0:
version "5.0.15"
resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
dependencies:
@ -5521,15 +5511,6 @@ proto-list@~1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
protobufjs@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-5.0.0.tgz#4223063233ea96ac063ca2b554035204db524fa1"
dependencies:
ascli "~1"
bytebuffer "~5"
glob "^5.0.10"
yargs "^3.10.0"
protobufjs@^5.0.0:
version "5.0.2"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-5.0.2.tgz#59748d7dcf03d2db22c13da9feb024e16ab80c91"
@ -6194,11 +6175,11 @@ rx-lite@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"
rxjs@^5.5.2:
version "5.5.2"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.2.tgz#28d403f0071121967f18ad665563255d54236ac3"
rxjs@5.5.5:
version "5.5.5"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.5.tgz#e164f11d38eaf29f56f08c3447f74ff02dd84e97"
dependencies:
symbol-observable "^1.0.1"
symbol-observable "1.0.1"
safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.1"
@ -6831,9 +6812,9 @@ supports-color@^3.1.0:
dependencies:
has-flag "^1.0.0"
symbol-observable@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
symbol-observable@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
systemjs@0.18.10:
version "0.18.10"
@ -7102,7 +7083,7 @@ ts-api-guardian@0.2.2:
minimist "^1.2.0"
typescript "2.0.10"
tsickle@0.25.5, tsickle@0.25.x:
tsickle@0.25.5:
version "0.25.5"
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.25.5.tgz#2891d29f97c4aab1306e06378d8496d1765a4bfe"
dependencies:
@ -7156,6 +7137,12 @@ tsscmp@1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/tsscmp/-/tsscmp-1.0.5.tgz#7dc4a33af71581ab4337da91d85ca5427ebd9a97"
tsutils@2.12.1:
version "2.12.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.12.1.tgz#f4d95ce3391c8971e46e54c4cf0edb0a21dd5b24"
dependencies:
tslib "^1.7.1"
tsutils@^1.4.0:
version "1.9.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0"