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

Commit f0eb968d authored by Alexander Smundak's avatar Alexander Smundak Committed by Gerrit Code Review
Browse files

Merge "Build output directory should be an absolute path."

parents a628a97e a1e178f3
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -6,13 +6,19 @@
# The following environment variables affect the result:
#   TARGET_PRODUCT        target device name, e.g., 'aosp_blueline'
#   TARGET_BUILD_VARIANT  variant, e.g., `userdebug`
#   OUT_DIR               where the build is happening (./out if not specified)
#   OUT_DIR               absolute path  where the build is happening ($PWD/out if not specified})
#   DIST_DIR              where the resulting all.kzip will be placed
#   XREF_CORPUS           source code repository URI, e.g., 'android.googlesource.com/platform/superproject'
#   BUILD_NUMBER          build number, used to generate unique ID (will use UUID if not set)

# If OUT_DIR is not set, the build will use out/ as output directory, which is
# a relative path. Make it absolute, otherwise the indexer will not know that it
# contains only generated files.
: ${OUT_DIR:=$PWD/out}
[[ "$OUT_DIR" =~ ^/ ]] || { echo "$OUT_DIR is not an absolute path"; exit 1; }

# The extraction might fail for some source files, so run with -k
build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xref_cxx xref_java
OUT_DIR=$OUT_DIR build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xref_cxx xref_java

# We build with -k, so check that we have generated at least 100K files
# (the actual number is 180K+)
@@ -22,5 +28,5 @@ declare -r kzip_count=$(find $OUT_DIR -name '*.kzip' | wc -l)
# Pack
# TODO(asmundak): this should be done by soong.
declare -r allkzip=all.kzip
"${OUT_DIR:-out}/soong/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find $OUT_DIR -name '*.kzip')
"$OUT_DIR/soong/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find $OUT_DIR -name '*.kzip')
echo "${BUILD_NUMBER:-$(uuidgen)}" >"$DIST_DIR/revision.txt"