Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3a800f6 authored by Brian Egizi's avatar Brian Egizi Committed by Gerrit Code Review
Browse files

Merge "Update kzip script to support superproject revision environment variable"

parents 1d3466a0 4aa056eb
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
# The following environment variables affect the result:
#   BUILD_NUMBER          build number, used to generate unique ID (will use UUID if not set)
#   SUPERPROJECT_SHA      superproject sha, used to generate unique id (will use BUILD_NUMBER if not set)
#   SUPERPROJECT_REVISION superproject revision, used for unique id if defined as a sha
#   KZIP_NAME             name of the output file (will use SUPERPROJECT_REVISION|SUPERPROJECT_SHA|BUILD_NUMBER|UUID if not set)
#   DIST_DIR              where the resulting all.kzip will be placed
#   KYTHE_KZIP_ENCODING   proto or json (proto is default)
#   KYTHE_JAVA_SOURCE_BATCH_SIZE maximum number of the Java source files in a compilation unit
@@ -14,8 +16,16 @@
#   TARGET_PRODUCT        target device name, e.g., 'aosp_blueline'
#   XREF_CORPUS           source code repository URI, e.g., 'android.googlesource.com/platform/superproject'

: ${BUILD_NUMBER:=$(uuidgen)}
: ${SUPERPROJECT_SHA:=$BUILD_NUMBER}
# If the SUPERPROJECT_REVISION is defined as a sha, use this as the default value if no
# SUPERPROJECT_SHA is specified.
if [[ $SUPERPROJECT_REVISION =~ [0-9a-f]{40} ]]; then
  : ${KZIP_NAME:=${SUPERPROJECT_REVISION:-}}
fi

: ${KZIP_NAME:=${SUPERPROJECT_SHA:-}}
: ${KZIP_NAME:=${BUILD_NUMBER:-}}
: ${KZIP_NAME:=$(uuidgen)}

: ${KYTHE_JAVA_SOURCE_BATCH_SIZE:=500}
: ${KYTHE_KZIP_ENCODING:=proto}
: ${XREF_CORPUS:?should be set}
@@ -50,6 +60,6 @@ declare -r kzip_count=$(find "$out" -name '*.kzip' | wc -l)

# Pack
# TODO(asmundak): this should be done by soong.
declare -r allkzip="$SUPERPROJECT_SHA.kzip"
declare -r allkzip="$KZIP_NAME.kzip"
"$out/soong/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find "$out" -name '*.kzip')