Skip to content

build: update to bazel v2.1.0 #18457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,4 @@ try-import .bazelrc.user

# TODO: check if we can enable these deprecations.
build --incompatible_new_actions_api=false
build --incompatible_depset_is_not_iterable=false
build --incompatible_no_support_tools_in_action_inputs=false
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
9 changes: 6 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ var_2: &docker-firefox-image circleci/node:12.9.1-browsers
# **Note**: When updating the beginning of the cache key, also update the cache key to match
# the new cache key prefix. This allows us to take advantage of CircleCI's fallback caching.
# Read more here: https://circleci.com/docs/2.0/caching/#restoring-cache.
var_3: &cache_key v5-ng-mat-{{ checksum "tools/bazel/postinstall-patches.js" }}-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }}
var_3: &cache_key v6-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }}
# We want to invalidate the cache if the postinstall patches change. In order to apply new
# patches, a clean version of the node modules is needed.
var_4: &cache_fallback_key v5-ng-mat-{{ checksum "tools/bazel/postinstall-patches.js" }}-
# patches, a clean version of the node modules is needed. Additionally, we invalidate the cache
# if the Bazel version changes. We do this because otherwise the `bazelisk` cache folder will
# contain all previously used versions and ultimately cause the cache restoring to be slower.
var_4: &cache_fallback_key v6-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-

# Settings common to each job
var_5: &job_defaults
Expand Down Expand Up @@ -47,6 +49,7 @@ var_8: &save_cache
key: *cache_key
paths:
- "node_modules"
- "~/.cache/bazelisk"
- "~/bazel_repository_cache"

# Decryption token that is used to decode the GCP credentials file in ".circleci/gcp_token".
Expand Down
24 changes: 12 additions & 12 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Add NodeJS rules
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "3887b948779431ac443e6a64f31b9e1e17b8d386a31eebc50ec1d9b0a6cabd2b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.0.0/rules_nodejs-1.0.0.tar.gz"],
sha256 = "b6670f9f43faa66e3009488bbd909bc7bc46a5a9661a33f6bc578068d1837f37",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.3.0/rules_nodejs-1.3.0.tar.gz"],
)

