#! /bin/bash # # Sets the current directory as Android build output directory for a # given target by writing the "prefix script" to it. Commands prefixed # by this script are executed in the Android build environment. E.g., # running # ./run <command> # runs <command> as if we issued # cd <source> # mount --bind <build dir> out # . build/envsetup.sh # lunch <config> # <command> # exit # # This arrangement eliminates the need to issue envsetup/lunch commands # manually, and allows to run multiple builds from the same shell. # Thus, if your source tree is in ~/aosp and you are building for # 'blueline' and 'cuttlefish', issuing # cd /sdx/blueline && \ # ~/aosp/build/soong/scripts/setup-android-build.sh aosp_blueline-userdebug # cd /sdx/cuttlefish && \ # ~/aosp/build/soong/scripts/setup-android-build.sh aosp_cf_arm64_phone-userdebug # sets up build directories in /sdx/blueline and /sdx/cuttlefish respectively. # After that, issue # /sdx/blueline/run m # to build blueline image, and issue # /sdx/cuttlefish atest CtsSecurityBulletinHostTestCases # to run CTS tests. Notice there is no need to change to a specific directory for that. # # Argument: # * configuration (one of those shown by `lunch` command). #
set -e function die() { printf "$@"; exit 1; }
# Find out where the source tree using the fact that we are in its # build/ subdirectory.
[[ "$(uname)" == Linux ]] || die "This setup runs only on Linux\n"
declare -r mydir="${0%/*}"
declare -r source="${mydir%/build/soong/scripts}"
[[ "/${mydir}/" =~ '/build/soong/scripts/' ]] || \
die "$0 should be in build/soong/scripts/ subdirectory of the source tree\n"
[[ ! -e .repo && ! -e .git ]] || \
die "Current directory looks like source. You should be in the _target_ directory.\n" # Do not override old run script. if [[ -x ./run ]]; then # Set variables from config=xxx and source=xxx comments in the existing script.
. <(sed -nr 's/^# *source=(.*)/oldsource=\1/p;s/^# *config=(.*)/oldconfig=\1/p' run)
die "This directory has been already set up to build Android for %s from %s.\n\
Remove 'run' file if you want to set it up afresh\n" "$oldconfig" "$oldsource" fi
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.