@@ -11,12 +11,10 @@ set -euo pipefail
1111: " ${BAZEL_VERSION:= $(cat " ${REPO_TOP} /.bazelversion" )} "
1212
1313: " ${BAZEL_AIRGAPPED_DIR:= ${REPO_TOP} / bazel-airgapped} "
14- : " ${BAZEL_DISTDIR:= ${BAZEL_AIRGAPPED_DIR} / bazel-distdir} "
1514: " ${BAZEL_CACHEDIR:= ${BAZEL_AIRGAPPED_DIR} / bazel-cache} "
1615: " ${BAZEL_VENDORDIR:= ${BAZEL_AIRGAPPED_DIR} / bazel-vendor} "
1716: " ${BAZEL_BITSTREAMS_CACHE:= ${BAZEL_AIRGAPPED_DIR} / bitstreams-cache} "
1817: " ${BAZEL_BITSTREAMS_CACHEDIR:= ${BAZEL_BITSTREAMS_CACHE} / cache} "
19- : " ${BAZEL_BITSTREAMS_REPO:= bitstreams} "
2018
2119LINE_SEP=" ====================================================================="
2220
@@ -28,15 +26,15 @@ usage() {
2826Utility script to prepare a directory with all bazel dependencies needed to
2927build project artifacts with bazel in an airgapped environment.
3028
31- Usage: $0 [-c ALL | DISTDIR | CACHE ]
29+ Usage: $0 [-c ALL | BAZEL | VENDOR ]
3230
33- - c: airgapped directory contents, set to either ALL or DISTDIR or CACHE .
31+ - c: airgapped directory contents, set to either ALL, BAZEL, or VENDOR .
3432 - f: force rebuild of airgapped directory, overwriting any existing one.
3533
36- Airgapped directory contents (-b ):
37- - ALL: both the distdir and cache will be added. (Default)
38- - DISTDIR : only the distdir, containing bazel and its dependencies will be added.
39- - CACHE : only the OpenTitan bazel workspace dependencies will be added.
34+ Airgapped directory contents (-c ):
35+ - ALL: both the bazel binary and vendor dir will be added. (Default)
36+ - BAZEL : only the bazel binary will be added.
37+ - VENDOR : only the OpenTitan bazel mod dependencies will be added.
4038
4139USAGE
4240}
@@ -70,10 +68,10 @@ if [[ "$#" -gt 0 ]]; then
7068fi
7169
7270if [[ ${AIRGAPPED_DIR_CONTENTS} != " ALL" && \
73- ${AIRGAPPED_DIR_CONTENTS} != " DISTDIR " && \
74- ${AIRGAPPED_DIR_CONTENTS} != " CACHE " ]]; then
71+ ${AIRGAPPED_DIR_CONTENTS} != " BAZEL " && \
72+ ${AIRGAPPED_DIR_CONTENTS} != " VENDOR " ]]; then
7573 echo " Invalid -c option: ${AIRGAPPED_DIR_CONTENTS} ." >&2
76- echo " Expected ALL, DISTDIR , or CACHE ." >&2
74+ echo " Expected ALL, BAZEL , or VENDOR ." >&2
7775 exit 1
7876fi
7977
103101mkdir -p ${BAZEL_AIRGAPPED_DIR}
104102
105103# ###############################################################################
106- # Prepare the distdir .
104+ # Download bazel .
107105# ###############################################################################
108106if [[ ${AIRGAPPED_DIR_CONTENTS} == " ALL" || \
109- ${AIRGAPPED_DIR_CONTENTS} == " DISTDIR " ]]; then
107+ ${AIRGAPPED_DIR_CONTENTS} == " BAZEL " ]]; then
110108 echo $LINE_SEP
111- echo " Preparing bazel offline distdir ..."
112- mkdir -p ${BAZEL_DISTDIR}
109+ echo " Downloading bazel ..."
113110 pushd ${BAZEL_AIRGAPPED_DIR}
114111 curl --silent --location \
115112 https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION} /bazel-${BAZEL_VERSION} -linux-x86_64 \
122119# Prepare the cache.
123120# ###############################################################################
124121if [[ ${AIRGAPPED_DIR_CONTENTS} == " ALL" || \
125- ${AIRGAPPED_DIR_CONTENTS} == " CACHE " ]]; then
122+ ${AIRGAPPED_DIR_CONTENTS} == " VENDOR " ]]; then
126123 echo $LINE_SEP
127- echo " Preparing bazel offline cachedir ..."
124+ echo " Preparing bazel offline vendor_dir ..."
128125 cd ${REPO_TOP}
129126 mkdir -p ${BAZEL_CACHEDIR}
130127 # Make bazel forget everything it knows, then download everything.
@@ -163,5 +160,5 @@ if [[ ${AIRGAPPED_DIR_CONTENTS} == "ALL" ]]; then
163160 echo $LINE_SEP
164161 echo " To perform an airgapped build, ship the contents of ${BAZEL_AIRGAPPED_DIR} to your airgapped environment and then:"
165162 echo " "
166- echo " bazel build --distdir= ${BAZEL_DISTDIR} -- vendor_dir=${BAZEL_VENDORDIR} <label >"
163+ echo " bazel build --vendor_dir=${BAZEL_VENDORDIR} <target >"
167164fi
0 commit comments