Merge "STT: combined build supports more targets to build" into main
This commit is contained in:
@@ -15,11 +15,11 @@
|
||||
# limitations under the License.
|
||||
|
||||
usage() {
|
||||
echo "usage: ${0} -t TARGET -v VARIANT [-d DIST_OUT] [-a ALTER_TARGET] [-c] [-o] [-r] [GOALS ...]"
|
||||
echo "usage: ${0} -t TARGET -v VARIANT [-d DIST_OUT] [[-a ALTER_TARGET] ...] [-c] [-o] [-r] [GOALS ...]"
|
||||
echo " -t TARGET : Primay target to build"
|
||||
echo " -v VARIANT : Build variant (ex. user, userdebug)"
|
||||
echo " -d DIST_OUT : Path for dist out"
|
||||
echo " -a ALTER_TARGET: The secondary target that shares the build artifacts with the primary target"
|
||||
echo " -a ALTER_TARGET: Alternative targets that share the build artifacts with the primary target"
|
||||
echo " -c : Run the target build again after installclean for reference"
|
||||
echo ' -o : Write build time results to "build_time_results.txt" file in "${OUT_DIR}" or "${DIST_OUT}/logs" if -d defined'
|
||||
echo " -r : Dryrun to see the commands without actually building the targets"
|
||||
@@ -31,7 +31,7 @@ while getopts ha:cd:ort:v: opt; do
|
||||
usage
|
||||
;;
|
||||
a)
|
||||
alter_target="${OPTARG}"
|
||||
alter_targets+=("${OPTARG}")
|
||||
;;
|
||||
c)
|
||||
installclean="true"
|
||||
@@ -67,6 +67,10 @@ if [[ -z "${variant}" ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ "${#alter_targets[@]}" -eq 1 ]; then
|
||||
# test for a-b-a builds
|
||||
alter_targets+=("${target}")
|
||||
fi
|
||||
|
||||
goals="${@:OPTIND}"
|
||||
|
||||
@@ -84,7 +88,7 @@ if [[ -n "${dist_dir}" ]]; then
|
||||
fi
|
||||
|
||||
run_command() {
|
||||
echo "Running: ${1}"
|
||||
echo "**Running: ${1}"
|
||||
if [[ -z "${dry_run}" ]]; then
|
||||
eval "${1}"
|
||||
fi
|
||||
@@ -111,40 +115,36 @@ if [[ -n "${result_out}" ]]; then
|
||||
fi
|
||||
|
||||
# Build the target first.
|
||||
echo "Initial build..."
|
||||
echo; echo "Initial build..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${target} TARGET_BUILD_VARIANT=${variant} ${goals}"
|
||||
|
||||
if [[ -n "${installclean}" ]]; then
|
||||
# Run the same build after installclean
|
||||
echo "Installclean..."
|
||||
echo; echo "Installclean for incremental build..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${target} TARGET_BUILD_VARIANT=${variant} installclean"
|
||||
echo "Build the same initial build..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${target} TARGET_BUILD_VARIANT=${variant} NINJA_ARGS=\"-d explain\" ${goals}"
|
||||
get_build_trace "build_${target}_installclean.trace.gz"
|
||||
echo "Installclean to prepare for the next build..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${target} TARGET_BUILD_VARIANT=${variant} installclean"
|
||||
fi
|
||||
|
||||
if [[ -n "${alter_target}" ]]; then
|
||||
# Building two targets with a single artifacts
|
||||
echo "Installclean for the alternative target..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${alter_target} TARGET_BUILD_VARIANT=${variant} installclean"
|
||||
if [[ -n "${dist_dir}" ]]; then
|
||||
# Remove target-specific dist artifacts from the previous build
|
||||
run_command "rm -f ${dist_dir}/${target}*"
|
||||
fi
|
||||
echo "Build the alternative target..."
|
||||
count=0
|
||||
# Building the next targets in sequence
|
||||
for alter_target in "${alter_targets[@]}"; do
|
||||
count=$((${count}+1))
|
||||
echo; echo "Build ${alter_target}...(${count})"
|
||||
run_command "${base_command} TARGET_PRODUCT=${alter_target} TARGET_BUILD_VARIANT=${variant} NINJA_ARGS=\"-d explain\" ${goals}"
|
||||
get_build_trace "build_${alter_target}_ab.trace.gz"
|
||||
get_build_trace "build_${alter_target}_ab${count}.trace.gz"
|
||||
|
||||
echo "Installclean for ${alter_target}..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${alter_target} TARGET_BUILD_VARIANT=${variant} installclean"
|
||||
|
||||
echo "Installclean for the primary target..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${target} TARGET_BUILD_VARIANT=${variant} installclean"
|
||||
if [[ -n "${dist_dir}" ]]; then
|
||||
# Remove target-specific dist artifacts from the previous build
|
||||
# Remove target-specific dist artifacts
|
||||
run_command "rm -f ${dist_dir}/${alter_target}*"
|
||||
fi
|
||||
echo "Build the primary target again..."
|
||||
run_command "${base_command} TARGET_PRODUCT=${target} TARGET_BUILD_VARIANT=${variant} NINJA_ARGS=\"-d explain\" ${goals}"
|
||||
get_build_trace "build_${target}_aba.trace.gz"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "${dist_dir}" ]]; then
|
||||
# Remove some dist artifacts to save disk space
|
||||
|
||||
Reference in New Issue
Block a user