From e25b256aa4d00e8d8a43952bdbaaa567bdaa1277 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 14 Nov 2019 09:28:29 +0200 Subject: [PATCH] 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 --- scripts/build-packages-dist.sh | 8 ++++++-- scripts/package-builder.sh | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/scripts/build-packages-dist.sh b/scripts/build-packages-dist.sh index ca94d7ed5b..eca7fcfff4 100755 --- a/scripts/build-packages-dist.sh +++ b/scripts/build-packages-dist.sh @@ -12,14 +12,18 @@ buildTargetPackages "dist/packages-dist" "legacy" "Production" # 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 # 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 # 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 distTargetDir="$base_dir/dist/zone.js-dist/zone.js" -echo "# Copying artifacts to '$distTargetDir'..." +echo "# Copy artifacts to $distTargetDir" mkdir -p $distTargetDir rm -rf $distTargetDir cp -R $buildOutputDir $distTargetDir diff --git a/scripts/package-builder.sh b/scripts/package-builder.sh index 78c7f18561..b20a1100d2 100755 --- a/scripts/package-builder.sh +++ b/scripts/package-builder.sh @@ -16,15 +16,11 @@ set -u -e -o pipefail cd "$(dirname "$0")" # basedir is the workspace root -readonly base_dir=$(pwd)/.. -readonly bazel_bin=$(yarn run -s bazel info bazel-bin) +readonly base_dir="$(realpath "$(pwd)/..")" +readonly bazel_bin="$(yarn run -s bazel info bazel-bin)" +readonly script_path="$0" 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. dest_path="$1" @@ -35,11 +31,16 @@ function buildTargetPackages() { desc="$3" echo "##################################" - echo "scripts/build-packages-dist.sh:" - echo " building @angular/* npm packages" - echo " mode: ${desc}" + echo "${script_path}:" + echo " Building @angular/* npm packages" + echo " Mode: ${desc}" 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 echo "$targets" | xargs yarn run -s bazel build --config=release --define=compile=${compile_mode}