diff --git a/package.json b/package.json index 71d308cf05..f4bbb7fb28 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "@angular-devkit/build-optimizer": "0.900.3", "@angular-devkit/core": "9.0.3", "@angular-devkit/schematics": "9.0.3", - "@angular/bazel": "file:./tools/npm/@angular_bazel", "@babel/core": "^7.8.6", "@babel/generator": "^7.8.6", "@babel/template": "^7.8.6", diff --git a/packages/bazel/BUILD.bazel b/packages/bazel/BUILD.bazel index 4fc98d63ec..03f80c652e 100644 --- a/packages/bazel/BUILD.bazel +++ b/packages/bazel/BUILD.bazel @@ -19,6 +19,7 @@ pkg_npm( ], substitutions = { "(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "", + "//packages/bazel/src/ngc-wrapped": "@npm//@angular/bazel/bin:ngc-wrapped", "//packages/bazel/": "//", "angular/packages/bazel/": "npm_angular_bazel/", }, diff --git a/packages/bazel/src/esm5.bzl b/packages/bazel/src/esm5.bzl index 22903a9d77..95d420dfa0 100644 --- a/packages/bazel/src/esm5.bzl +++ b/packages/bazel/src/esm5.bzl @@ -12,8 +12,6 @@ However we need to publish this flavor on NPM, so it's necessary to be able to produce it. """ -load(":external.bzl", "DEFAULT_NG_COMPILER") - # The provider downstream rules use to access the outputs ESM5Info = provider( doc = "Typescript compilation outputs in ES5 syntax with ES Modules", @@ -94,15 +92,6 @@ def _esm5_outputs_aspect(target, ctx): compiler = ctx.executable._tsc_wrapped elif replay_compiler_name.startswith("ngc-wrapped"): compiler = ctx.executable._ngc_wrapped - - # BEGIN-INTERNAL - # If the "replay_compiler" path does not refer to "ngc_wrapped" from the "@npm" workspace, - # we use "ngc_wrapped" from within the Angular workspace. This is necessary because we - # don't have a "npm" workspace with the "@angular/bazel" NPM package installed. - if replay_compiler_path != ctx.executable._ngc_wrapped.short_path: - compiler = ctx.executable._internal_ngc_wrapped - - # END-INTERNAL else: fail("Unknown replay compiler", target.typescript.replay_params.compiler.path) @@ -149,14 +138,6 @@ esm5_outputs_aspect = aspect( # Recurse to the deps of any target we visit attr_aspects = ["deps"], attrs = { - # This is only used if the replay_compiler refers to the "angular" workspace. In that - # case we need to use "ngc_wrapped" from its source location because we can't have - # the "npm" workspace that has the "@angular/bazel" NPM package installed. - "_internal_ngc_wrapped": attr.label( - default = Label("//packages/bazel/src/ngc-wrapped"), - executable = True, - cfg = "host", - ), "_modify_tsconfig": attr.label( default = Label("//packages/bazel/src:modify_tsconfig"), executable = True, @@ -167,12 +148,9 @@ esm5_outputs_aspect = aspect( executable = True, cfg = "host", ), - # This is the default "ngc_wrapped" executable that will be used to replay the compilation - # for ESM5 mode. The default compiler consumes "ngc_wrapped" from the "@npm" workspace. - # This is needed for downstream Bazel users that can have a different TypeScript - # version installed. + # Replaced with "@npm//@angular/bazel/bin:ngc-wrapped" in the published package "_ngc_wrapped": attr.label( - default = Label(DEFAULT_NG_COMPILER), + default = Label("//packages/bazel/src/ngc-wrapped"), executable = True, cfg = "host", ), diff --git a/tools/npm/@angular_bazel/index.js b/tools/npm/@angular_bazel/index.js deleted file mode 100755 index f06914f2b7..0000000000 --- a/tools/npm/@angular_bazel/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @fileoverview This files is only here so that @npm//@angular/bazel/bin:ngc-wrapped - * is a valid target as it is part of `esm5_outputs_aspect` in /packages/bazel/src/esm5.bzl - * TODO(gregmagolan): fix esm5_outputs_aspect so that this is not required - */ - -throw new Error('should never be run'); diff --git a/tools/npm/@angular_bazel/package.json b/tools/npm/@angular_bazel/package.json deleted file mode 100644 index 99c97e797b..0000000000 --- a/tools/npm/@angular_bazel/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "0.0.0", - "bin": { - "ngc-wrapped": "./index.js" - } -} diff --git a/yarn.lock b/yarn.lock index 332f198e70..5cabd86120 100644 --- a/yarn.lock +++ b/yarn.lock @@ -127,9 +127,6 @@ ora "4.0.2" rxjs "6.5.3" -"@angular/bazel@file:./tools/npm/@angular_bazel": - version "0.0.0" - "@angular/cli@9.0.3": version "9.0.3" resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-9.0.3.tgz#114bf16fd00685d814840f6fece286e0f8f6f1e3"