From ef534c0cc16b4fd3a4c721f814e5530d63cd6642 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 6 Dec 2017 06:56:49 -0800 Subject: [PATCH] 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 --- .circleci/config.yml | 11 +++-- BUILD.bazel | 15 ++++-- WORKSPACE | 16 ++++-- integration/bazel/BUILD.bazel | 26 ++++++++-- integration/bazel/WORKSPACE | 18 +++++-- integration/bazel/package.json | 3 +- integration/bazel/src/BUILD.bazel | 2 +- integration/bazel/src/hello-world/BUILD.bazel | 6 ++- package.json | 5 +- packages/BUILD.bazel | 21 +++++++- packages/animations/BUILD.bazel | 18 +++++++ packages/animations/browser/BUILD.bazel | 18 +++++++ packages/animations/browser/test/BUILD.bazel | 17 +++++++ .../web_animations_player_spec.ts | 4 +- .../animations/browser/testing/BUILD.bazel | 15 ++++++ packages/animations/test/BUILD.bazel | 15 ++++++ .../animations/test/animation_player_spec.ts | 4 +- packages/bazel/package.json | 1 - packages/bazel/src/ngc-wrapped/BUILD.bazel | 23 ++++----- packages/bazel/test/ngc-wrapped/BUILD.bazel | 10 ++-- .../bazel/test/ngc-wrapped/empty/BUILD.bazel | 4 +- .../bazel/test/ngc-wrapped/test_support.ts | 4 +- .../test/ngc-wrapped/tsconfig_template.ts | 3 ++ packages/common/BUILD.bazel | 22 +++++---- packages/common/http/BUILD.bazel | 20 ++++++++ packages/common/http/testing/BUILD.bazel | 14 ++++++ packages/common/testing/BUILD.bazel | 16 ++++++ packages/compiler-cli/BUILD.bazel | 21 ++++---- packages/compiler/BUILD.bazel | 15 +++--- .../src/i18n/serializers/placeholder.ts | 2 - packages/compiler/test/BUILD.bazel | 22 +++++++++ .../test/aot/static_reflector_spec.ts | 8 +-- packages/compiler/testing/BUILD.bazel | 12 +++++ packages/core/BUILD.bazel | 24 +++++---- packages/core/src/di/reflective_key.ts | 3 -- packages/core/src/zone/ng_zone.ts | 2 - packages/core/test/BUILD.bazel | 43 ++++++++++++++++ packages/core/test/application_init_spec.ts | 6 +-- packages/core/test/application_ref_spec.ts | 2 +- packages/core/test/error_handler_spec.ts | 4 +- .../linker/regression_integration_spec.ts | 2 +- packages/core/testing/BUILD.bazel | 15 ++++++ packages/http/BUILD.bazel | 20 ++++++++ packages/http/testing/BUILD.bazel | 16 ++++++ packages/platform-browser-dynamic/BUILD.bazel | 23 +++++++++ .../testing/BUILD.bazel | 20 ++++++++ packages/platform-browser/BUILD.bazel | 21 ++++++++ .../platform-browser/animations/BUILD.bazel | 21 ++++++++ packages/platform-browser/testing/BUILD.bazel | 16 ++++++ packages/platform-server/BUILD.bazel | 27 ++++++++++ packages/platform-server/testing/BUILD.bazel | 17 +++++++ packages/router/BUILD.bazel | 22 +++++++++ packages/router/testing/BUILD.bazel | 17 +++++++ packages/service-worker/BUILD.bazel | 20 ++++++++ packages/service-worker/worker/BUILD.bazel | 21 ++++++++ .../service-worker/worker/test/BUILD.bazel | 28 +++++++++++ .../service-worker/worker/testing/BUILD.bazel | 15 ++++++ packages/upgrade/static/BUILD.bazel | 15 ++++++ scripts/ci/test-bazel.sh | 2 +- tools/bazel.rc | 6 +++ yarn.lock | 49 +++++++------------ 61 files changed, 757 insertions(+), 131 deletions(-) create mode 100644 packages/animations/BUILD.bazel create mode 100644 packages/animations/browser/BUILD.bazel create mode 100644 packages/animations/browser/test/BUILD.bazel create mode 100644 packages/animations/browser/testing/BUILD.bazel create mode 100644 packages/animations/test/BUILD.bazel create mode 100644 packages/common/http/BUILD.bazel create mode 100644 packages/common/http/testing/BUILD.bazel create mode 100644 packages/common/testing/BUILD.bazel create mode 100644 packages/compiler/test/BUILD.bazel create mode 100644 packages/compiler/testing/BUILD.bazel create mode 100644 packages/core/test/BUILD.bazel create mode 100644 packages/core/testing/BUILD.bazel create mode 100644 packages/http/BUILD.bazel create mode 100644 packages/http/testing/BUILD.bazel create mode 100644 packages/platform-browser-dynamic/BUILD.bazel create mode 100644 packages/platform-browser-dynamic/testing/BUILD.bazel create mode 100644 packages/platform-browser/BUILD.bazel create mode 100644 packages/platform-browser/animations/BUILD.bazel create mode 100644 packages/platform-browser/testing/BUILD.bazel create mode 100644 packages/platform-server/BUILD.bazel create mode 100644 packages/platform-server/testing/BUILD.bazel create mode 100644 packages/router/BUILD.bazel create mode 100644 packages/router/testing/BUILD.bazel create mode 100644 packages/service-worker/BUILD.bazel create mode 100644 packages/service-worker/worker/BUILD.bazel create mode 100644 packages/service-worker/worker/test/BUILD.bazel create mode 100644 packages/service-worker/worker/testing/BUILD.bazel create mode 100644 packages/upgrade/static/BUILD.bazel diff --git a/.circleci/config.yml b/.circleci/config.yml index e3dfaef0e1..f80f71be28 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/BUILD.bazel b/BUILD.bazel index d0dc7aaac4..64b5f05179 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -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", diff --git a/WORKSPACE b/WORKSPACE index b7461d3bbe..d7bb55a961 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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", +) diff --git a/integration/bazel/BUILD.bazel b/integration/bazel/BUILD.bazel index 629c7aae5a..23dee7adc6 100644 --- a/integration/bazel/BUILD.bazel +++ b/integration/bazel/BUILD.bazel @@ -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", + ]]), ) diff --git a/integration/bazel/WORKSPACE b/integration/bazel/WORKSPACE index a25d7475b5..4c5693f5e2 100644 --- a/integration/bazel/WORKSPACE +++ b/integration/bazel/WORKSPACE @@ -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", diff --git a/integration/bazel/package.json b/integration/bazel/package.json index c0fb1ee1d0..4865e1f14d 100644 --- a/integration/bazel/package.json +++ b/integration/bazel/package.json @@ -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" } } \ No newline at end of file diff --git a/integration/bazel/src/BUILD.bazel b/integration/bazel/src/BUILD.bazel index b6798a41fb..0530c6cc91 100644 --- a/integration/bazel/src/BUILD.bazel +++ b/integration/bazel/src/BUILD.bazel @@ -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"], ) diff --git a/integration/bazel/src/hello-world/BUILD.bazel b/integration/bazel/src/hello-world/BUILD.bazel index 51fd096815..496922e6ee 100644 --- a/integration/bazel/src/hello-world/BUILD.bazel +++ b/integration/bazel/src/hello-world/BUILD.bazel @@ -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"], ) diff --git a/package.json b/package.json index c9fb7fa253..291c3257c5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 1efbd13005..f7259928cf 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -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", +) diff --git a/packages/animations/BUILD.bazel b/packages/animations/BUILD.bazel new file mode 100644 index 0000000000..97e495fc58 --- /dev/null +++ b/packages/animations/BUILD.bazel @@ -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", + ], +) diff --git a/packages/animations/browser/BUILD.bazel b/packages/animations/browser/BUILD.bazel new file mode 100644 index 0000000000..64638883cb --- /dev/null +++ b/packages/animations/browser/BUILD.bazel @@ -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", + ], +) diff --git a/packages/animations/browser/test/BUILD.bazel b/packages/animations/browser/test/BUILD.bazel new file mode 100644 index 0000000000..f8cb1743d1 --- /dev/null +++ b/packages/animations/browser/test/BUILD.bazel @@ -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", + ], +) diff --git a/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts b/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts index a258ca03a0..0fd04c8977 100644 --- a/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts +++ b/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts @@ -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(); diff --git a/packages/animations/browser/testing/BUILD.bazel b/packages/animations/browser/testing/BUILD.bazel new file mode 100644 index 0000000000..b7f72b9262 --- /dev/null +++ b/packages/animations/browser/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/animations/test/BUILD.bazel b/packages/animations/test/BUILD.bazel new file mode 100644 index 0000000000..e172b127c3 --- /dev/null +++ b/packages/animations/test/BUILD.bazel @@ -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", + ], +) diff --git a/packages/animations/test/animation_player_spec.ts b/packages/animations/test/animation_player_spec.ts index 16c593bb0e..ae74a7268d 100644 --- a/packages/animations/test/animation_player_spec.ts +++ b/packages/animations/test/animation_player_spec.ts @@ -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(); diff --git a/packages/bazel/package.json b/packages/bazel/package.json index 17fbb66bc6..0f91fb5c4f 100644 --- a/packages/bazel/package.json +++ b/packages/bazel/package.json @@ -9,7 +9,6 @@ "typescript": ">=2.4.2 <2.6" }, "dependencies": { - "@bazel/typescript": "0.3.2", "@types/node": "6.0.84" }, "repository": { diff --git a/packages/bazel/src/ngc-wrapped/BUILD.bazel b/packages/bazel/src/ngc-wrapped/BUILD.bazel index 5db7f46a84..56a1557524 100644 --- a/packages/bazel/src/ngc-wrapped/BUILD.bazel +++ b/packages/bazel/src/ngc-wrapped/BUILD.bazel @@ -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"], ) diff --git a/packages/bazel/test/ngc-wrapped/BUILD.bazel b/packages/bazel/test/ngc-wrapped/BUILD.bazel index 14a7edde2b..6e0b79c0fa 100644 --- a/packages/bazel/test/ngc-wrapped/BUILD.bazel +++ b/packages/bazel/test/ngc-wrapped/BUILD.bazel @@ -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", ) diff --git a/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel b/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel index 7da580ffea..ee912d1090 100644 --- a/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel +++ b/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel @@ -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"], ) diff --git a/packages/bazel/test/ngc-wrapped/test_support.ts b/packages/bazel/test/ngc-wrapped/test_support.ts index 63cc5060ef..b18ed80c0c 100644 --- a/packages/bazel/test/ngc-wrapped/test_support.ts +++ b/packages/bazel/test/ngc-wrapped/test_support.ts @@ -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 { diff --git a/packages/bazel/test/ngc-wrapped/tsconfig_template.ts b/packages/bazel/test/ngc-wrapped/tsconfig_template.ts index b7dfcba036..ace06601a0 100644 --- a/packages/bazel/test/ngc-wrapped/tsconfig_template.ts +++ b/packages/bazel/test/ngc-wrapped/tsconfig_template.ts @@ -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': { diff --git a/packages/common/BUILD.bazel b/packages/common/BUILD.bazel index 2b18d849ff..50bccee698 100644 --- a/packages/common/BUILD.bazel +++ b/packages/common/BUILD.bazel @@ -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", + ], ) diff --git a/packages/common/http/BUILD.bazel b/packages/common/http/BUILD.bazel new file mode 100644 index 0000000000..98f335c0cc --- /dev/null +++ b/packages/common/http/BUILD.bazel @@ -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", + ], +) diff --git a/packages/common/http/testing/BUILD.bazel b/packages/common/http/testing/BUILD.bazel new file mode 100644 index 0000000000..b8ba9a1f7a --- /dev/null +++ b/packages/common/http/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/common/testing/BUILD.bazel b/packages/common/testing/BUILD.bazel new file mode 100644 index 0000000000..c1c2b4c2ca --- /dev/null +++ b/packages/common/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel index 1694e6d067..7bd6ec8fea 100644 --- a/packages/compiler-cli/BUILD.bazel +++ b/packages/compiler-cli/BUILD.bazel @@ -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", + ], ) diff --git a/packages/compiler/BUILD.bazel b/packages/compiler/BUILD.bazel index 427a708dab..f6d2b6f4b1 100644 --- a/packages/compiler/BUILD.bazel +++ b/packages/compiler/BUILD.bazel @@ -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", ) diff --git a/packages/compiler/src/i18n/serializers/placeholder.ts b/packages/compiler/src/i18n/serializers/placeholder.ts index 02fb3c96c7..def0996964 100644 --- a/packages/compiler/src/i18n/serializers/placeholder.ts +++ b/packages/compiler/src/i18n/serializers/placeholder.ts @@ -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 diff --git a/packages/compiler/test/BUILD.bazel b/packages/compiler/test/BUILD.bazel new file mode 100644 index 0000000000..ca89efd784 --- /dev/null +++ b/packages/compiler/test/BUILD.bazel @@ -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", + ], +) diff --git a/packages/compiler/test/aot/static_reflector_spec.ts b/packages/compiler/test/aot/static_reflector_spec.ts index 156f72ee8d..0d13a2bd25 100644 --- a/packages/compiler/test/aot/static_reflector_spec.ts +++ b/packages/compiler/test/aot/static_reflector_spec.ts @@ -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'); }); }); diff --git a/packages/compiler/testing/BUILD.bazel b/packages/compiler/testing/BUILD.bazel new file mode 100644 index 0000000000..1660a42671 --- /dev/null +++ b/packages/compiler/testing/BUILD.bazel @@ -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"], +) diff --git a/packages/core/BUILD.bazel b/packages/core/BUILD.bazel index 90001f97b3..eebf4873e6 100644 --- a/packages/core/BUILD.bazel +++ b/packages/core/BUILD.bazel @@ -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", -) \ No newline at end of file + name = "core", + srcs = glob( + [ + "*.ts", + "src/**/*.ts", + ], + ), + module_name = "@angular/core", + tsconfig = "//packages:tsconfig", + deps = [ + "@rxjs", + ], +) diff --git a/packages/core/src/di/reflective_key.ts b/packages/core/src/di/reflective_key.ts index bc51fcb649..5f54b80ca8 100644 --- a/packages/core/src/di/reflective_key.ts +++ b/packages/core/src/di/reflective_key.ts @@ -51,9 +51,6 @@ export class ReflectiveKey { static get numberOfKeys(): number { return _globalKeyRegistry.numberOfKeys; } } -/** - * @internal - */ export class KeyRegistry { private _allKeys = new Map(); diff --git a/packages/core/src/zone/ng_zone.ts b/packages/core/src/zone/ng_zone.ts index b4eb39c1d2..b845e48998 100644 --- a/packages/core/src/zone/ng_zone.ts +++ b/packages/core/src/zone/ng_zone.ts @@ -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; diff --git a/packages/core/test/BUILD.bazel b/packages/core/test/BUILD.bazel new file mode 100644 index 0000000000..722de0a604 --- /dev/null +++ b/packages/core/test/BUILD.bazel @@ -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", + ], +) diff --git a/packages/core/test/application_init_spec.ts b/packages/core/test/application_init_spec.ts index 693d538876..bc39636a85 100644 --- a/packages/core/test/application_init_spec.ts +++ b/packages/core/test/application_init_spec.ts @@ -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; diff --git a/packages/core/test/application_ref_spec.ts b/packages/core/test/application_ref_spec.ts index 2e06b5ac5b..3b6d497753 100644 --- a/packages/core/test/application_ref_spec.ts +++ b/packages/core/test/application_ref_spec.ts @@ -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; diff --git a/packages/core/test/error_handler_spec.ts b/packages/core/test/error_handler_spec.ts index 3d296c8af6..27af1beba6 100644 --- a/packages/core/test/error_handler_spec.ts +++ b/packages/core/test/error_handler_spec.ts @@ -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; diff --git a/packages/core/test/linker/regression_integration_spec.ts b/packages/core/test/linker/regression_integration_spec.ts index 200151a51b..1a785013e7 100644 --- a/packages/core/test/linker/regression_integration_spec.ts +++ b/packages/core/test/linker/regression_integration_spec.ts @@ -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(); }); diff --git a/packages/core/testing/BUILD.bazel b/packages/core/testing/BUILD.bazel new file mode 100644 index 0000000000..a976557437 --- /dev/null +++ b/packages/core/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/http/BUILD.bazel b/packages/http/BUILD.bazel new file mode 100644 index 0000000000..4df225bc0a --- /dev/null +++ b/packages/http/BUILD.bazel @@ -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", + ], +) diff --git a/packages/http/testing/BUILD.bazel b/packages/http/testing/BUILD.bazel new file mode 100644 index 0000000000..3e049d473d --- /dev/null +++ b/packages/http/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/platform-browser-dynamic/BUILD.bazel b/packages/platform-browser-dynamic/BUILD.bazel new file mode 100644 index 0000000000..b3333d1294 --- /dev/null +++ b/packages/platform-browser-dynamic/BUILD.bazel @@ -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", + ], +) diff --git a/packages/platform-browser-dynamic/testing/BUILD.bazel b/packages/platform-browser-dynamic/testing/BUILD.bazel new file mode 100644 index 0000000000..3a3086d679 --- /dev/null +++ b/packages/platform-browser-dynamic/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/platform-browser/BUILD.bazel b/packages/platform-browser/BUILD.bazel new file mode 100644 index 0000000000..0e9aa2e25d --- /dev/null +++ b/packages/platform-browser/BUILD.bazel @@ -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", + ], +) diff --git a/packages/platform-browser/animations/BUILD.bazel b/packages/platform-browser/animations/BUILD.bazel new file mode 100644 index 0000000000..7690a16f86 --- /dev/null +++ b/packages/platform-browser/animations/BUILD.bazel @@ -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", + ], +) diff --git a/packages/platform-browser/testing/BUILD.bazel b/packages/platform-browser/testing/BUILD.bazel new file mode 100644 index 0000000000..4cd6e12678 --- /dev/null +++ b/packages/platform-browser/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/platform-server/BUILD.bazel b/packages/platform-server/BUILD.bazel new file mode 100644 index 0000000000..0d9f44a990 --- /dev/null +++ b/packages/platform-server/BUILD.bazel @@ -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", + ], +) diff --git a/packages/platform-server/testing/BUILD.bazel b/packages/platform-server/testing/BUILD.bazel new file mode 100644 index 0000000000..56b81727ff --- /dev/null +++ b/packages/platform-server/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/router/BUILD.bazel b/packages/router/BUILD.bazel new file mode 100644 index 0000000000..0723bd66cc --- /dev/null +++ b/packages/router/BUILD.bazel @@ -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", + ], +) diff --git a/packages/router/testing/BUILD.bazel b/packages/router/testing/BUILD.bazel new file mode 100644 index 0000000000..d35efe25eb --- /dev/null +++ b/packages/router/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/service-worker/BUILD.bazel b/packages/service-worker/BUILD.bazel new file mode 100644 index 0000000000..acc3911a3b --- /dev/null +++ b/packages/service-worker/BUILD.bazel @@ -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", + ], +) diff --git a/packages/service-worker/worker/BUILD.bazel b/packages/service-worker/worker/BUILD.bazel new file mode 100644 index 0000000000..7f95c0440c --- /dev/null +++ b/packages/service-worker/worker/BUILD.bazel @@ -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"], +) diff --git a/packages/service-worker/worker/test/BUILD.bazel b/packages/service-worker/worker/test/BUILD.bazel new file mode 100644 index 0000000000..76c74bc3f8 --- /dev/null +++ b/packages/service-worker/worker/test/BUILD.bazel @@ -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", + ], +) diff --git a/packages/service-worker/worker/testing/BUILD.bazel b/packages/service-worker/worker/testing/BUILD.bazel new file mode 100644 index 0000000000..a29d54969b --- /dev/null +++ b/packages/service-worker/worker/testing/BUILD.bazel @@ -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", + ], +) diff --git a/packages/upgrade/static/BUILD.bazel b/packages/upgrade/static/BUILD.bazel new file mode 100644 index 0000000000..2f791e7078 --- /dev/null +++ b/packages/upgrade/static/BUILD.bazel @@ -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", + ], +) diff --git a/scripts/ci/test-bazel.sh b/scripts/ci/test-bazel.sh index 9f22e933fe..6377524236 100755 --- a/scripts/ci/test-bazel.sh +++ b/scripts/ci/test-bazel.sh @@ -2,4 +2,4 @@ set -u -e -o pipefail -bazel build packages/... +bazel build --config=ci packages/... diff --git a/tools/bazel.rc b/tools/bazel.rc index d62883e887..325374b5cd 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -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 diff --git a/yarn.lock b/yarn.lock index 4485e2f022..3485f06cd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"