From 30d6233e83af710c6f08a8cc72e61fff724aef2d Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 15 Oct 2018 16:51:26 -0700 Subject: [PATCH] build: update ngcontainer to bazel 0.18.0 (#26465) (#26488) * build: update ngcontainer to bazel 0.18.0 * build: update skylint to bazel 0.18 use .bazelignore file to ignore node_modules directory PR Close #26488 --- .bazelignore | 1 + tools/bazel.rc => .bazelrc | 4 ++-- .circleci/config.yml | 4 ++-- .gitignore | 1 - .pullapprove.yml | 3 +-- WORKSPACE | 21 ++++++--------------- docs/BAZEL.md | 4 ++-- packages/bazel/package.bzl | 6 +++--- tools/ngcontainer/Dockerfile | 2 +- tools/ngcontainer/README.md | 2 +- 10 files changed, 19 insertions(+), 29 deletions(-) create mode 100644 .bazelignore rename tools/bazel.rc => .bazelrc (96%) diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 00000000000000..3c3629e647f5dd --- /dev/null +++ b/.bazelignore @@ -0,0 +1 @@ +node_modules diff --git a/tools/bazel.rc b/.bazelrc similarity index 96% rename from tools/bazel.rc rename to .bazelrc index d9f63f2da3e546..e744c123721ab5 100644 --- a/tools/bazel.rc +++ b/.bazelrc @@ -57,6 +57,6 @@ test --experimental_ui ################################ # Temporary Settings for Ivy # ################################ -# to determine if the compiler used should be Ivy or ViewEngine one can use `--define=compile=local` on +# to determine if the compiler used should be Ivy or ViewEngine one can use `--define=compile=local` on # any bazel target. This is a temporary flag until codebase is permanently switched to Ivy. -build --define=compile=legacy \ No newline at end of file +build --define=compile=legacy diff --git a/.circleci/config.yml b/.circleci/config.yml index a7494b07750cfd..f7b5c1be4bbca7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,8 +12,8 @@ ## IMPORTANT # 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. -var_1: &docker_image angular/ngcontainer:0.6.0 -var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.6.0 +var_1: &docker_image angular/ngcontainer:0.7.0 +var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.7.0 # Define common ENV vars var_3: &define_env_vars diff --git a/.gitignore b/.gitignore index eae2571fe11d08..039f0db9c2a646 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ pubspec.lock .settings/ *.swo modules/.settings -.bazelrc .vscode modules/.vscode diff --git a/.pullapprove.yml b/.pullapprove.yml index a19bffa035ee89..3f4c200c024e34 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -87,10 +87,10 @@ groups: files: include: - "WORKSPACE" + - ".bazel*" - "*.bazel" - "*.bzl" - "packages/bazel/*" - - "tools/bazel.rc" - "/docs/BAZEL.md" users: - alexeagle #primary @@ -108,7 +108,6 @@ groups: - "*.lock" - "tools/*" exclude: - - "tools/bazel.rc" - "tools/public_api_guard/*" - "aio/*" users: diff --git a/WORKSPACE b/WORKSPACE index 55f7334eb379ec..e490a0261e5173 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,7 +1,7 @@ workspace(name = "angular") load( - "//packages/bazel:package.bzl", + "//packages/bazel:package.bzl", "rules_angular_dependencies", "rules_angular_dev_dependencies", ) @@ -14,9 +14,11 @@ rules_angular_dev_dependencies() # # Point Bazel to WORKSPACEs that live in subdirectories # -local_repository( +http_archive( name = "rxjs", - path = "node_modules/rxjs/src", + url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz", + strip_prefix = "package/src", + sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403", ) # Point to the integration test workspace just so that Bazel doesn't descend into it @@ -26,23 +28,12 @@ local_repository( path = "integration/bazel", ) -# Prevent Bazel from trying to build rxjs under angular devkit -# TODO(alexeagle): remove after Bazel 0.18 upgrade -local_repository( - name = "rxjs_ignore_nested_1", - path = "node_modules/@angular-devkit/core/node_modules/rxjs/src", -) -local_repository( - name = "rxjs_ignore_nested_2", - path = "node_modules/@angular-devkit/schematics/node_modules/rxjs/src", -) - # # Load and install our dependencies downloaded above. # load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install") -check_bazel_version("0.17.0", """ +check_bazel_version("0.18.0", """ If you are on a Mac and using Homebrew, there is a breaking change to the installation in Bazel 0.16 See https://blog.bazel.build/2018/08/22/bazel-homebrew.html diff --git a/docs/BAZEL.md b/docs/BAZEL.md index bd133241612586..364279ec47dc1a 100644 --- a/docs/BAZEL.md +++ b/docs/BAZEL.md @@ -72,7 +72,7 @@ keeps the outputs up-to-date as you save sources. If you're experiencing problems with seemingly unrelated tests failing, it may be because you're not using the proper flags with your Bazel test runs in Angular. -See also: [`//tools/bazel.rc`](https://github.com/angular/angular/blob/master/tools/bazel.rc) where `--define=ivy=false` is defined as default. +See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc) where `--define=ivy=false` is defined as default. - `--config=debug`: build and launch in debug mode (see [debugging](#debugging) instructions below) - `--test_arg=--node_options=--inspect=9228`: change the inspector port. @@ -165,7 +165,7 @@ You can see an overview at https://www.kchodorow.com/blog/2017/03/27/stamping-yo In our repo, here is how it's configured: 1) In `tools/bazel_stamp_vars.sh` we run the `git` commands to generate our versioning info. -1) In `tools/bazel.rc` we register this script as the value for the `workspace_status_command` flag. Bazel will run the script when it needs to stamp a binary. +1) In `.bazelrc` we register this script as the value for the `workspace_status_command` flag. Bazel will run the script when it needs to stamp a binary. Note that Bazel has a `--stamp` argument to `bazel build`, but this has no effect since our stamping takes place in Skylark rules. See https://github.com/bazelbuild/bazel/issues/1054 diff --git a/packages/bazel/package.bzl b/packages/bazel/package.bzl index aeefa03a0336cc..da0237000abaa1 100644 --- a/packages/bazel/package.bzl +++ b/packages/bazel/package.bzl @@ -83,9 +83,9 @@ def rules_angular_dev_dependencies(): # Fetching the Bazel source code allows us to compile the Skylark linter http_archive( name = "io_bazel", - sha256 = "ace8cced3b21e64a8fdad68508e9b0644201ec848ad583651719841d567fc66d", - strip_prefix = "bazel-0.17.1", - url = "https://github.com/bazelbuild/bazel/archive/0.17.1.zip", + sha256 = "978f7e0440dd82182563877e2e0b7c013b26b3368888b57837e9a0ae206fd396", + strip_prefix = "bazel-0.18.0", + url = "https://github.com/bazelbuild/bazel/archive/0.18.0.zip", ) # This commit matches the version of buildifier in angular/ngcontainer diff --git a/tools/ngcontainer/Dockerfile b/tools/ngcontainer/Dockerfile index a3aca664c683af..33ba439296fa3d 100644 --- a/tools/ngcontainer/Dockerfile +++ b/tools/ngcontainer/Dockerfile @@ -6,7 +6,7 @@ USER root # Bazel install # See https://bazel.build/versions/master/docs/install-ubuntu.html#using-bazel-custom-apt-repository-recommended # Note, only the latest release is available, see https://github.com/bazelbuild/bazel/issues/4947 -RUN BAZEL_VERSION="0.17.1" \ +RUN BAZEL_VERSION="0.18.0" \ && 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 \ && apt-get update \ diff --git a/tools/ngcontainer/README.md b/tools/ngcontainer/README.md index 554798924ceef0..992ccb5fd3cdf0 100644 --- a/tools/ngcontainer/README.md +++ b/tools/ngcontainer/README.md @@ -6,7 +6,7 @@ This docker container provides everything needed to build and test Angular appli - npm 6.2.0 - yarn 1.9.2 - Java 8 (for Closure Compiler and Bazel) -- Bazel build tool v0.17.1 - http://bazel.build +- Bazel build tool v0.18.0 - http://bazel.build - Google Chrome 69.0.3497.81 - Mozilla Firefox 47.0.1 - xvfb (virtual framebuffer) for headless testing