build: update rules_nodejs and clean up bazel warnings (#30370)

Preserve compatibility with rollup_bundle rule.
Add missing npm dependencies, which are now enforced by the strict_deps plugin in tsc_wrapped

PR Close #30370
This commit is contained in:
Alex Eagle
2019-05-09 14:51:51 -07:00
committed by Alex Rickabaugh
parent 3fecab64b1
commit 06efc340b6
30 changed files with 123 additions and 62 deletions

View File

@ -40,12 +40,14 @@ def rules_angular_dev_dependencies():
#############################################
http_archive(
name = "io_bazel_rules_sass",
sha256 = "76ae498b9a96fa029f026f8358ed44b93c934dde4691a798cb3a4137c307b7dc",
strip_prefix = "rules_sass-1.15.1",
url = "https://github.com/bazelbuild/rules_sass/archive/1.15.1.zip",
)
http_archive(
name = "io_bazel_skydoc",
sha256 = "f88058b43112e9bdc7fdb0abbdc17c5653268708c01194a159641119195e45c6",
strip_prefix = "skydoc-a9550cb3ca3939cbabe3b589c57b6f531937fa99",
# TODO: switch to upstream when https://github.com/bazelbuild/skydoc/pull/103 is merged
url = "https://github.com/alexeagle/skydoc/archive/a9550cb3ca3939cbabe3b589c57b6f531937fa99.zip",

View File

@ -18,6 +18,7 @@ nodejs_binary(
"@npm//rollup",
"@npm//rollup-plugin-amd",
"@npm//rollup-plugin-commonjs",
"@npm//rollup-plugin-json",
"@npm//rollup-plugin-node-resolve",
"@npm//rollup-plugin-sourcemaps",
],

View File

@ -12,8 +12,8 @@ workspace(name = "project")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_NODEJS_VERSION = "0.27.12"
RULES_NODEJS_SHA256 = "3a3efbf223f6de733475602844ad3a8faa02abda25ab8cfe1d1ed0db134887cf"
RULES_NODEJS_VERSION = "0.29.0"
RULES_NODEJS_SHA256 = "1db950bbd27fb2581866e307c0130983471d4c3cd49c46063a2503ca7b6770a4"
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = RULES_NODEJS_SHA256,

View File

@ -108,7 +108,7 @@ def _esm5_outputs_aspect(target, ctx):
ctx.actions.run(
progress_message = "Compiling TypeScript (ES5 with ES Modules) %s" % target.label,
inputs = target.typescript.replay_params.inputs + [tsconfig],
inputs = target.typescript.replay_params.inputs.to_list() + [tsconfig],
outputs = outputs,
arguments = [tsconfig.path],
executable = compiler,

View File

@ -427,7 +427,7 @@ def ngc_compile_action(
if is_legacy_ngc and messages_out != None:
ctx.actions.run(
inputs = list(inputs),
inputs = inputs,
outputs = messages_out,
executable = ctx.executable.ng_xi18n,
arguments = (_EXTRA_NODE_OPTIONS_FLAGS +
@ -442,7 +442,7 @@ def ngc_compile_action(
if dts_bundles_out != None:
# combine the inputs and outputs and filter .d.ts and json files
filter_inputs = [f for f in inputs + outputs if f.path.endswith(".d.ts") or f.path.endswith(".json")]
filter_inputs = [f for f in list(inputs) + outputs if f.path.endswith(".d.ts") or f.path.endswith(".json")]
if _should_produce_flat_module_outs(ctx):
dts_entry_points = ["%s.d.ts" % _flat_module_out_file(ctx)]

View File

@ -289,12 +289,13 @@ def _ng_package_impl(ctx):
for d in ctx.attr.deps:
if NodeModuleInfo in d:
node_modules_files += _filter_js_inputs(d.files)
esm5_rollup_inputs = depset(node_modules_files, transitive = [esm5_sources])
esm2015_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, _esm2015_root_dir(ctx)]), filename = "_%s.rollup_esm2015.conf.js")
esm5_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]), filename = "_%s.rollup_esm5.conf.js")
fesm2015.append(_rollup(ctx, "fesm2015", esm2015_config, es2015_entry_point, esm_2015_files + node_modules_files, fesm2015_output))
fesm5.append(_rollup(ctx, "fesm5", esm5_config, es5_entry_point, esm5_sources + node_modules_files, fesm5_output))
fesm2015.append(_rollup(ctx, "fesm2015", esm2015_config, es2015_entry_point, depset(node_modules_files, transitive = [esm_2015_files]), fesm2015_output))
fesm5.append(_rollup(ctx, "fesm5", esm5_config, es5_entry_point, esm5_rollup_inputs, fesm5_output))
bundles.append(
_rollup(
@ -302,7 +303,7 @@ def _ng_package_impl(ctx):
"umd",
esm5_config,
es5_entry_point,
esm5_sources + node_modules_files,
esm5_rollup_inputs,
umd_output,
format = "umd",
package_name = package_name,

View File

@ -18,7 +18,6 @@ load(
"@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
"ROLLUP_ATTRS",
"ROLLUP_DEPS_ASPECTS",
"ROLLUP_OUTPUTS",
"run_rollup",
"run_sourcemapexplorer",
"run_terser",
@ -27,6 +26,18 @@ load(
load("@build_bazel_rules_nodejs//internal/common:collect_es6_sources.bzl", collect_es2015_sources = "collect_es6_sources")
load(":esm5.bzl", "esm5_outputs_aspect", "esm5_root_dir", "flatten_esm5")
ROLLUP_OUTPUTS = {
"build_cjs": "%{name}.cjs.js",
"build_es2015": "%{name}.es2015.js",
"build_es2015_min": "%{name}.min.es2015.js",
"build_es2015_min_debug": "%{name}.min_debug.es2015.js",
"build_es5": "%{name}.js",
"build_es5_min": "%{name}.min.js",
"build_es5_min_debug": "%{name}.min_debug.js",
"build_umd": "%{name}.umd.js",
"explore_html": "%{name}.explore.html",
}
PACKAGES = [
# Generated paths when using ng_rollup_bundle outside this monorepo.
"external/angular/packages/core/src",

View File

@ -50,8 +50,8 @@ function addDevDependenciesToPackageJson(options: Schema) {
'@angular/bazel': angularCoreVersion,
'@bazel/bazel': '^0.26.0-rc.5',
'@bazel/ibazel': '^0.10.2',
'@bazel/karma': '0.27.12',
'@bazel/typescript': '0.27.12',
'@bazel/karma': '0.29.0',
'@bazel/typescript': '0.29.0',
};
const recorder = host.beginUpdate(packageJson);