Make build command more robust.

This returns all targets, and handles no targets.

PiperOrigin-RevId: 350263578
This commit is contained in:
Adin Scannell
2021-01-05 18:55:05 -08:00
committed by gVisor bot
parent ab32fa2481
commit a1e3845b65
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -189,13 +189,13 @@ build_paths = \
(set -euo pipefail; \
$(call wrapper,$(BAZEL) build $(BASE_OPTIONS) $(1)) 2>&1 \
| tee /proc/self/fd/2 \
| grep -A1 -E '^Target' \
| grep -E '^ ($(subst $(SPACE),|,$(BUILD_ROOTS)))' \
| sed "s/ /\n/g" \
| strings -n 10 \
| sed -n -e '/^Target/,$$p' \
| sed -n -e '/^ \($(subst /,\/,$(subst $(SPACE),\|,$(BUILD_ROOTS)))\)/p' \
| sed -e 's/ /\n/g' \
| awk '{$$1=$$1};1' \
| xargs -n 1 -I {} readlink -f "{}" \
| xargs -n 1 -I {} bash -c 'set -xeuo pipefail; $(2)')
| strings \
| xargs -r -n 1 -I {} readlink -f "{}" \
| xargs -r -n 1 -I {} bash -c 'set -xeuo pipefail; $(2)')
clean = $(call header,CLEAN) && $(call wrapper,$(BAZEL) clean)
build = $(call header,BUILD $(1)) && $(call build_paths,$(1),echo {})
+1 -1
View File
@@ -15,4 +15,4 @@
# limitations under the License.
# The STABLE_ prefix will trigger a re-link if it changes.
echo STABLE_VERSION $(git describe --always --tags --abbrev=12 --dirty || echo 0.0.0)
echo STABLE_VERSION "$(git describe --always --tags --abbrev=12 --dirty 2>/dev/null || echo 0.0.0)"