Skip to content

Commit

Permalink
Always pass -e; some versions of sed give an error message otherwise.
Browse files Browse the repository at this point in the history
Maybe fixes bazelbuild#1552.

Closes bazelbuild#2175.

--
Reviewed-on: bazelbuild#2175
PiperOrigin-RevId: 141060731
MOS_MIGRATED_REVID=141060731
  • Loading branch information
ulfjack authored and damienmg committed Dec 6, 2016
1 parent 3fd5d39 commit 161c4a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ if [ $DO_SRCS_TEST ]; then
log "Querying //:srcs"
${BAZEL} query 'kind("source file", deps(//:srcs))' 2>/dev/null \
| grep -v '^@' \
| sed -e 's|^//||' | sed 's|^:||' | sed 's|:|/|' \
| sed -e 's|^//||' | sed -e 's|^:||' | sed -e 's|:|/|' \
| sort -u >"${OUTPUT_DIR}/srcs-query"

log "Finding all files"
Expand All @@ -152,7 +152,7 @@ if [ $DO_SRCS_TEST ]; then
SRCS_EXCLUDES=${SRCS_EXCLUDES-XXXXXXXXXXXXXX1268778dfsdf4}
# See file BUILD for the list of grep -v exceptions.
# tools/defaults package is hidden by Bazel so cannot be put in the srcs.
find . -type f | sed 's|./||' \
find . -type f | sed -e 's|./||' \
| grep -v '^bazel-' | grep -v '^WORKSPACE.user.bzl' \
| grep -v '^\.' | grep -v '^out/' | grep -v '^output/' \
| grep -v '^derived' \
Expand All @@ -161,7 +161,7 @@ if [ $DO_SRCS_TEST ]; then
| sort -u >"${OUTPUT_DIR}/srcs-find"

log "Diffing"
res="$(diff -U 0 "${OUTPUT_DIR}/srcs-find" "${OUTPUT_DIR}/srcs-query" | sed 's|^-||' | grep -Ev '^(@@|\+\+|--)' || true)"
res="$(diff -U 0 "${OUTPUT_DIR}/srcs-find" "${OUTPUT_DIR}/srcs-query" | sed -e 's|^-||' | grep -Ev '^(@@|\+\+|--)' || true)"

if [ -n "${res}" ]; then
fail "//:srcs filegroup do not contains all the sources, missing:
Expand Down

0 comments on commit 161c4a3

Please sign in to comment.