build(bazel): remove hacky fake @angular/bazel npm package under tools/npm/@angular_bazel (#36009)

PR Close #36009
This commit is contained in:
Greg Magolan 2020-03-11 01:44:27 -07:00 committed by Matias Niemelä
parent 1f89c6130e
commit 10f1e94f18
6 changed files with 3 additions and 48 deletions

View File

@ -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",

View File

@ -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/",
},

View File

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

View File

@ -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');

View File

@ -1,6 +0,0 @@
{
"version": "0.0.0",
"bin": {
"ngc-wrapped": "./index.js"
}
}

View File

@ -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"