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