Skip to content

Commit

Permalink
Make //tols/cpp/test start from the distribution artifact
Browse files Browse the repository at this point in the history
The docker tests in //tools/cpp/test still assume that the sources
are enough to just compile.sh to bootstrap a bazel binary. Fix this,
by using the distribution archive instead.

While there, also add a target for the distribution archive as tar.

--
Change-Id: Ic31bb95da0165f83a14537a1719c27e5067d0d65
Reviewed-on: https://cr.bazel.build/7531
MOS_MIGRATED_REVID=140134322
  • Loading branch information
aehlig authored and dslomov committed Nov 24, 2016
1 parent cc428bc commit 52b03d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,16 @@ genrule(
# Public but bazel-only visibility.
visibility = ["//:__subpackages__"],
)

genrule(
name = "bazel-distfile-tar",
srcs = [
":bazel-srcs",
"//src:derived_java_srcs",
],
outs = ["bazel-distfile.tar"],
cmd = "env USE_TAR=YES $(location :combine_distfiles.sh) $@ $(SRCS)",
tools = ["combine_distfiles.sh"],
# Public but bazel-only visibility.
visibility = ["//:__subpackages__"],
)
8 changes: 7 additions & 1 deletion combine_distfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ do
(cd "${PACKAGE_DIR}" && ${UNPACK} "${ARCHIVE}")
done

(cd "${PACKAGE_DIR}" && find . -type f | sort | zip -qDX@ "${OUTPUT}")
if [ -n "${USE_TAR}" ]
then
(cd "${PACKAGE_DIR}" && tar -c -f "${OUTPUT}" --group=0 --owner=0 \
$(find . -type f | sort))
else
(cd "${PACKAGE_DIR}" && find . -type f | sort | zip -qDX@ "${OUTPUT}")
fi
2 changes: 1 addition & 1 deletion tools/cpp/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pkg_tar(
name = "bazel_cc_configure",
package_dir = "/opt/workspace",
strip_prefix = "/",
deps = ["//:bazel-srcs"],
deps = ["//:bazel-distfile-tar"],
)

[
Expand Down

0 comments on commit 52b03d1

Please sign in to comment.