# Add sass rules
Expand All @@ -18,7 +18,7 @@ http_archive(
# Patch `rules_sass` to work around a bug that causes error messages to be not
# printed in worker mode: https://github.com/bazelbuild/rules_sass/issues/96.
# TODO(devversion): remove this patch once the Sass Node entry-point returns a `Promise`.
patches = ["//tools/bazel:sass_worker_async.patch"],
patches = ["//tools/postinstall:sass_worker_async.patch"],
sha256 = "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647",
strip_prefix = "rules_sass-1.25.0",
urls = [
Expand All @@ -28,8 +28,8 @@ http_archive(

load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version", "node_repositories", "yarn_install")

# The minimum bazel version to use with this repo is v1.1.0.
check_bazel_version("1.1.0")
# The minimum bazel version to use with this repo is v2.0.0.
check_bazel_version("2.0.0")

node_repositories(
node_repositories = {
Expand All @@ -52,8 +52,8 @@ yarn_install(
# We add the postinstall patches file, and ngcc main fields update script here so
# that Yarn will rerun whenever one of these files has been modified.
data = [
"//:tools/bazel/postinstall-patches.js",
"//:tools/bazel/update-ngcc-main-fields.js",
"//:tools/postinstall/apply-patches.js",
"//:tools/postinstall/update-ngcc-main-fields.js",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
Expand Down Expand Up @@ -100,9 +100,9 @@ sass_repositories()
# Bring in bazel_toolchains for RBE setup configuration.
http_archive(
name = "bazel_toolchains",
sha256 = "3c1299efcf64a4ecf4f6def7564db28879ad2870632144d77932e7910686d3f3",
strip_prefix = "bazel-toolchains-1.1.2",
url = "https://github.com/bazelbuild/bazel-toolchains/archive/1.1.2.tar.gz",
sha256 = "4d348abfaddbcee0c077fc51bb1177065c3663191588ab3d958f027cbfe1818b",
strip_prefix = "bazel-toolchains-2.1.0",
url = "https://github.com/bazelbuild/bazel-toolchains/archive/2.1.0.tar.gz",
)

load("@bazel_toolchains//repositories:repositories.bzl", bazel_toolchains_repositories = "repositories")
Expand All @@ -116,8 +116,8 @@ rbe_autoconfig(
# Need to specify a base container digest in order to ensure that we can use the checked-in
# platform configurations for the "ubuntu16_04" image. Otherwise the autoconfig rule would
# need to pull the image and run it in order determine the toolchain configuration.
# See: https://github.com/bazelbuild/bazel-toolchains/blob/master/rules/rbe_repo.bzl#L229
base_container_digest = "sha256:1ab40405810effefa0b2f45824d6d608634ccddbf06366760c341ef6fbead011",
# See: https://github.com/bazelbuild/bazel-toolchains/blob/master/configs/ubuntu16_04_clang/versions.bzl#L9
base_container_digest = "sha256:fd5690d000da5759121f28ccbc19ebb4545841d816bbf6a72de482cf3e7ce491",
digest = "sha256:0b8fa87db4b8e5366717a7164342a029d1348d2feea7ecc4b18c780bc2507059",
registry = "marketplace.gcr.io",
# We can't use the default "ubuntu16_04" RBE image provided by the autoconfig because we need
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"yarn": ">= 1.19.1"
},
"scripts": {
"postinstall": "node tools/bazel/postinstall-patches.js && ngcc --properties main --create-ivy-entry-points && node tools/bazel/update-ngcc-main-fields.js",
"postinstall": "node tools/postinstall/apply-patches.js && ngcc --properties main --create-ivy-entry-points && node tools/postinstall/update-ngcc-main-fields.js",
"build": "node ./scripts/build-packages-dist.js",
"bazel": "bazelisk",
"bazel:buildifier": "find . -type f \\( -name \"*.bzl\" -or -name WORKSPACE -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs buildifier -v --warnings=attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,constant-glob,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,load,load-on-top,native-build,native-package,output-group,package-name,package-on-top,redefined-variable,repository-name,same-origin-load,string-iteration,unused-variable,unsorted-dict-items,out-of-order-load",
"bazel:format-lint": "yarn -s bazel:buildifier --lint=warn --mode=check",
"dev-app": "ibazel run //src/dev-app:devserver",
Expand Down Expand Up @@ -69,13 +70,13 @@
"@angular/platform-browser-dynamic": "^9.0.0",
"@angular/platform-server": "^9.0.0",
"@angular/router": "^9.0.0",
"@bazel/bazel": "^1.1.0",
"@bazel/bazelisk": "^1.3.0",
"@bazel/buildifier": "^0.29.0",
"@bazel/ibazel": "^0.10.3",
"@bazel/jasmine": "1.0.0",
"@bazel/karma": "1.0.0",
"@bazel/protractor": "1.0.0",
"@bazel/typescript": "1.0.0",
"@bazel/ibazel": "^0.11.1",
"@bazel/jasmine": "^1.3.0",
"@bazel/karma": "^1.3.0",
"@bazel/protractor": "^1.3.0",
"@bazel/typescript": "^1.3.0",
"@firebase/app-types": "^0.3.2",
"@octokit/rest": "^16.28.7",
"@schematics/angular": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/circleci/setup_bazel_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

bazelBin=$(node -p "require('@bazel/bazel').getNativeBinary()")
bazelBin=$(node -p "require('@bazel/bazelisk/bazelisk.js').getNativeBinary()")

# Provide the bazel binary globally. We don't want to access the binary
# through Node as it could result in limited memory.
Expand Down
15 changes: 15 additions & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
package(default_visibility = ["//visibility:public"])

load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

exports_files([
"system-config-tmpl.js",
"system-rxjs-operators.js",
])

# Custom "tsc_wrapped" binary that has "tsickle" available as runtime dependency.
# This is needed as the default compiler for a "ts_library" does not have a dependency
# on "tsickle" by default.
nodejs_binary(
name = "tsc_wrapped_with_tsickle",
data = [
"@npm//@bazel/typescript",
"@npm//tsickle",
],
entry_point = "@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js",
install_source_map_support = False,
)

# Workaround for https://github.com/bazelbuild/bazel-toolchains/issues/356. We need the
# "SYS_ADMIN" capability in order to run browsers with sandbox enabled.
platform(
Expand Down
16 changes: 0 additions & 16 deletions tools/bazel/BUILD.bazel

This file was deleted.

2 changes: 1 addition & 1 deletion tools/create-system-config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("//src/cdk:config.bzl", "CDK_ENTRYPOINTS")
load("//src/cdk-experimental:config.bzl", "CDK_EXPERIMENTAL_ENTRYPOINTS")
load("//src/material:config.bzl", "MATERIAL_ENTRYPOINTS", "MATERIAL_TESTING_ENTRYPOINTS")
load("//src/material-experimental:config.bzl", "MATERIAL_EXPERIMENTAL_ENTRYPOINTS")
load("//tools/bazel:expand_template.bzl", "expand_template")
load("//tools:expand_template.bzl", "expand_template")

"""
Macro that builds a SystemJS configuration for all packages and entry-points
Expand Down
2 changes: 1 addition & 1 deletion tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def ts_library(tsconfig = None, deps = [], testonly = False, **kwargs):
# The default "ts_library" compiler does not come with "tsickle" available. Since
# we have targets that use "tsickle" decorator processing, we need to ensure that
# the compiler could load "tsickle" if needed.
compiler = "//tools/bazel:tsc_wrapped_with_tsickle",
compiler = "//tools:tsc_wrapped_with_tsickle",
deps = local_deps,
**kwargs
)
Expand Down
File renamed without changes.
Empty file added tools/postinstall/BUILD.bazel
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ searchAndReplace(
// that tsickle is available for esm5 output re-compilations.
searchAndReplace(
'@npm//@bazel/typescript/bin:tsc_wrapped',
'@angular_material//tools/bazel:tsc_wrapped_with_tsickle',
'@angular_material//tools:tsc_wrapped_with_tsickle',
'node_modules/@angular/bazel/src/esm5.bzl');

// Workaround for: https://github.com/angular/angular/issues/32651. We just do not
Expand Down
74 changes: 24 additions & 50 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -230,31 +230,10 @@
lodash "^4.17.11"
to-fast-properties "^2.0.0"

"@bazel/[email protected]":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-1.1.0.tgz#9402ecadfaf0383bc366ef5b37b933e0d0e804fc"
integrity sha512-/dnpkjqnl2Qrcy+qFerOe+lV9QZ2HoUHtTplQgRxa+OH8AtQ7mcopdJ9/3Y10GqgT2Kp+AR6G99R59/Si+BOMg==

"@bazel/[email protected]":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-1.1.0.tgz#98d75240e3e9ff5ba14fa48d6241d5d741e89926"
integrity sha512-yDR1URphRQTkXYjl4U2NLmbGR8ar8imhytK3txZZqlPf5pfWI/7wa7gSg0H4VbRRLIGAy/nD2eXZpgSj1eUiqA==

"@bazel/[email protected]":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-1.1.0.tgz#e9c80a8c6495834ee7fc6184c425284d1151ac38"
integrity sha512-mj3ujcifKO+hjAjHvLoutYxzs90YWuc/fYJuVaEQrk4YFrRW5g70OpjN74zzBHRstObOjSZ3cOj+HDB19SIFKw==

"@bazel/bazel@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-1.1.0.tgz#9ce8308e44d76132812e908fcbc9e9051c7c2e1a"
integrity sha512-3NOWRHG1i/tAVQWuStIUuliFLVfjcKMbqIlc2Q206VWQ5pjlKgo0qa+qrWb0G6BYq+N3hxT4IwBz+Z17A8dbbg==
dependencies:
"@bazel/hide-bazel-files" latest
optionalDependencies:
"@bazel/bazel-darwin_x64" "1.1.0"
"@bazel/bazel-linux_x64" "1.1.0"
"@bazel/bazel-win32_x64" "1.1.0"
"@bazel/bazelisk@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@bazel/bazelisk/-/bazelisk-1.3.0.tgz#dc312dd30ad01e9af86e53b40795ab6e545fa55b"
integrity sha512-73H1nq3572tTf+dhDT86aWQN+LCyfxrh05jabqPXp6cpR8soxte3gS5oUqkN36fUe+J2HzNiV4CXZTz4Xytd3Q==

"@bazel/[email protected]":
version "0.29.0"
Expand All @@ -280,41 +259,36 @@
"@bazel/buildifier-linux_x64" "0.29.0"
"@bazel/buildifier-win32_x64" "0.29.0"

"@bazel/hide-bazel-files@latest":
version "0.35.0"
resolved "https://registry.yarnpkg.com/@bazel/hide-bazel-files/-/hide-bazel-files-0.35.0.tgz#66ff148c1076534204d755024557609492718b7f"
integrity sha512-+96mfEfoIpo2LNyN0929IwKpn50AXO04PZfonscvu3yV+3DVG1JLyq6W63zl/yGP1DAdgCPlRg5scNhkOzNpJw==
"@bazel/ibazel@^0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.11.1.tgz#c07ceaded388f1e39d6aa732953e0dd04f3dbdf0"
integrity sha512-qAdEquFAudYyN+CYfLzvuRWNubdsh6C8+o5CiViUEfchq1HQM5Rs8xAOE3fzGsTZ1EUsvgca/PY0kn0VIxckBA==

"@bazel/ibazel@^0.10.3":
version "0.10.3"
resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.10.3.tgz#2e2b8a1d3e885946eac41db2b1aa6801fb319887"
integrity sha512-v1nXbMTHVlMM4z4uWp6XiRoHAyUlYggF1SOboLLWRp0+D22kWixqArWqnozLw2mOtnxr97BdLjluWiho6A8Hjg==

"@bazel/[email protected]":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-1.0.0.tgz#12aa82c0e4b7b5658e9e496b73c0cf660df2b0ae"
integrity sha512-cheQWMYs0PaS4kYwJC9tmAiyd0tLbPNcgoM+S8plNUp5k0gUVosCvQ0TOrxvRlKEY0ni1hdn9owPx2rUO1J+Wg==
"@bazel/jasmine@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-1.3.0.tgz#1d03aa67c18f122ffed4eb88e85455a797a8121d"
integrity sha512-HY633xVy83eyLWt4o6CT8zHDxzVk+UfXCWCCWgJXWqpkB2BoYlq0Bvvpqcuj7Ilzn9vNX6w8gVeddRckIdBa/Q==
dependencies:
jasmine "~3.4.0"
jasmine-core "~3.4.0"
v8-coverage "1.0.9"

"@bazel/karma@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.0.0.tgz#6f1e31bc2cb698e50d76f43ec9f1ee095d8e72b8"
integrity sha512-esfsHRVWVcp6OyTk/QI1sBV7bcygFiXY6LUMPLPYqVZkQvJ0x+/L1weiwuRrqFf+FCwCajhYjwiR6S9kX2Z9LA==
"@bazel/karma@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.3.0.tgz#8d4c336f04357ccc9633b9b6cdf8c79b15793ef1"
integrity sha512-TyGoLBGTt9Mlp/FhwAytYaolUfrwMYuhNNzOYQ0lNzF73oEXOD1G9vIYLn2NvxQLPAaa2guBmNWSf0EkLhMuiw==
dependencies:
tmp "0.1.0"

"@bazel/protractor@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.0.0.tgz#b77fde3bb53a008c330c13a953a0bf93aa06b5f1"
integrity sha512-8kGuM3NkFfokjzKBlYxK9rUwJO/ICnYTHC567KJk6T4pjm4kfyh6iVI3Df3K+ONRCEYmiuZrQ37U06lzMMGN9g==
"@bazel/protractor@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.3.0.tgz#050edc3480a6b5cf2b4c96daeced5cb871839298"
integrity sha512-EwTlHbMwHIyPy7FhDiKLum2nlmmy27p/yQzWzN8dRnCIjmq4ezTfgNMnyZ5Z9HiQ2HM4kyzNx1f65eKNXXZK7w==

"@bazel/typescript@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.0.0.tgz#2c7318b9a3aaa730f282b094ddf41dd16fda7b5a"
integrity sha512-caNOKz7EjVMgbedjVTreao9++9Sb9oYlU2nqDOMIK8MyoOUQvgGQWhFwF65XXGSb79Tzv8kaFQskoaH/iAs4ng==
"@bazel/typescript@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.3.0.tgz#6df7409ad8b2fcd80dfe859904fe91aacfb1a2cf"
integrity sha512-F1Cjnjby+b3cO+rVuZY/9tzepf8wgoXZP9PtFmVWTQ+NtBkKEYx6IQ3AXZJl33mYVoN/Zb5qBTrGW/QfHUvakw==
dependencies:
protobufjs "6.8.8"
semver "5.6.0"
Expand Down