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

View File

@ -43,6 +43,7 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/util",
"@npm//@bazel/typescript",
"@npm//@types",
"@npm//reflect-metadata",
"@npm//tsickle",
"@npm//typescript",
],

View File

@ -12,5 +12,6 @@ ts_library(
"//packages/compiler-cli/ngcc",
"//packages/compiler-cli/src/ngtsc/path",
"//packages/compiler-cli/src/ngtsc/testing",
"@npm//typescript",
],
)

View File

@ -11,6 +11,7 @@ ts_library(
deps = [
"//packages:types",
"//packages/compiler-cli/src/ngtsc/shims",
"@npm//typescript",
],
)

View File

@ -8,5 +8,6 @@ ts_library(
deps = [
"//packages/core/schematics/migrations/injectable-pipe",
"@npm//tslint",
"@npm//typescript",
],
)

View File

@ -13,6 +13,7 @@ ts_library(
"//packages/compiler",
"//packages/compiler-cli",
"//packages/core/schematics/utils",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@types/node",
"@npm//rxjs",

View File

@ -9,5 +9,6 @@ ts_library(
"//packages/core/schematics/migrations/static-queries",
"//packages/core/schematics/utils",
"@npm//tslint",
"@npm//typescript",
],
)

View File

@ -12,6 +12,7 @@ ts_library(
deps = [
"//packages/compiler",
"//packages/core/schematics/utils",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@types/node",
"@npm//typescript",

View File

@ -10,5 +10,6 @@ ts_library(
"//packages/core/schematics/utils",
"//packages/core/schematics/utils/tslint",
"@npm//tslint",
"@npm//typescript",
],
)

View File

@ -17,6 +17,7 @@ ts_library(
"//packages/core/schematics/migrations/template-var-assignment",
"//packages/core/schematics/migrations/template-var-assignment/google3",
"//packages/core/schematics/utils",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@types/shelljs",
"@npm//tslint",

View File

@ -9,5 +9,8 @@ ts_library(
"//packages/compiler",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@schematics/angular",
"@npm//@types/node",
"@npm//typescript",
],
)

View File

@ -7,4 +7,5 @@ ts_library(
visibility = [
"//packages/core/schematics/migrations/template-var-assignment/google3:__pkg__",
],
deps = ["@npm//typescript"],
)

View File

@ -24,6 +24,7 @@ ts_library(
"//packages/platform-browser/testing",
"//packages/platform-server",
"//packages/private/testing",
"@npm//rxjs",
"@npm//zone.js",
],
)

View File

@ -1522,7 +1522,7 @@ function declareTests(config?: {useJit: boolean}) {
expect(getDOM().nodeName(c.renderNode).toUpperCase()).toEqual('INPUT');
expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual('DIV');
expect((<Injector>c.injector).get).toBeTruthy();
expect(c.context).toBe(fixture.componentInstance);
expect(c.context).toEqual(fixture.componentInstance);
expect(c.references['local']).toBeDefined();
}
});
@ -1567,7 +1567,7 @@ function declareTests(config?: {useJit: boolean}) {
expect(getDOM().nodeName(c.renderNode).toUpperCase()).toEqual('SPAN');
expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual('DIV');
expect((<Injector>c.injector).get).toBeTruthy();
expect(c.context).toBe(fixture.componentInstance);
expect(c.context).toEqual(fixture.componentInstance);
expect(c.references['local']).toBeDefined();
}));
});

View File

@ -10,6 +10,7 @@ ts_library(
"//packages:types",
"//packages/core",
"//packages/core/src/di/interface",
"@npm//reflect-metadata",
],
)

View File

@ -9,6 +9,7 @@ ts_library(
"//packages/compiler",
"//packages/compiler-cli/test:test_utils",
"//packages/language-service",
"@npm//reflect-metadata",
"@npm//typescript",
],
)