2014-11-12 06:09:03 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Test script file that maps itself into a docker container and runs
|
|
|
|
#
|
2014-11-16 18:58:50 +01:00
|
|
|
# Example invocation:
|
|
|
|
#
|
|
|
|
# $ AOSP_VOL=$PWD/build ./build-kitkat.sh
|
|
|
|
#
|
2014-11-12 06:09:03 +01:00
|
|
|
set -ex
|
|
|
|
|
|
|
|
if [ "$1" = "docker" ]; then
|
2014-12-03 01:42:42 +01:00
|
|
|
TEST_BRANCH=${TEST_BRANCH:-android-4.4.4_r2.0.1}
|
|
|
|
TEST_URL=${TEST_URL:-https://android.googlesource.com/platform/manifest}
|
|
|
|
|
2014-11-12 06:09:03 +01:00
|
|
|
cpus=$(grep ^processor /proc/cpuinfo | wc -l)
|
|
|
|
|
2014-12-03 01:42:42 +01:00
|
|
|
repo init --depth 1 -u "$TEST_URL" -b "$TEST_BRANCH"
|
|
|
|
|
|
|
|
# Use default sync '-j' value embedded in manifest file to be polite
|
|
|
|
repo sync
|
2014-11-12 06:09:03 +01:00
|
|
|
|
|
|
|
prebuilts/misc/linux-x86/ccache/ccache -M 10G
|
|
|
|
|
2014-11-13 23:37:12 +01:00
|
|
|
source build/envsetup.sh
|
2014-11-12 06:09:03 +01:00
|
|
|
lunch aosp_arm-eng
|
|
|
|
make -j $cpus
|
2014-11-13 23:37:12 +01:00
|
|
|
else
|
|
|
|
aosp_url="https://raw.githubusercontent.com/kylemanna/docker-aosp/master/utils/aosp"
|
2015-04-22 19:13:15 +02:00
|
|
|
args="bash run.sh docker"
|
2014-11-15 23:11:03 +01:00
|
|
|
export AOSP_EXTRA_ARGS="-v $(cd $(dirname $0) && pwd -P)/$(basename $0):/usr/local/bin/run.sh:ro"
|
2015-03-02 23:45:30 +01:00
|
|
|
export AOSP_IMAGE="kylemanna/aosp:4.4-kitkat"
|
2014-11-13 23:37:12 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
2014-11-12 06:09:03 +01:00
|
|
|
fi
|