build: convert entry_point to label (#30627)

PR Close #30627
This commit is contained in:
Alex Eagle
2019-06-07 13:38:06 -07:00
committed by Igor Minar
parent a794143820
commit ef0b2cc74d
56 changed files with 108 additions and 3786 deletions

View File

@ -22,7 +22,7 @@ ng_package(
"//packages/animations/browser:package.json",
"//packages/animations/browser/testing:package.json",
],
entry_point = "packages/animations/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -22,7 +22,7 @@ nodejs_binary(
"@npm//rollup-plugin-node-resolve",
"@npm//rollup-plugin-sourcemaps",
],
entry_point = "npm/node_modules/rollup/bin/rollup",
entry_point = "@npm//node_modules/rollup:bin/rollup",
install_source_map_support = False,
visibility = ["//visibility:public"],
)
@ -35,7 +35,7 @@ filegroup(
nodejs_binary(
name = "modify_tsconfig",
data = ["modify_tsconfig.js"],
entry_point = "angular/packages/bazel/src/modify_tsconfig.js",
entry_point = ":modify_tsconfig.js",
install_source_map_support = False,
node_modules = ":empty_node_modules",
visibility = ["//visibility:public"],

View File

@ -25,7 +25,7 @@ nodejs_binary(
"@npm//@bazel/typescript",
"@npm//@microsoft/api-extractor",
],
entry_point = "angular/packages/bazel/src/api-extractor/index.js",
entry_point = ":index.ts",
visibility = ["//visibility:public"],
)

View File

@ -106,9 +106,15 @@ def _esm5_outputs_aspect(target, ctx):
else:
fail("Unknown replay compiler", target.typescript.replay_params.compiler.path)
inputs = [tsconfig]
if (type(target.typescript.replay_params.inputs) == type([])):
inputs.extend(target.typescript.replay_params.inputs)
else:
inputs.extend(target.typescript.replay_params.inputs.to_list())
ctx.actions.run(
progress_message = "Compiling TypeScript (ES5 with ES Modules) %s" % target.label,
inputs = target.typescript.replay_params.inputs.to_list() + [tsconfig],
inputs = inputs,
outputs = outputs,
arguments = [tsconfig.path],
executable = compiler,

View File

@ -447,7 +447,7 @@ def ngc_compile_action(
if _should_produce_flat_module_outs(ctx):
dts_entry_points = ["%s.d.ts" % _flat_module_out_file(ctx)]
else:
dts_entry_points = [ctx.attr.entry_point.replace(".ts", ".d.ts")]
dts_entry_points = [ctx.attr.entry_point.label.name.replace(".ts", ".d.ts")]
if _should_produce_r3_symbols_bundle(ctx):
dts_entry_points.append(_R3_SYMBOLS_DTS_FILE)
@ -719,7 +719,7 @@ NG_MODULE_RULE_ATTRS = dict(dict(COMMON_ATTRIBUTES, **NG_MODULE_ATTRIBUTES), **{
""",
default = Label("@npm//typescript:typescript__typings"),
),
"entry_point": attr.string(),
"entry_point": attr.label(allow_single_file = True),
# Default is %{name}_public_index
# The suffix points to the generated "bundle index" files that users import from

View File

@ -23,7 +23,7 @@ nodejs_binary(
"lib",
"@npm//shelljs",
],
entry_point = "angular/packages/bazel/src/ng_package/packager.js",
entry_point = ":packager.ts",
install_source_map_support = False,
)

View File

@ -455,13 +455,20 @@ def primary_entry_point_name(name, entry_point, entry_point_name):
Returns:
name of the entry point, which will appear in the name of generated bundles
"""
if (type(entry_point) == "Target"):
ep = entry_point.label
elif (type(entry_point) == "Label"):
ep = entry_point
else:
fail("entry_point should be a Target or Label but got %s" % type(entry_point))
if entry_point_name:
# If an explicit entry_point_name is given, use that.
return entry_point_name
elif entry_point.find("/") >= 0:
# If the entry_point has multiple path segments, use the second one.
# E.g., for "@angular/cdk/a11y", use "cdk".
return entry_point.split("/")[-2]
elif ep.package.find("/") >= 0:
# If the entry_point package has multiple path segments, use the last one.
# E.g., for "//packages/angular/cdk:a11y", use "cdk".
return ep.package.split("/")[-1]
else:
# Fall back to the name of the ng_package rule.
return name

View File

@ -36,7 +36,7 @@ nodejs_binary(
"@npm//source-map-support",
"@npm//tslib",
],
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js",
entry_point = ":index.ts",
visibility = ["//visibility:public"],
)
@ -46,7 +46,7 @@ nodejs_binary(
":ngc_lib",
"@npm//source-map-support",
],
entry_point = "angular/packages/bazel/src/ngc-wrapped/extract_i18n.js",
entry_point = ":extract_i18n.ts",
visibility = ["//visibility:public"],
)

View File

@ -80,6 +80,6 @@ nodejs_binary(
"//packages/bazel/test/ng_package/example:npm_package",
"@npm//diff",
],
entry_point = "angular/packages/bazel/test/ng_package/example_package.spec.js",
entry_point = ":example_package.spec.ts",
templated_args = ["--accept"],
)

View File

@ -23,7 +23,7 @@ ng_package(
":arbitrary_genfiles_file",
":extra-styles.css",
],
entry_point = "packages/bazel/test/ng_package/example/index.js",
entry_point = ":index.ts",
entry_point_name = "waffels",
packages = [
":arbitrary_npm_package",

View File

@ -24,7 +24,7 @@ ts_devserver(
rollup_bundle(
name = "bundle",
entry_point = "packages/bazel/test/protractor-2/app",
entry_point = ":app.ts",
deps = [":app"],
)

View File

@ -16,7 +16,7 @@ nodejs_binary(
"fake-devserver.js",
"@npm//minimist",
],
entry_point = "angular/packages/bazel/test/protractor-utils/fake-devserver.js",
entry_point = ":fake-devserver.ts",
)
jasmine_node_test(

View File

@ -25,7 +25,7 @@ ng_package(
"//packages/common/testing:package.json",
"//packages/common/upgrade:package.json",
],
entry_point = "packages/common/index.js",
entry_point = ":index.ts",
packages = ["//packages/common/locales:package"],
tags = [
"release-with-framework",

View File

@ -10,7 +10,7 @@ nodejs_binary(
"@npm//chokidar",
"@npm//reflect-metadata",
],
entry_point = "angular/packages/compiler-cli/src/main.js",
entry_point = "//packages/compiler-cli:src/main.ts",
)
nodejs_binary(
@ -20,7 +20,7 @@ nodejs_binary(
"@npm//chokidar",
"@npm//reflect-metadata",
],
entry_point = "angular/packages/compiler-cli/src/extract_i18n.js",
entry_point = "//packages/compiler-cli:src/extract_i18n.ts",
)
nodejs_test(
@ -54,6 +54,6 @@ nodejs_test(
"//packages/platform-server:npm_package",
"//packages/router:npm_package",
] + glob(["**/*"]),
entry_point = "angular/packages/compiler-cli/integrationtest/test.js",
entry_point = "//packages/compiler-cli/integrationtest:test.ts",
tags = ["no-ivy-aot"],
)

View File

@ -50,8 +50,10 @@ const requiredNodeModules = {
// Fine grained dependencies which are used by the integration test Angular modules, and
// need to be symlinked so that they can be resolved by NodeJS or NGC.
'buffer-from': resolveNpmTreeArtifact('npm/node_modules/buffer-from'),
'reflect-metadata': resolveNpmTreeArtifact('npm/node_modules/reflect-metadata'),
'rxjs': resolveNpmTreeArtifact('npm/node_modules/rxjs'),
'source-map': resolveNpmTreeArtifact('npm/node_modules/source-map'),
'source-map-support': resolveNpmTreeArtifact('npm/node_modules/source-map-support'),
'typescript': resolveNpmTreeArtifact('npm/node_modules/typescript'),
'zone.js': resolveNpmTreeArtifact('npm/node_modules/zone.js'),

View File

@ -15,7 +15,7 @@ ng_package(
srcs = [
"package.json",
],
entry_point = "packages/fake_core/index.js",
entry_point = ":index.ts",
deps = [
":fake_core",
],

View File

@ -18,7 +18,7 @@ ng_package(
"package.json",
"//packages/compiler/testing:package.json",
],
entry_point = "packages/compiler/compiler.js",
entry_point = ":compiler.ts",
include_devmode_srcs = True,
tags = [
"release-with-framework",

View File

@ -28,7 +28,7 @@ ng_package(
"package.json",
"//packages/core/testing:package.json",
],
entry_point = "packages/core/index.js",
entry_point = ":index.ts",
packages = [
"//packages/core/schematics:npm_package",
],

View File

@ -19,13 +19,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/animation_world/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -14,7 +14,7 @@ ts_library(
ng_rollup_bundle(
name = "bundle",
entry_point = "packages/core/test/bundling/core_all/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -20,13 +20,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/cyclic_import/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -17,13 +17,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/hello_world/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -13,13 +13,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/hello_world_i18n/index.js",
entry_point = ":index.ts",
tags = ["ivy-only"],
deps = [
":hello_world_i18n",

View File

@ -17,13 +17,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/hello_world_r2/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -19,13 +19,7 @@ ts_library(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/injection/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -20,13 +20,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/todo/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -22,13 +22,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/todo_i18n/index.js",
entry_point = ":index.ts",
tags = [
"ivy-only",
],

View File

@ -21,13 +21,7 @@ ng_module(
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/todo_r2/index.js",
entry_point = "index.ts",
tags = [
"ivy-only",
],

View File

@ -23,7 +23,7 @@ ng_package(
"**/*.externs.js",
"**/package.json",
]),
entry_point = "packages/elements/index.js",
entry_point = ":index.ts",
packages = [
"//packages/elements/schematics:npm_package",
],

View File

@ -21,7 +21,7 @@ ng_module(
ng_package(
name = "npm_package",
srcs = ["package.json"],
entry_point = "packages/forms/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -23,7 +23,7 @@ ng_package(
"package.json",
"//packages/http/testing:package.json",
],
entry_point = "packages/http/index.js",
entry_point = ":index.ts",
tags = [
# Currently the plan for Angular v8 is to exclude @angular/http package from publishing
# "release-with-framework",

View File

@ -2,7 +2,7 @@ load(":rollup.bzl", "ls_rollup_bundle")
ls_rollup_bundle(
name = "language-service",
entry_point = "packages/language-service/index.js",
entry_point = "//packages/language-service:index.ts",
globals = {
"fs": "fs",
"path": "path",

View File

@ -25,7 +25,7 @@ ng_package(
"package.json",
"//packages/platform-browser-dynamic/testing:package.json",
],
entry_point = "packages/platform-browser-dynamic/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -26,7 +26,7 @@ ng_package(
"//packages/platform-browser/animations:package.json",
"//packages/platform-browser/testing:package.json",
],
entry_point = "packages/platform-browser/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -31,7 +31,7 @@ ng_package(
"package.json",
"//packages/platform-server/testing:package.json",
],
entry_point = "packages/platform-server/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -22,7 +22,7 @@ ng_module(
ng_package(
name = "npm_package",
srcs = ["package.json"],
entry_point = "packages/platform-webworker-dynamic/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -23,7 +23,7 @@ ng_module(
ng_package(
name = "npm_package",
srcs = ["package.json"],
entry_point = "packages/platform-webworker/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -25,7 +25,7 @@ ng_package(
"//packages/router/testing:package.json",
"//packages/router/upgrade:package.json",
],
entry_point = "packages/router/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -46,7 +46,7 @@ ng_package(
"//packages/service-worker/config",
"//packages/service-worker/config:schema.json",
],
entry_point = "packages/service-worker/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],

View File

@ -16,7 +16,7 @@ ts_library(
ng_rollup_bundle(
name = "ngsw_config",
entry_point = "packages/service-worker/cli/main.js",
entry_point = ":main.ts",
deps = [
":cli",
],

View File

@ -24,7 +24,7 @@ ts_library(
ng_rollup_bundle(
name = "ngsw_worker",
entry_point = "packages/service-worker/worker/main.js",
entry_point = ":main.ts",
deps = [
":main",
],

View File

@ -24,7 +24,7 @@ ng_package(
"package.json",
"//packages/upgrade/static:package.json",
],
entry_point = "packages/upgrade/index.js",
entry_point = ":index.ts",
tags = [
"release-with-framework",
],