blob: 62ea7a23dbc70bd99d24f3e65b1c661a769530db [file] [log] [blame]
Sasha Smundakcb86c3c2019-08-08 12:51:15 -07001# /bin/bash -uv
2#
3# Build kzip files (source files for the indexing pipeline) for the given configuration,
4# merge them and place the resulting all.kzip into $DIST_DIR.
5# It is assumed that the current directory is the top of the source tree.
6# The following enviromnet variables affect the result:
7# TARGET_PRODUCT target device name, e.g., `aosp_blueline`
8# TARGET_BUILD_VARIANT variant, e.g., `userdebug`
9# OUT_DIR where the build is happening (./out if not specified)
10# DIST_DIR where the resulting all.kzip will be placed
11# XREF_CORPUS source code repository URI, e.g.,
12# `android.googlesource.com/platform/superproject`
13
14# The extraction might fail for some source files, so run with -k
15build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xref_cxx xref_java
16
17# We build with -k, so check that we have generated at least 100K files
18# (the actual number is 180K+)
19declare -r kzip_count=$(find $OUT_DIR -name '*.kzip' | wc -l)
20(($kzip_count>100000)) || { printf "Too few kzip files were generated: %d\n" $kzip_count; exit 1; }
21
22# Pack
23# TODO(asmundak): this should be done by soong.
24declare -r allkzip=all.kzip
25"$OUT_DIR/soong/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find $OUT_DIR -name '*.kzip')