build(bazel): update to bazel 0.27.0 and fix compat in @angular/bazel package (#31019)
ctx.actions.declare_file now used in @angular/bazel ng_module rule as ctx.new_file is now deprecated. Fixes error: ``` File "ng_module.bzl", line 272, in _expected_outs ctx.new_file(ctx.genfiles_dir, (ctx.label.name ...")) Use ctx.actions.declare_file instead of ctx.new_file. Use --incompatible_new_actions_api=false to temporarily disable this check. ``` This can be worked around with incompatible_new_actions_api flag but may as well fix it proper so downstream doesn't require this flag due to this code. Also, depset() is no longer iterable by default without a flag. This required fixing in a few spots in @angular/bazel. fix: foo PR Close #31019
This commit is contained in:
parent
f7e9659c4d
commit
28d3bfc416
5
.bazelrc
5
.bazelrc
|
@ -157,6 +157,11 @@ build:remote --bes_results_url="https://source.cloud.google.com/results/invocati
|
|||
# This allows us to avoid installing a second copy of node_modules
|
||||
common --experimental_allow_incremental_repository_updates
|
||||
|
||||
# This option is changed to true in Bazel 0.27 but exposes a known worker mode bug:
|
||||
# https://github.com/bazelbuild/rules_typescript/issues/449
|
||||
# While we are fixing that issue, we need to keep this breaking change disabled
|
||||
build --incompatible_list_based_execution_strategy_selection=false
|
||||
|
||||
####################################################
|
||||
# User bazel configuration
|
||||
# NOTE: This needs to be the *last* entry in the config.
|
||||
|
|
|
@ -27,6 +27,7 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "check_rules
|
|||
|
||||
# Bazel version must be at least the following version because:
|
||||
# - 0.26.0 managed_directories feature added which is required for nodejs rules 0.30.0
|
||||
# - 0.27.0 has a fix for managed_directories after `rm -rf node_modules`
|
||||
check_bazel_version(
|
||||
message = """
|
||||
You no longer need to install Bazel on your machine.
|
||||
|
@ -35,7 +36,7 @@ Try running `yarn bazel` instead.
|
|||
(If you did run that, check that you've got a fresh `yarn install`)
|
||||
|
||||
""",
|
||||
minimum_bazel_version = "0.26.0",
|
||||
minimum_bazel_version = "0.27.0",
|
||||
)
|
||||
|
||||
# The NodeJS rules version must be at least the following version because:
|
||||
|
|
|
@ -20,3 +20,7 @@ build --symlink_prefix=/
|
|||
# Turn on managed directories feature in Bazel
|
||||
# This allows us to avoid installing a second copy of node_modules
|
||||
common --experimental_allow_incremental_repository_updates
|
||||
|
||||
# Temporary flag to for using nodejs rules 0.31.1 with Bazel 0.27.0
|
||||
# TODO(gregmagolan): remove after updating to next nodejs rules release
|
||||
common --incompatible_depset_is_not_iterable=false
|
||||
|
|
|
@ -25,6 +25,7 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_reposi
|
|||
|
||||
# Bazel version must be at least the following version because:
|
||||
# - 0.26.0 managed_directories feature added which is required for nodejs rules 0.30.0
|
||||
# - 0.27.0 has a fix for managed_directories after `rm -rf node_modules`
|
||||
check_bazel_version(
|
||||
message = """
|
||||
You no longer need to install Bazel on your machine.
|
||||
|
@ -33,7 +34,7 @@ Try running `yarn bazel` instead.
|
|||
(If you did run that, check that you've got a fresh `yarn install`)
|
||||
|
||||
""",
|
||||
minimum_bazel_version = "0.26.0",
|
||||
minimum_bazel_version = "0.27.0",
|
||||
)
|
||||
|
||||
# Setup the Node.js toolchain
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
"// 3": "when updating @bazel/bazel version you also need to update the RBE settings in .bazelrc (see https://github.com/angular/angular/pull/27935)",
|
||||
"devDependencies": {
|
||||
"@angular/cli": "^8.0.0-beta.15",
|
||||
"@bazel/bazel": "0.26.1",
|
||||
"@bazel/bazel": "0.27.0",
|
||||
"@bazel/buildifier": "^0.26.0",
|
||||
"@bazel/ibazel": "~0.9.0",
|
||||
"@types/minimist": "^1.2.0",
|
||||
|
|
|
@ -49,7 +49,7 @@ Try running `yarn bazel` instead.
|
|||
(If you did run that, check that you've got a fresh `yarn install`)
|
||||
|
||||
""",
|
||||
minimum_bazel_version = "0.26.0",
|
||||
minimum_bazel_version = "0.27.0",
|
||||
)
|
||||
|
||||
# Setup the Node repositories. We need a NodeJS version that is more recent than v10.15.0
|
||||
|
|
|
@ -33,3 +33,6 @@ build --define=compile=legacy
|
|||
# Turn on managed directories feature in Bazel
|
||||
# This allows us to avoid installing a second copy of node_modules
|
||||
common --experimental_allow_incremental_repository_updates
|
||||
|
||||
# Compatibility flag for Bazel 0.27.0
|
||||
common --incompatible_depset_is_not_iterable=false
|
||||
|
|
|
@ -269,7 +269,7 @@ def _expected_outs(ctx):
|
|||
# TODO(alxhub): i18n is only produced by the legacy compiler currently. This should be re-enabled
|
||||
# when ngtsc can extract messages
|
||||
if is_legacy_ngc:
|
||||
i18n_messages_files = [ctx.new_file(ctx.genfiles_dir, ctx.label.name + "_ngc_messages.xmb")]
|
||||
i18n_messages_files = [ctx.actions.declare_file(ctx.label.name + "_ngc_messages.xmb")]
|
||||
else:
|
||||
i18n_messages_files = []
|
||||
|
||||
|
@ -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 list(inputs) + outputs if f.path.endswith(".d.ts") or f.path.endswith(".json")]
|
||||
filter_inputs = [f for f in inputs.to_list() + 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)]
|
||||
|
|
|
@ -94,6 +94,10 @@ WELL_KNOWN_GLOBALS = {p: _global_name(p) for p in [
|
|||
"rxjs/operators",
|
||||
]}
|
||||
|
||||
# skydoc fails with type(depset()) so using "depset" here instead
|
||||
# TODO(gregmagolan): clean this up
|
||||
_DEPSET_TYPE = "depset"
|
||||
|
||||
def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, format = "es", package_name = "", include_tslib = False):
|
||||
map_output = ctx.actions.declare_file(js_output.basename + ".map", sibling = js_output)
|
||||
|
||||
|
@ -133,7 +137,7 @@ def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, for
|
|||
|
||||
args.add("--silent")
|
||||
|
||||
other_inputs = [ctx.executable._rollup, rollup_config]
|
||||
other_inputs = [rollup_config]
|
||||
if ctx.file.license_banner:
|
||||
other_inputs.append(ctx.file.license_banner)
|
||||
if ctx.version_file:
|
||||
|
@ -144,6 +148,7 @@ def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, for
|
|||
inputs = inputs.to_list() + other_inputs,
|
||||
outputs = [js_output, map_output],
|
||||
executable = ctx.executable._rollup,
|
||||
tools = [ctx.executable._rollup],
|
||||
arguments = [args],
|
||||
)
|
||||
return struct(
|
||||
|
@ -165,7 +170,8 @@ def _flatten_paths(directory):
|
|||
# Optionally can filter out files that do not belong to a specified package path.
|
||||
def _filter_out_generated_files(files, extension, package_path = None):
|
||||
result = []
|
||||
for file in files:
|
||||
files_list = files.to_list() if type(files) == _DEPSET_TYPE else files
|
||||
for file in files_list:
|
||||
# If the "package_path" parameter has been specified, filter out files
|
||||
# that do not start with the the specified package path.
|
||||
if package_path and not file.short_path.startswith(package_path):
|
||||
|
@ -183,9 +189,10 @@ def _esm2015_root_dir(ctx):
|
|||
return ctx.label.name + ".es6"
|
||||
|
||||
def _filter_js_inputs(all_inputs):
|
||||
all_inputs_list = all_inputs.to_list() if type(all_inputs) == _DEPSET_TYPE else all_inputs
|
||||
return [
|
||||
f
|
||||
for f in all_inputs
|
||||
for f in all_inputs_list
|
||||
if f.path.endswith(".js") or f.path.endswith(".json")
|
||||
]
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ function addDevDependenciesToPackageJson(options: Schema) {
|
|||
|
||||
const devDependencies: {[k: string]: string} = {
|
||||
'@angular/bazel': angularCoreVersion,
|
||||
'@bazel/bazel': '^0.26.0',
|
||||
'@bazel/bazel': '^0.27.0',
|
||||
'@bazel/ibazel': '^0.10.2',
|
||||
'@bazel/karma': '0.31.1',
|
||||
'@bazel/typescript': '0.31.1',
|
||||
|
|
|
@ -113,6 +113,7 @@ describe('ng-add schematic', () => {
|
|||
const json = JSON.parse(content);
|
||||
const devDeps = Object.keys(json.devDependencies);
|
||||
expect(devDeps).toContain('@bazel/bazel');
|
||||
expect(devDeps).toContain('@bazel/hide-bazel-files');
|
||||
expect(devDeps).toContain('@bazel/ibazel');
|
||||
expect(devDeps).toContain('@bazel/karma');
|
||||
});
|
||||
|
|
38
yarn.lock
38
yarn.lock
|
@ -90,29 +90,29 @@
|
|||
esutils "^2.0.2"
|
||||
js-tokens "^4.0.0"
|
||||
|
||||
"@bazel/bazel-darwin_x64@0.26.1":
|
||||
version "0.26.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.26.1.tgz#1b5c69b635e5c2a8c3090fa5f6bcb45735f06045"
|
||||
integrity sha512-9VjrR+ce+iS9xS1lgeAo1RAPXlxCvez/r3smN1lP4s4YNF0s5LAT0cevIl6Zz2nwyEha/6JvY3v6Euemy36F0w==
|
||||
"@bazel/bazel-darwin_x64@0.27.0":
|
||||
version "0.27.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.27.0.tgz#83a03c92d52ae60e48e86a1ee697e69e12ddbdf6"
|
||||
integrity sha512-CyavIbRKRa/55aMyfEM9hjbt4TVISfv7HLeymHTGTLWzS8uQokQ8W9tR/pgc7YJn8F0x64dd7nQKxhbYHM1Qfg==
|
||||
|
||||
"@bazel/bazel-linux_x64@0.26.1":
|
||||
version "0.26.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.26.1.tgz#04dd194bdcd6b9d45bd865a9a60c280d0d600251"
|
||||
integrity sha512-oZooDxI1C4p7o18zx2Uns2cK/NN2hgF2YSBKH0aVDPAAxQA85h+g124CWDEbsghOdRMSBM0Hd0SSeIqwZcqLSw==
|
||||
"@bazel/bazel-linux_x64@0.27.0":
|
||||
version "0.27.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.27.0.tgz#2358292aa4901f526ba9b90874256f63d6d6608c"
|
||||
integrity sha512-hO04v7C6M3Jf+qNlLE+IticZZKkkS7Nv6+pXDnENgFWrqLV2H93un6kNQnk83B0hP2cEqRQ8rw5yrIcqXNNuSQ==
|
||||
|
||||
"@bazel/bazel-win32_x64@0.26.1":
|
||||
version "0.26.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.26.1.tgz#9351f07313173b1f98006da8131c94db7aa7c506"
|
||||
integrity sha512-0FkOo8+bxw13X2m6ALhXX2241gG9ZXgcLu0E/IbCWy/TmOB5bR0Z73CslszWbXIldVYnANuhFmnkxIa745Du5Q==
|
||||
"@bazel/bazel-win32_x64@0.27.0":
|
||||
version "0.27.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.27.0.tgz#0e5e498de5ccccc9a6cf481cd46904ee938ab6c2"
|
||||
integrity sha512-7hIGNhdgaxRt9ceSOCs3eSTtCNi4GXz3nu6OjfgSp+QiqLbW/iAVWa8M8vD5aemZ1BSHek4/LISdWUTncLJk+w==
|
||||
|
||||
"@bazel/bazel@0.26.1":
|
||||
version "0.26.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-0.26.1.tgz#de5febbd1f4b457aa870fb69492f474850283e5d"
|
||||
integrity sha512-x0IR0KEML4JGG6QpAOpHQHWpMqM1YQjOi8zY1jjLwiRHhC3Y8Tc/Mcspnd6zUnjfs7MerPfppkyx2jaEnZwUuQ==
|
||||
"@bazel/bazel@0.27.0":
|
||||
version "0.27.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-0.27.0.tgz#4e72c8e1cbb4da41022b6de1afe28731f5f58e09"
|
||||
integrity sha512-yIj64IkesNzjHsoeehQUMBOgrCK/JMSuon5CvBqo6+izPXAmt+OW05uqaLL/FPAYAFQ2mHxsYtDsPxsM8DUbqA==
|
||||
optionalDependencies:
|
||||
"@bazel/bazel-darwin_x64" "0.26.1"
|
||||
"@bazel/bazel-linux_x64" "0.26.1"
|
||||
"@bazel/bazel-win32_x64" "0.26.1"
|
||||
"@bazel/bazel-darwin_x64" "0.27.0"
|
||||
"@bazel/bazel-linux_x64" "0.27.0"
|
||||
"@bazel/bazel-win32_x64" "0.27.0"
|
||||
|
||||
"@bazel/buildifier-darwin_x64@0.26.0":
|
||||
version "0.26.0"
|
||||
|
|
Loading…
Reference in New Issue