build: minor improvements to build script output (#33823)

- Move "Building packages" log above actual work (computing targets).
- Print corrent script name (`build-ivy-npm-packages.sh` would claim to
  be `build-packages-dist.sh`).
- Make logs of different operations a little more consistent.

PR Close #33823
This commit is contained in:
George Kalpakas 2019-11-14 09:28:29 +02:00 committed by Alex Rickabaugh
parent 9935aa43ad
commit e25b256aa4
2 changed files with 17 additions and 12 deletions

View File

@ -12,14 +12,18 @@ buildTargetPackages "dist/packages-dist" "legacy" "Production"
# copied into the `dist/packages-dist/` directory (despite its source's being in `packages/`), # copied into the `dist/packages-dist/` directory (despite its source's being in `packages/`),
# because it is not published to npm under the `@angular` scope (as happens for the rest of # because it is not published to npm under the `@angular` scope (as happens for the rest of
# the packages). # the packages).
echo "# Building zone.js npm package..." echo ""
echo "##############################"
echo "${script_path}:"
echo " Building zone.js npm package"
echo "##############################"
yarn --silent bazel build //packages/zone.js:npm_package yarn --silent bazel build //packages/zone.js:npm_package
# Copy artifacts to `dist/zone.js-dist/`, so they can be easier persisted on CI. # Copy artifacts to `dist/zone.js-dist/`, so they can be easier persisted on CI.
readonly buildOutputDir="$base_dir/dist/bin/packages/zone.js/npm_package" readonly buildOutputDir="$base_dir/dist/bin/packages/zone.js/npm_package"
readonly distTargetDir="$base_dir/dist/zone.js-dist/zone.js" readonly distTargetDir="$base_dir/dist/zone.js-dist/zone.js"
echo "# Copying artifacts to '$distTargetDir'..." echo "# Copy artifacts to $distTargetDir"
mkdir -p $distTargetDir mkdir -p $distTargetDir
rm -rf $distTargetDir rm -rf $distTargetDir
cp -R $buildOutputDir $distTargetDir cp -R $buildOutputDir $distTargetDir

View File

@ -16,15 +16,11 @@ set -u -e -o pipefail
cd "$(dirname "$0")" cd "$(dirname "$0")"
# basedir is the workspace root # basedir is the workspace root
readonly base_dir=$(pwd)/.. readonly base_dir="$(realpath "$(pwd)/..")"
readonly bazel_bin=$(yarn run -s bazel info bazel-bin) readonly bazel_bin="$(yarn run -s bazel info bazel-bin)"
readonly script_path="$0"
function buildTargetPackages() { function buildTargetPackages() {
# List of targets to build, e.g. core, common, compiler, etc. Note that we want to
# remove all carriage return ("\r") characters form the query output because otherwise
# the carriage return is part of the bazel target name and bazel will complain.
targets=$(yarn run -s bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)' | tr -d "\r")
# Path to the output directory into which we copy the npm packages. # Path to the output directory into which we copy the npm packages.
dest_path="$1" dest_path="$1"
@ -35,11 +31,16 @@ function buildTargetPackages() {
desc="$3" desc="$3"
echo "##################################" echo "##################################"
echo "scripts/build-packages-dist.sh:" echo "${script_path}:"
echo " building @angular/* npm packages" echo " Building @angular/* npm packages"
echo " mode: ${desc}" echo " Mode: ${desc}"
echo "##################################" echo "##################################"
# List of targets to build, e.g. core, common, compiler, etc. Note that we want to
# remove all carriage return ("\r") characters form the query output because otherwise
# the carriage return is part of the bazel target name and bazel will complain.
targets=$(yarn run -s bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)' | tr -d "\r")
# Use --config=release so that snapshot builds get published with embedded version info # Use --config=release so that snapshot builds get published with embedded version info
echo "$targets" | xargs yarn run -s bazel build --config=release --define=compile=${compile_mode} echo "$targets" | xargs yarn run -s bazel build --config=release --define=compile=${compile_mode}