Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37f3a728 authored by Christopher Ferris's avatar Christopher Ferris Committed by android-build-merger
Browse files

Merge "Small fixes for environment variables."

am: fd0cb496

Change-Id: Ie65c27691e5a2ebb8923d83d16eae182744dc93f
parents e9e4001b fd0cb496
Loading
Loading
Loading
Loading
+31 −24
Original line number Original line Diff line number Diff line
@@ -28,9 +28,9 @@ Environment options:


Look at the source to view more functions. The complete list is:
Look at the source to view more functions. The complete list is:
EOF
EOF
    T=$(gettop)
    local T=$(gettop)
    local A
    local A=""
    A=""
    local i
    for i in `cat $T/build/envsetup.sh | sed -n "/^[[:blank:]]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
    for i in `cat $T/build/envsetup.sh | sed -n "/^[[:blank:]]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
      A="$A $i"
      A="$A $i"
    done
    done
@@ -40,7 +40,7 @@ EOF
# Get all the build variables needed by this script in a single call to the build system.
# Get all the build variables needed by this script in a single call to the build system.
function build_build_var_cache()
function build_build_var_cache()
{
{
    T=$(gettop)
    local T=$(gettop)
    # Grep out the variable names from the script.
    # Grep out the variable names from the script.
    cached_vars=`cat $T/build/envsetup.sh | tr '()' '  ' | awk '{for(i=1;i<=NF;i++) if($i~/get_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
    cached_vars=`cat $T/build/envsetup.sh | tr '()' '  ' | awk '{for(i=1;i<=NF;i++) if($i~/get_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
    cached_abs_vars=`cat $T/build/envsetup.sh | tr '()' '  ' | awk '{for(i=1;i<=NF;i++) if($i~/get_abs_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
    cached_abs_vars=`cat $T/build/envsetup.sh | tr '()' '  ' | awk '{for(i=1;i<=NF;i++) if($i~/get_abs_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
@@ -74,6 +74,7 @@ function build_build_var_cache()
function destroy_build_var_cache()
function destroy_build_var_cache()
{
{
    unset BUILD_VAR_CACHE_READY
    unset BUILD_VAR_CACHE_READY
    local v
    for v in $cached_vars; do
    for v in $cached_vars; do
      unset var_cache_$v
      unset var_cache_$v
    done
    done
@@ -93,7 +94,7 @@ function get_abs_build_var()
    return
    return
    fi
    fi


    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        return
        return
@@ -111,7 +112,7 @@ function get_build_var()
    return
    return
    fi
    fi


    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        return
        return
@@ -123,7 +124,7 @@ function get_build_var()
# check to see if the supplied product is one we can build
# check to see if the supplied product is one we can build
function check_product()
function check_product()
{
{
    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        return
        return
@@ -141,6 +142,7 @@ VARIANT_CHOICES=(user userdebug eng)
# check to see if the supplied variant is valid
# check to see if the supplied variant is valid
function check_variant()
function check_variant()
{
{
    local v
    for v in ${VARIANT_CHOICES[@]}
    for v in ${VARIANT_CHOICES[@]}
    do
    do
        if [ "$v" = "$1" ]
        if [ "$v" = "$1" ]
@@ -153,7 +155,7 @@ function check_variant()


function setpaths()
function setpaths()
{
{
    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP."
        echo "Couldn't locate the top of the tree.  Try setting TOP."
        return
        return
@@ -184,18 +186,19 @@ function setpaths()
    fi
    fi


    # and in with the new
    # and in with the new
    prebuiltdir=$(getprebuilt)
    local prebuiltdir=$(getprebuilt)
    gccprebuiltdir=$(get_abs_build_var ANDROID_GCC_PREBUILTS)
    local gccprebuiltdir=$(get_abs_build_var ANDROID_GCC_PREBUILTS)


    # defined in core/config.mk
    # defined in core/config.mk
    targetgccversion=$(get_build_var TARGET_GCC_VERSION)
    local targetgccversion=$(get_build_var TARGET_GCC_VERSION)
    targetgccversion2=$(get_build_var 2ND_TARGET_GCC_VERSION)
    local targetgccversion2=$(get_build_var 2ND_TARGET_GCC_VERSION)
    export TARGET_GCC_VERSION=$targetgccversion
    export TARGET_GCC_VERSION=$targetgccversion


    # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
    # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
    export ANDROID_TOOLCHAIN=
    export ANDROID_TOOLCHAIN=
    export ANDROID_TOOLCHAIN_2ND_ARCH=
    export ANDROID_TOOLCHAIN_2ND_ARCH=
    local ARCH=$(get_build_var TARGET_ARCH)
    local ARCH=$(get_build_var TARGET_ARCH)
    local toolchaindir toolchaindir2=
    case $ARCH in
    case $ARCH in
        x86) toolchaindir=x86/x86_64-linux-android-$targetgccversion/bin
        x86) toolchaindir=x86/x86_64-linux-android-$targetgccversion/bin
            ;;
            ;;
@@ -217,7 +220,7 @@ function setpaths()
        export ANDROID_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
        export ANDROID_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
    fi
    fi


    if [ -d "$gccprebuiltdir/$toolchaindir2" ]; then
    if [ "$toolchaindir2" -a -d "$gccprebuiltdir/$toolchaindir2" ]; then
        export ANDROID_TOOLCHAIN_2ND_ARCH=$gccprebuiltdir/$toolchaindir2
        export ANDROID_TOOLCHAIN_2ND_ARCH=$gccprebuiltdir/$toolchaindir2
    fi
    fi


@@ -273,7 +276,7 @@ function setpaths()


function printconfig()
function printconfig()
{
{
    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        return
        return
@@ -399,6 +402,7 @@ function choosetype()
#
#
function chooseproduct()
function chooseproduct()
{
{
    local default_value
    if [ "x$TARGET_PRODUCT" != x ] ; then
    if [ "x$TARGET_PRODUCT" != x ] ; then
        default_value=$TARGET_PRODUCT
        default_value=$TARGET_PRODUCT
    else
    else
@@ -694,7 +698,7 @@ function gettop
            PWD= /bin/pwd
            PWD= /bin/pwd
        else
        else
            local HERE=$PWD
            local HERE=$PWD
            T=
            local T=
            while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
            while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
                \cd ..
                \cd ..
                T=`PWD= /bin/pwd -P`
                T=`PWD= /bin/pwd -P`
@@ -742,9 +746,9 @@ function m()


function findmakefile()
function findmakefile()
{
{
    TOPFILE=build/core/envsetup.mk
    local TOPFILE=build/core/envsetup.mk
    local HERE=$PWD
    local HERE=$PWD
    T=
    local T=
    while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
    while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
        T=`PWD= /bin/pwd`
        T=`PWD= /bin/pwd`
        if [ -f "$T/Android.mk" -o -f "$T/Android.bp" ]; then
        if [ -f "$T/Android.mk" -o -f "$T/Android.bp" ]; then
@@ -780,6 +784,7 @@ function mm()
            echo "Couldn't locate a makefile from the current directory."
            echo "Couldn't locate a makefile from the current directory."
            return 1
            return 1
        else
        else
            local ARG
            for ARG in $@; do
            for ARG in $@; do
                case $ARG in
                case $ARG in
                  GET-INSTALL-PATH) GET_INSTALL_PATH=$ARG;;
                  GET-INSTALL-PATH) GET_INSTALL_PATH=$ARG;;
@@ -937,7 +942,7 @@ function mmma()


function croot()
function croot()
{
{
    T=$(gettop)
    local T=$(gettop)
    if [ "$T" ]; then
    if [ "$T" ]; then
        if [ "$1" ]; then
        if [ "$1" ]; then
            \cd $(gettop)/$1
            \cd $(gettop)/$1
@@ -951,9 +956,9 @@ function croot()


function cproj()
function cproj()
{
{
    TOPFILE=build/core/envsetup.mk
    local TOPFILE=build/core/envsetup.mk
    local HERE=$PWD
    local HERE=$PWD
    T=
    local T=
    while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
    while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
        T=$PWD
        T=$PWD
        if [ -f "$T/Android.mk" ]; then
        if [ -f "$T/Android.mk" ]; then
@@ -1204,6 +1209,7 @@ function cgrep()


function resgrep()
function resgrep()
{
{
    local dir
    for dir in `find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -name res -type d`; do
    for dir in `find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -name res -type d`; do
        find $dir -type f -name '*\.xml' -exec grep --color -n "$@" {} +
        find $dir -type f -name '*\.xml' -exec grep --color -n "$@" {} +
    done
    done
@@ -1265,7 +1271,7 @@ function getprebuilt


function tracedmdump()
function tracedmdump()
{
{
    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP."
        echo "Couldn't locate the top of the tree.  Try setting TOP."
        return
        return
@@ -1442,7 +1448,7 @@ function smoketest()
        echo "Couldn't locate output files.  Try running 'lunch' first." >&2
        echo "Couldn't locate output files.  Try running 'lunch' first." >&2
        return
        return
    fi
    fi
    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        return
        return
@@ -1459,7 +1465,7 @@ function smoketest()
# simple shortcut to the runtest command
# simple shortcut to the runtest command
function runtest()
function runtest()
{
{
    T=$(gettop)
    local T=$(gettop)
    if [ ! "$T" ]; then
    if [ ! "$T" ]; then
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
        return
        return
@@ -1472,7 +1478,8 @@ function godir () {
        echo "Usage: godir <regex>"
        echo "Usage: godir <regex>"
        return
        return
    fi
    fi
    T=$(gettop)
    local T=$(gettop)
    local FILELIST
    if [ ! "$OUT_DIR" = "" ]; then
    if [ ! "$OUT_DIR" = "" ]; then
        mkdir -p $OUT_DIR
        mkdir -p $OUT_DIR
        FILELIST=$OUT_DIR/filelist
        FILELIST=$OUT_DIR/filelist