Figure out how we're building Bazel and make the code work with it

Change-Id: Iac0abca9e34ebf9d8f41f6f5a5803f54ca2b8beb
diff --git a/doc/make_bazel_package.sh b/doc/make_bazel_package.sh
new file mode 100755
index 0000000..1c10df0
--- /dev/null
+++ b/doc/make_bazel_package.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# This script builds a Debian package from a Bazel source tree with the
+# correct version.
+# The only argument is the path to a Bazel source tree.
+
+set -e
+set -u
+
+BAZEL_SOURCE="$1"
+
+VERSION="$(date +%Y%m%d%H%M)+$(GIT_DIR="${BAZEL_SOURCE}/.git" git rev-parse --short HEAD)"
+DEB="bazel_${VERSION}.deb"
+
+"${BAZEL_SOURCE}/compile.sh" compile
+(
+cd "${BAZEL_SOURCE}"
+./output/bazel build //scripts/packages:bazel-debian --embed_label="${VERSION}"
+)
+
+cp "${BAZEL_SOURCE}/bazel-bin/scripts/packages/bazel-debian.deb" "${DEB}"
+
+echo "Output is at ${DEB}"
diff --git a/opt_bazel_base_workspace b/opt_bazel_base_workspace
index 38d2cc4..36f5142 120000
--- a/opt_bazel_base_workspace
+++ b/opt_bazel_base_workspace
@@ -1 +1 @@
-/opt/bazel/base_workspace/
\ No newline at end of file
+/usr/share/lib/bazel/tools/
\ No newline at end of file
diff --git a/tools/BUILD b/tools/BUILD
index 9e25adc..747b9c1 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -1,5 +1,7 @@
 package(default_visibility = ['//visibility:public'])
 
+exports_files(['test_sharding_compliant'])
+
 # Don't use these directly! Use //tools/build_rules/select.bzl instead.
 config_setting(
   name = 'compiler_clang',
diff --git a/tools/bazel.rc b/tools/bazel.rc
index 5ea0fcf..b06ea73 100644
--- a/tools/bazel.rc
+++ b/tools/bazel.rc
@@ -4,11 +4,6 @@
 fetch --package_path %workspace%:%workspace%/opt_bazel_base_workspace
 query --package_path %workspace%:%workspace%/opt_bazel_base_workspace
 
-# Complain about missing headers in the dependencies of C++ code instead of just
-# working with it.
-# TODO(Brian): Fix Bazel so this actually does something again...
-build --hdrs_check=strict
-
 build --crosstool_top=//tools/cpp:toolchain
 
 # Show paths to a few more than just 1 target.
diff --git a/tools/test_sharding_compliant b/tools/test_sharding_compliant
new file mode 100644
index 0000000..da13c2b
--- /dev/null
+++ b/tools/test_sharding_compliant
@@ -0,0 +1 @@
+This is a file used to indicate to Bazel that tests can be sharded.