build: use bazel version from node modules (#26691)

* No longer depends on a custom CircleCI docker image that comes with Bazel pre-installed. Since Bazel is now available through NPM, we should be able to use the version from `@bazel/bazel` in order to enforce a consistent environment on CI and locally.
* This also reduces the amount of packages that need to be published (ngcontainer is removed)

PR Close #26691
This commit is contained in:
Paul Gschwendtner
2018-10-27 09:25:45 +02:00
committed by Matias Niemelä
parent cd444bc2ba
commit c44b93253c
21 changed files with 214 additions and 146 deletions

View File

@ -12,7 +12,10 @@ cd "$(dirname "$0")"
# basedir is the workspace root
readonly basedir=$(pwd)/..
readonly bin=$(bazel info bazel-bin)
# We need to resolve the Bazel binary in the node modules because running Bazel
# through `yarn bazel` causes additional output that throws off command stdout.
readonly bazelBin=$(yarn bin)/bazel
readonly bin=$(${bazelBin} info bazel-bin)
function buildTargetPackages() {
targets="$1"
@ -20,13 +23,13 @@ function buildTargetPackages() {
compileMode="$3"
desc="$4"
echo "##################################"
echo "scripts/build-packages-dist.sh:"
echo " building @angular/* npm packages"
echo " mode: ${desc}"
echo "##################################"
echo "##################################"
echo "scripts/build-packages-dist.sh:"
echo " building @angular/* npm packages"
echo " mode: ${desc}"
echo "##################################"
echo "$targets" | xargs bazel build --define=compile=$compileMode
echo "$targets" | xargs ${bazelBin} build --define=compile=$compileMode
[ -d "${basedir}/${destPath}" ] || mkdir -p $basedir/${destPath}
@ -49,7 +52,7 @@ echo "##################################"
# packages in their deps[].
# Until then, we have to manually run bazel first to create the npm packages we
# want to test.
BAZEL_TARGETS=`bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
BAZEL_TARGETS=`${bazelBin} query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
buildTargetPackages "$BAZEL_TARGETS" "dist/packages-dist" "legacy" "Production"
# We don't use the ivy build in the integration tests, only when publishing

View File

@ -7,12 +7,12 @@ set -u -e -o pipefail
# Publish them to npm (tagged next)
# query for all npm packages to be released as part of the framework release
NPM_PACKAGE_LABELS=`bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
NPM_PACKAGE_LABELS=`yarn bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
# build all npm packages in parallel
bazel build $NPM_PACKAGE_LABELS
yarn bazel build $NPM_PACKAGE_LABELS
# publish all packages in sequence to make it easier to spot any errors or warnings
for packageLabel in $NPM_PACKAGE_LABELS; do
echo "publishing $packageLabel"
bazel run -- ${packageLabel}.publish --access public --tag latest
yarn bazel run -- ${packageLabel}.publish --access public --tag latest
done

View File

@ -7,11 +7,11 @@ set -u -e -o pipefail
# Publish them to npm (tagged next)
# query for all npm packages to be released as part of the framework release
NPM_PACKAGE_LABELS=`bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
NPM_PACKAGE_LABELS=`yarn bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)'`
# build all npm packages in parallel
bazel build $NPM_PACKAGE_LABELS
yarn bazel build $NPM_PACKAGE_LABELS
# publish all packages in sequence to make it easier to spot any errors or warnings
for packageLabel in $NPM_PACKAGE_LABELS; do
echo "publishing $packageLabel"
bazel run -- ${packageLabel}.publish --access public --tag next
yarn bazel run -- ${packageLabel}.publish --access public --tag next
done