From 8852b793df9c4dd09afebf766cedf0f96efd728b Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 4 Jun 2019 20:42:54 +0200 Subject: [PATCH] build: unable to run build-packages-dist script on windows (#30853) Currently it's not possible to run the `./scripts/build-packages-dist.sh` script on Windows because `bazel query` returns CRLF line-endings which result on array expansion in Bazel target names that end with a carriage return (e.g. `//packages/core\r`). This then results in a build failure where Bazel complains that target names should not end with a carriage return. In order to fix this, we just strip off the carriage return line-endings from the bazel query stdout. Ideally the script will be ported to a plain Node script eventually, but for now it prevents Windows users from building the release packages and the simple workaround seems reasonable and sufficient. PR Close #30853 --- scripts/package-builder.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/package-builder.sh b/scripts/package-builder.sh index a3f349661a..475196bb8c 100755 --- a/scripts/package-builder.sh +++ b/scripts/package-builder.sh @@ -23,8 +23,10 @@ readonly bazel_bin=$(yarn bin)/bazel readonly bin=$(${bazel_bin} info bazel-bin) function buildTargetPackages() { - # List of targets to build, e.g. core, common, compiler, etc. - targets=$(${bazel_bin} query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //packages/...) intersect kind(".*_package", //packages/...)') + # 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=$(${bazel_bin} 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"