From 6f231cad948a18bb5ffdf2d82bfa83cdf7e799a1 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 19 Nov 2018 20:30:16 +0000 Subject: [PATCH] build: use Bazel installed from npm --- .circleci/config.yml | 18 +++++++++++------- package.json | 7 ++++--- yarn.lock | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35eeb3c84b..bcc1e20353 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,10 +10,10 @@ version: 2 # See https://blog.daemonl.com/2016/02/yaml.html # To validate changes, use an online parser, eg. # https://yaml-online-parser.appspot.com/ -var_1: &cache_key yarn-cache-{{ checksum "yarn.lock" }}-0.7.0 +var_1: &cache_key yarn-cache-{{ checksum "yarn.lock" }}-0.8.0 var_2: &run_in_ngcontainer docker: - - image: angular/ngcontainer:0.7.0 + - image: circleci/node:10.12 var_3: &set_bazel_options run: command: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc @@ -31,12 +31,16 @@ jobs: - checkout - *set_bazel_options + - restore_cache: + key: *cache_key + # Enforce that BUILD files are formatted. # Note that this uses the version of buildifier from the docker image - # take care that you use the same version when you run # buildifier locally on your change. + - run: yarn - run: - 'buildifier -mode=check $(find . -type f \( -name BUILD.bazel -or -name BUILD \)) || + 'yarn bazel buildifier -mode=check $(find . -type f \( -name BUILD.bazel -or -name BUILD \)) || (echo "BUILD files not formatted. Please run ''yarn buildifier''" ; exit 1)' bazel: @@ -50,17 +54,17 @@ jobs: # Helpful for debugging, so you can check you have the same bazel version when you need # to reproduce a failure. - - run: bazel info release + - run: yarn + - run: yarn bazel info release # Install the dependencies from NPM, using the node and yarn binaries managed by Bazel - - run: yarn - - run: bazel run @nodejs//:yarn + - run: yarn bazel run @nodejs//:yarn # Build and Test # Use bazel query so that we explicitly ask for all buildable targets to # be built even though we run `bazel test` # See https://github.com/bazelbuild/bazel/issues/4257 - - run: bazel query --output=label //... | xargs bazel test + - run: yarn bazel test //... # Store artifacts from build - persist_to_workspace: root: dist diff --git a/package.json b/package.json index 822280d81b..e3b94dd488 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "monorepo for ngrx development", "scripts": { "precommit": "lint-staged", - "build": "bazel build ...", + "build": "yarn bazel build ...", "deploy:builds": "ts-node ./build/deploy-build.ts", "deploy:preview": "ts-node ./build/deploy-preview.ts", "test:unit": "node ./tests.js", @@ -22,9 +22,9 @@ "watch:tests": "chokidar 'modules/**/*.ts' --initial -c 'yarn run test:unit'", "postinstall": "opencollective postinstall", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", - "preskylint": "bazel build --noshow_progress @io_bazel//src/tools/skylark/java/com/google/devtools/skylark/skylint:Skylint", + "preskylint": "yarn bazel build --noshow_progress @io_bazel//src/tools/skylark/java/com/google/devtools/skylark/skylint:Skylint", "skylint": "find . -type f -name \"*.bzl\" ! -path \"*/node_modules/*\" ! -path \"./dist/*\" | xargs $(bazel info bazel-bin)/external/io_bazel/src/tools/skylark/java/com/google/devtools/skylark/skylint/Skylint --disable-checks=deprecated-api", - "prebuildifier": "bazel build --noshow_progress @com_github_bazelbuild_buildtools//buildifier", + "prebuildifier": "yarn bazel build --noshow_progress @com_github_bazelbuild_buildtools//buildifier", "buildifier": "find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/*/buildifier", "copy:schematics": "ts-node ./build/copy-schematics-core.ts", "build:stackblitz": "ts-node ./build/stackblitz.ts && git add ./stackblitz.html" @@ -91,6 +91,7 @@ }, "devDependencies": { "@angular-devkit/build-angular": "^0.10.0", + "@bazel/bazel": "^0.19.1", "@octokit/rest": "^15.17.0", "@types/fs-extra": "^2.1.0", "@types/glob": "^5.0.33", diff --git a/yarn.lock b/yarn.lock index 3f397e7af6..2835296d58 100644 --- a/yarn.lock +++ b/yarn.lock @@ -228,6 +228,30 @@ dependencies: tslib "^1.9.0" +"@bazel/bazel-darwin_x64@0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.19.1.tgz#58d779c8938bd1c136cab55e2f6473121f83741b" + integrity sha512-Rnk8zw5S9SZfuMQsGRodm7ZXme1FS2rpmYbIJVF0M+k7jaWLZJwV2w5T2vMyuluEjOxTbptXenbigTF80jETIA== + +"@bazel/bazel-linux_x64@0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.19.1.tgz#aef363e0932d29d1bb48980da139d74bfb4b1ffb" + integrity sha512-dWKKYa0cwDEjVRRwUMVSy1WvQjTHQPiwrA6mDzNzoRX0D0KBX25QqdkQW6HS6fzyEOsFjT+yVtfqtxL0qO+FCA== + +"@bazel/bazel-win32_x64@0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.19.1.tgz#273c43b0febc11675614c402ec82ae44b519f9ee" + integrity sha512-t6vOh2IOzUAk19ccS0q3Kho364Yxjtjv1v4utAjOSNw8GVwutfekdiojGBrR8ihvJi1Xp885mOkQnZA38B9tvQ== + +"@bazel/bazel@^0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-0.19.1.tgz#22ce225b5172a4ad2a94496be66b14b7c7facca2" + integrity sha512-RGxp/Ny36ESzBG7l3yYG24yWfvjFyGE2VqNtXZdJfCfO5312zTNz0qRmZS8pNrCEN+F89jQDRvPhpdAyXKKwOg== + optionalDependencies: + "@bazel/bazel-darwin_x64" "0.19.1" + "@bazel/bazel-linux_x64" "0.19.1" + "@bazel/bazel-win32_x64" "0.19.1" + "@bazel/typescript@^0.20.3": version "0.20.3" resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.20.3.tgz#51dcc369c2af0d7f2311d6e692d07776492060f4"