utils: build-kitkat smarter aosp invocation
* Attempt to find the aosp binary with the following priority: 1. If AOSP_BIN is set, use that 2. If aosp is found in the shell $PATH 3. Grab it from the web
This commit is contained in:
parent
4be024356f
commit
683126f05c
@ -4,8 +4,6 @@
|
|||||||
#
|
#
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
AOSP_BIN=${AOSP_BIN:-aosp}
|
|
||||||
|
|
||||||
if [ "$1" = "docker" ]; then
|
if [ "$1" = "docker" ]; then
|
||||||
branch=android-4.4.4_r2.0.1
|
branch=android-4.4.4_r2.0.1
|
||||||
cpus=$(grep ^processor /proc/cpuinfo | wc -l)
|
cpus=$(grep ^processor /proc/cpuinfo | wc -l)
|
||||||
@ -15,10 +13,34 @@ if [ "$1" = "docker" ]; then
|
|||||||
|
|
||||||
prebuilts/misc/linux-x86/ccache/ccache -M 10G
|
prebuilts/misc/linux-x86/ccache/ccache -M 10G
|
||||||
|
|
||||||
source build/envsetup.sh
|
source build/envsetup.sh
|
||||||
lunch aosp_arm-eng
|
lunch aosp_arm-eng
|
||||||
make -j $cpus
|
make -j $cpus
|
||||||
else
|
else
|
||||||
|
aosp_url="https://raw.githubusercontent.com/kylemanna/docker-aosp/master/utils/aosp"
|
||||||
|
args="run.sh docker"
|
||||||
export AOSP_EXTRA_ARGS="-v $(readlink -f $0):/usr/local/bin/run.sh:ro"
|
export AOSP_EXTRA_ARGS="-v $(readlink -f $0):/usr/local/bin/run.sh:ro"
|
||||||
$AOSP_BIN run.sh docker
|
|
||||||
|
#
|
||||||
|
# Try to invoke the aosp wrapper with the following priority:
|
||||||
|
#
|
||||||
|
# 1. If AOSP_BIN is set, use that
|
||||||
|
# 2. If aosp is found in the shell $PATH
|
||||||
|
# 3. Grab it from the web
|
||||||
|
#
|
||||||
|
if [ -n "$AOSP_BIN" ]; then
|
||||||
|
$AOSP_BIN $args
|
||||||
|
elif [ -x "../utils/aosp" ]; then
|
||||||
|
../utils/aosp $args
|
||||||
|
elif [ -n "$(type -P aosp)" ]; then
|
||||||
|
aosp $args
|
||||||
|
else
|
||||||
|
if [ -n "$(type -P curl)" ]; then
|
||||||
|
bash <(curl -s $aosp_url) $args
|
||||||
|
elif [ -n "$(type -P wget)" ]; then
|
||||||
|
bash <(wget -q $aosp_url -O -) $args
|
||||||
|
else
|
||||||
|
echo "Unable to run the aosp binary"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user