diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2015-09-04 15:27:45 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2015-09-04 16:32:25 +0000 |
commit | e8f8dc599669a3a1c0a41d7bec95f80deb9203f0 (patch) | |
tree | 49c26d48dc464131167c1dc36fc09520e639cc32 | |
parent | d9b512177510640947a2979959f4287e97f35f8f (diff) |
Installer: ship the Bash completion script and add a finish message
--
MOS_MIGRATED_REVID=102343488
-rw-r--r-- | scripts/BUILD | 1 | ||||
-rw-r--r-- | scripts/packages/BUILD | 5 | ||||
-rwxr-xr-x | scripts/packages/template_bin.sh | 17 |
3 files changed, 20 insertions, 3 deletions
diff --git a/scripts/BUILD b/scripts/BUILD index 2136e4e2d1..cc4d157736 100644 --- a/scripts/BUILD +++ b/scripts/BUILD @@ -18,6 +18,7 @@ genrule( "//src:bazel", "//tools/defaults:jdk", ], + visibility = ["//scripts/packages:__pkg__"], ) sh_test( diff --git a/scripts/packages/BUILD b/scripts/packages/BUILD index 9159ac0809..d1383d5045 100644 --- a/scripts/packages/BUILD +++ b/scripts/packages/BUILD @@ -30,7 +30,10 @@ load("self_extract_binary", "self_extract_binary") self_extract_binary( name = "install.sh", empty_files = ["tools/defaults/BUILD"], - flatten_resources = ["//src:bazel"], + flatten_resources = [ + "//src:bazel", + "//scripts:bash_completion", + ], launcher = ":launcher_bin.sh", resources = [ "//third_party:srcs", diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh index b7b1f77b01..880b430670 100755 --- a/scripts/packages/template_bin.sh +++ b/scripts/packages/template_bin.sh @@ -103,12 +103,15 @@ if [ -z "${JAVA_HOME-}" ]; then case "$(uname -s | tr 'A-Z' 'a-z')" in linux) JAVA_HOME="$(readlink -f $(which javac) 2>/dev/null | sed 's_/bin/javac__')" || true + BASHRC="~/.bashrc" ;; freebsd) JAVA_HOME="/usr/local/openjdk8" + BASHRC="~/.bashrc" ;; darwin) JAVA_HOME="$(/usr/libexec/java_home -v ${JAVA_VERSION}+ 2> /dev/null)" || true + BASHRC="~/.bash_profile" ;; esac fi @@ -139,10 +142,10 @@ fi mkdir -p ${bin} ${base} ${base}/bin ${base}/etc ${base}/base_workspace echo -n . -unzip -q "${BASH_SOURCE[0]}" bazel -d "${base}/bin" +unzip -q "${BASH_SOURCE[0]}" bazel bazel-complete.bash -d "${base}/bin" echo -n . chmod 0755 "${base}/bin/bazel" -unzip -q "${BASH_SOURCE[0]}" -x bazel -d "${base}/base_workspace" +unzip -q "${BASH_SOURCE[0]}" -x bazel bazel-complete.bash -d "${base}/base_workspace" echo -n . cat >"${base}/etc/bazel.bazelrc" <<EO build --package_path %workspace%:${base}/base_workspace @@ -171,4 +174,14 @@ else echo . fi +cat <<EOF + +Bazel is now installed! + +Make sure you have "${bin}" in your path. You can also activate bash +completion by adding the following line to your ${BASHRC}: + source ${base}/bin/bazel-complete.bash + +See http://bazel.io/docs/getting-started.html to start a new project! +EOF exit 0 |