From ba8df8a3f1bafc63f2a15c8502723c270820649f Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Fri, 2 Mar 2018 10:10:59 -0800 Subject: [PATCH] build: update to latest bazel rules (#22558) PR Close #22558 --- WORKSPACE | 16 +++++++--------- integration/bazel/WORKSPACE | 18 ++++++------------ packages/bazel/src/esm5.bzl | 2 +- packages/bazel/src/ngc-wrapped/BUILD.bazel | 2 +- packages/service-worker/worker/src/driver.ts | 8 ++++---- .../service-worker/worker/test/happy_spec.ts | 2 +- 6 files changed, 20 insertions(+), 28 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index e6a50b61ec..dd18ca2191 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,13 +2,13 @@ workspace(name = "angular") # Using a pre-release snapshot to pick up a commit that makes all nodejs_binary # programs produce source-mapped stack traces and uglify sourcemaps. -RULES_NODEJS_VERSION = "4303cbef12e5e252ad66cc35cff1123e3a44ee83" +RULES_NODEJS_VERSION = "f3fc23b7e1f32984a3e5d0c7eabe3baa127fb32a" http_archive( name = "build_bazel_rules_nodejs", - url = "https://github.com/bazelbuild/rules_nodejs/archive/%s.zip" % RULES_NODEJS_VERSION, - strip_prefix = "rules_nodejs-%s" % RULES_NODEJS_VERSION, - sha256 = "fccb9a7122f339d89c9994dc0fea33c737dd76e66281d0da0cb841da5f1edec7", + url = "https://github.com/bazelbuild/rules_nodejs/archive/0.5.0.zip", + strip_prefix = "rules_nodejs-0.5.0", + sha256 = "06aabb253c3867d51724386ac5622a0a238bbd82e2c70ce1d09ee3ceac4c31d6", ) load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories") @@ -16,13 +16,11 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_reposi check_bazel_version("0.9.0") node_repositories(package_json = ["//:package.json"]) -RULES_TYPESCRIPT_VERSION = "d3cc5cd72d89aee0e4c2553ae1b99c707ecbef4e" - http_archive( name = "build_bazel_rules_typescript", - url = "https://github.com/bazelbuild/rules_typescript/archive/%s.zip" % RULES_TYPESCRIPT_VERSION, - strip_prefix = "rules_typescript-%s" % RULES_TYPESCRIPT_VERSION, - sha256 = "a233fcca41c3e59f639ac71c396edb30e9e9716cf8ed5fb20b51ff8910d5d895", + url = "https://github.com/bazelbuild/rules_typescript/archive/0.11.0.zip", + strip_prefix = "rules_typescript-0.11.0", + sha256 = "ce7bac7b5287d5162fcbe4f7c14ff507ae7d506ceb44626ad09f6b7e27d3260b", ) load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") diff --git a/integration/bazel/WORKSPACE b/integration/bazel/WORKSPACE index c680a8b74e..06ca4806eb 100644 --- a/integration/bazel/WORKSPACE +++ b/integration/bazel/WORKSPACE @@ -1,26 +1,20 @@ workspace(name = "bazel_integration_test") -# Using a pre-release snapshot to pick up a commit that makes all nodejs_binary -# programs produce source-mapped stack traces and uglify sourcemaps. -RULES_NODEJS_VERSION = "4303cbef12e5e252ad66cc35cff1123e3a44ee83" - http_archive( name = "build_bazel_rules_nodejs", - url = "https://github.com/bazelbuild/rules_nodejs/archive/%s.zip" % RULES_NODEJS_VERSION, - strip_prefix = "rules_nodejs-%s" % RULES_NODEJS_VERSION, - sha256 = "fccb9a7122f339d89c9994dc0fea33c737dd76e66281d0da0cb841da5f1edec7", + url = "https://github.com/bazelbuild/rules_nodejs/archive/0.5.0.zip", + strip_prefix = "rules_nodejs-0.5.0", + sha256 = "06aabb253c3867d51724386ac5622a0a238bbd82e2c70ce1d09ee3ceac4c31d6", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories") node_repositories(package_json = ["//:package.json"]) -RULES_TYPESCRIPT_VERSION = "d3cc5cd72d89aee0e4c2553ae1b99c707ecbef4e" - http_archive( name = "build_bazel_rules_typescript", - url = "https://github.com/bazelbuild/rules_typescript/archive/%s.zip" % RULES_TYPESCRIPT_VERSION, - strip_prefix = "rules_typescript-%s" % RULES_TYPESCRIPT_VERSION, - sha256 = "a233fcca41c3e59f639ac71c396edb30e9e9716cf8ed5fb20b51ff8910d5d895", + url = "https://github.com/bazelbuild/rules_typescript/archive/0.11.0.zip", + strip_prefix = "rules_typescript-0.11.0", + sha256 = "ce7bac7b5287d5162fcbe4f7c14ff507ae7d506ceb44626ad09f6b7e27d3260b", ) load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") diff --git a/packages/bazel/src/esm5.bzl b/packages/bazel/src/esm5.bzl index 514ed7e357..0d550c5579 100644 --- a/packages/bazel/src/esm5.bzl +++ b/packages/bazel/src/esm5.bzl @@ -113,7 +113,7 @@ esm5_outputs_aspect = aspect( # For some reason, having the compiler output as an input to the action above # is not sufficient. "_tsc_wrapped": attr.label( - default = Label("@build_bazel_rules_typescript//internal/tsc_wrapped:tsc_wrapped_bin"), + default = Label("@build_bazel_rules_typescript//internal:tsc_wrapped_bin"), executable = True, cfg = "host", ), diff --git a/packages/bazel/src/ngc-wrapped/BUILD.bazel b/packages/bazel/src/ngc-wrapped/BUILD.bazel index beca2b1f0f..75b98f6d71 100644 --- a/packages/bazel/src/ngc-wrapped/BUILD.bazel +++ b/packages/bazel/src/ngc-wrapped/BUILD.bazel @@ -16,7 +16,7 @@ ts_library( # 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", ], ) diff --git a/packages/service-worker/worker/src/driver.ts b/packages/service-worker/worker/src/driver.ts index 65c1d3c9f1..b4e046539f 100644 --- a/packages/service-worker/worker/src/driver.ts +++ b/packages/service-worker/worker/src/driver.ts @@ -243,7 +243,7 @@ export class Driver implements Debuggable, UpdateSource { } private async handlePush(data: any): Promise { - this.broadcast({ + await this.broadcast({ type: 'PUSH', data, }); @@ -254,7 +254,7 @@ export class Driver implements Debuggable, UpdateSource { let options: {[key: string]: string | undefined} = {}; NOTIFICATION_OPTION_NAMES.filter(name => desc.hasOwnProperty(name)) .forEach(name => options[name] = desc[name]); - this.scope.registration.showNotification(desc['title'] !, options); + await this.scope.registration.showNotification(desc['title'] !, options); } private async reportStatus(client: Client, promise: Promise, nonce: number): Promise { @@ -614,7 +614,7 @@ export class Driver implements Debuggable, UpdateSource { if (!res.ok) { if (res.status === 404) { await this.deleteAllCaches(); - this.scope.registration.unregister(); + await this.scope.registration.unregister(); } throw new Error('Manifest fetch failed!'); } @@ -707,7 +707,7 @@ export class Driver implements Debuggable, UpdateSource { // Firstly, check if the manifest version is correct. if (manifest.configVersion !== SUPPORTED_CONFIG_VERSION) { await this.deleteAllCaches(); - this.scope.registration.unregister(); + await this.scope.registration.unregister(); throw new Error( `Invalid config version: expected ${SUPPORTED_CONFIG_VERSION}, got ${manifest.configVersion}.`); } diff --git a/packages/service-worker/worker/test/happy_spec.ts b/packages/service-worker/worker/test/happy_spec.ts index bf0d71fd2a..994e6f326d 100644 --- a/packages/service-worker/worker/test/happy_spec.ts +++ b/packages/service-worker/worker/test/happy_spec.ts @@ -527,7 +527,7 @@ const manifestUpdateHash = sha1(JSON.stringify(manifestUpdate)); expect(await driver.checkForUpdate()).toEqual(true); serverUpdate.assertSawRequestFor('/quux.txt'); serverUpdate.clearRequests(); - driver.updateClient(await scope.clients.get('default')); + await driver.updateClient(await scope.clients.get('default')); expect(await makeRequest(scope, '/quux.txt')).toEqual('this is quux v2'); serverUpdate.assertNoOtherRequests(); });