blob: 0743bb272bb23dc32abe47aeb22f29e4aa05e0f4 [file] [log] [blame]
Brian Silvermancce76582015-10-31 23:38:52 +00001#!/bin/bash
2
3# This script builds a Debian package from a Bazel source tree with the
4# correct version.
5# The only argument is the path to a Bazel source tree.
6
7set -e
8set -u
9
10BAZEL_SOURCE="$1"
11
Philipp Schraderd64e1302020-12-12 18:53:00 -080012VERSION="4.0.0rc6-$(date +%Y%m%d%H%M)+$(GIT_DIR="${BAZEL_SOURCE}/.git" git rev-parse --short HEAD)"
Austin Schuh137d9452018-07-07 15:42:36 -070013OUTPUT="bazel_${VERSION}"
Brian Silvermancce76582015-10-31 23:38:52 +000014
Brian Silvermancce76582015-10-31 23:38:52 +000015(
16cd "${BAZEL_SOURCE}"
Austin Schuh137d9452018-07-07 15:42:36 -070017bazel build -c opt //scripts/packages:with-jdk/bazel-real --embed_label="${VERSION}" --stamp=yes --experimental_sandbox_base=/dev/shm
Brian Silvermancce76582015-10-31 23:38:52 +000018)
19
Austin Schuhda9d0602019-09-15 17:29:38 -070020cp "${BAZEL_SOURCE}/bazel-bin/scripts/packages/with-jdk/bazel-real" "${OUTPUT}"
Austin Schuh137d9452018-07-07 15:42:36 -070021xz "${OUTPUT}"
Brian Silvermancce76582015-10-31 23:38:52 +000022
Austin Schuh137d9452018-07-07 15:42:36 -070023echo "Output is at ${OUTPUT}.xz"