build: update to Bazel 0.14.0 (#24296)
Also update usage of the ctx.actions.args to a newer preferred API PR Close #24296
This commit is contained in:
parent
131602474d
commit
0d07d273dc
|
@ -12,8 +12,8 @@
|
||||||
## IMPORTANT
|
## IMPORTANT
|
||||||
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
|
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
|
||||||
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
|
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
|
||||||
var_1: &docker_image angular/ngcontainer:0.3.0
|
var_1: &docker_image angular/ngcontainer:0.3.1
|
||||||
var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.3.0
|
var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.3.1
|
||||||
|
|
||||||
# Define common ENV vars
|
# Define common ENV vars
|
||||||
var_3: &define_env_vars
|
var_3: &define_env_vars
|
||||||
|
|
|
@ -77,7 +77,7 @@ http_archive(
|
||||||
|
|
||||||
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
|
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
|
||||||
|
|
||||||
check_bazel_version("0.13.0")
|
check_bazel_version("0.14.0")
|
||||||
node_repositories(package_json = ["//:package.json"])
|
node_repositories(package_json = ["//:package.json"])
|
||||||
|
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
|
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
|
||||||
|
|
|
@ -44,7 +44,7 @@ http_archive(
|
||||||
|
|
||||||
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
|
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
|
||||||
|
|
||||||
check_bazel_version("0.13.0")
|
check_bazel_version("0.14.0")
|
||||||
node_repositories(package_json = ["//:package.json"])
|
node_repositories(package_json = ["//:package.json"])
|
||||||
|
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
|
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
|
||||||
|
|
|
@ -80,14 +80,14 @@ def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, for
|
||||||
map_output = ctx.actions.declare_file(js_output.basename + ".map", sibling = js_output)
|
map_output = ctx.actions.declare_file(js_output.basename + ".map", sibling = js_output)
|
||||||
|
|
||||||
args = ctx.actions.args()
|
args = ctx.actions.args()
|
||||||
args.add(["--config", rollup_config.path])
|
args.add("--config", rollup_config)
|
||||||
|
|
||||||
args.add(["--input", entry_point])
|
args.add("--input", entry_point)
|
||||||
args.add(["--output.file", js_output.path])
|
args.add("--output.file", js_output)
|
||||||
args.add(["--output.format", format])
|
args.add("--output.format", format)
|
||||||
if package_name:
|
if package_name:
|
||||||
args.add(["--output.name", _global_name(package_name)])
|
args.add("--output.name", _global_name(package_name))
|
||||||
args.add(["--amd.id", package_name])
|
args.add("--amd.id", package_name)
|
||||||
|
|
||||||
# Note: if the input has external source maps then we need to also install and use
|
# Note: if the input has external source maps then we need to also install and use
|
||||||
# `rollup-plugin-sourcemaps`, which will require us to use rollup.config.js file instead
|
# `rollup-plugin-sourcemaps`, which will require us to use rollup.config.js file instead
|
||||||
|
@ -95,14 +95,15 @@ def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, for
|
||||||
args.add("--sourcemap")
|
args.add("--sourcemap")
|
||||||
|
|
||||||
globals = dict(WELL_KNOWN_GLOBALS, **ctx.attr.globals)
|
globals = dict(WELL_KNOWN_GLOBALS, **ctx.attr.globals)
|
||||||
args.add("--external")
|
|
||||||
external = globals.keys()
|
external = globals.keys()
|
||||||
if not include_tslib:
|
if not include_tslib:
|
||||||
external.append("tslib")
|
external.append("tslib")
|
||||||
args.add(external, join_with=",")
|
args.add_joined("--external", external, join_with=",")
|
||||||
|
|
||||||
args.add("--globals")
|
args.add_joined(
|
||||||
args.add(["%s:%s" % g for g in globals.items()], join_with=",")
|
"--globals",
|
||||||
|
["%s:%s" % g for g in globals.items()],
|
||||||
|
join_with=",")
|
||||||
|
|
||||||
args.add("--silent")
|
args.add("--silent")
|
||||||
|
|
||||||
|
@ -251,8 +252,8 @@ def _ng_package_impl(ctx):
|
||||||
# The order of arguments matters here, as they are read in order in packager.ts.
|
# The order of arguments matters here, as they are read in order in packager.ts.
|
||||||
packager_args.add(npm_package_directory.path)
|
packager_args.add(npm_package_directory.path)
|
||||||
packager_args.add(ctx.label.package)
|
packager_args.add(ctx.label.package)
|
||||||
packager_args.add([ctx.bin_dir.path, ctx.label.package], join_with="/")
|
packager_args.add_joined([ctx.bin_dir.path, ctx.label.package], join_with="/")
|
||||||
packager_args.add([ctx.genfiles_dir.path, ctx.label.package], join_with="/")
|
packager_args.add_joined([ctx.genfiles_dir.path, ctx.label.package], join_with="/")
|
||||||
|
|
||||||
# Marshal the metadata into a JSON string so we can parse the data structure
|
# Marshal the metadata into a JSON string so we can parse the data structure
|
||||||
# in the TypeScript program easily.
|
# in the TypeScript program easily.
|
||||||
|
@ -273,19 +274,19 @@ def _ng_package_impl(ctx):
|
||||||
# placeholder
|
# placeholder
|
||||||
packager_args.add("")
|
packager_args.add("")
|
||||||
|
|
||||||
packager_args.add(_flatten_paths(fesm2015), join_with=",")
|
packager_args.add_joined(_flatten_paths(fesm2015), join_with=",")
|
||||||
packager_args.add(_flatten_paths(fesm5), join_with=",")
|
packager_args.add_joined(_flatten_paths(fesm5), join_with=",")
|
||||||
packager_args.add(_flatten_paths(esm2015), join_with=",")
|
packager_args.add_joined(_flatten_paths(esm2015), join_with=",")
|
||||||
packager_args.add(_flatten_paths(esm5), join_with=",")
|
packager_args.add_joined(_flatten_paths(esm5), join_with=",")
|
||||||
packager_args.add(_flatten_paths(bundles), join_with=",")
|
packager_args.add_joined(_flatten_paths(bundles), join_with=",")
|
||||||
packager_args.add([s.path for s in ctx.files.srcs], join_with=",")
|
packager_args.add_joined([s.path for s in ctx.files.srcs], join_with=",")
|
||||||
|
|
||||||
# TODO: figure out a better way to gather runfiles providers from the transitive closure.
|
# TODO: figure out a better way to gather runfiles providers from the transitive closure.
|
||||||
packager_args.add([d.path for d in ctx.files.data], join_with=",")
|
packager_args.add_joined([d.path for d in ctx.files.data], join_with=",")
|
||||||
|
|
||||||
if ctx.file.license_banner:
|
if ctx.file.license_banner:
|
||||||
packager_inputs.append(ctx.file.license_banner)
|
packager_inputs.append(ctx.file.license_banner)
|
||||||
packager_args.add(ctx.file.license_banner.path)
|
packager_args.add(ctx.file.license_banner)
|
||||||
else:
|
else:
|
||||||
# placeholder
|
# placeholder
|
||||||
packager_args.add("")
|
packager_args.add("")
|
||||||
|
|
|
@ -61,10 +61,10 @@ def run_brotli(ctx, input, output):
|
||||||
# Borrowed from bazelbuild/rules_nodejs
|
# Borrowed from bazelbuild/rules_nodejs
|
||||||
def _run_tsc(ctx, input, output):
|
def _run_tsc(ctx, input, output):
|
||||||
args = ctx.actions.args()
|
args = ctx.actions.args()
|
||||||
args.add(["--target", "es5"])
|
args.add("--target", "es5")
|
||||||
args.add("--allowJS")
|
args.add("--allowJS")
|
||||||
args.add(input.path)
|
args.add(input)
|
||||||
args.add(["--outFile", output.path])
|
args.add("--outFile", output)
|
||||||
|
|
||||||
ctx.action(
|
ctx.action(
|
||||||
executable = ctx.executable._tsc,
|
executable = ctx.executable._tsc,
|
||||||
|
|
|
@ -19,7 +19,7 @@ RUN JAVA_DEBIAN_VERSION="8u131-b11-1~bpo8+1" \
|
||||||
###
|
###
|
||||||
# Bazel install
|
# Bazel install
|
||||||
# See https://bazel.build/versions/master/docs/install-ubuntu.html#using-bazel-custom-apt-repository-recommended
|
# See https://bazel.build/versions/master/docs/install-ubuntu.html#using-bazel-custom-apt-repository-recommended
|
||||||
RUN BAZEL_VERSION="0.13.0" \
|
RUN BAZEL_VERSION="0.14.0" \
|
||||||
&& wget -q -O - https://bazel.build/bazel-release.pub.gpg | apt-key add - \
|
&& wget -q -O - https://bazel.build/bazel-release.pub.gpg | apt-key add - \
|
||||||
&& echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" > /etc/apt/sources.list.d/bazel.list \
|
&& echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" > /etc/apt/sources.list.d/bazel.list \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
|
|
|
@ -6,7 +6,7 @@ This docker container provides everything needed to build and test Angular appli
|
||||||
- npm 5.5.1
|
- npm 5.5.1
|
||||||
- yarn 1.3.2
|
- yarn 1.3.2
|
||||||
- Java 8 (for Closure Compiler and Bazel)
|
- Java 8 (for Closure Compiler and Bazel)
|
||||||
- Bazel build tool v0.13.0 - http://bazel.build
|
- Bazel build tool v0.14.0 - http://bazel.build
|
||||||
- Google Chrome 63.0.3239.84
|
- Google Chrome 63.0.3239.84
|
||||||
- Mozilla Firefox 47.0.1
|
- Mozilla Firefox 47.0.1
|
||||||
- xvfb (virtual framebuffer) for headless testing
|
- xvfb (virtual framebuffer) for headless testing
|
||||||
|
|
Loading…
Reference in New Issue