Switch envsetup.sh dumpvars to soong_ui

Use soong_ui instead of make&config.mk directly. This way we use a
consistent make parser and sandboxing configurations.

Test: printconfig
Test: get_build_var TARGET_DEVICE
Test: get_abs_build_var PRODUCT_OUT
Test: get_abs_build_var ALL_PRODUCTS
Test: lunch aosp_marlin-userdebug
Test: build_build_var_cache; set | grep var_cache (diff before/after)
Change-Id: I22abdf95669b7a4fb8162377e013a9013155f249
This commit is contained in:
Dan Willemsen 2017-07-14 11:29:44 -07:00
parent ff806ece8d
commit af88c41795
1 changed files with 8 additions and 12 deletions

View File

@ -51,20 +51,18 @@ function build_build_var_cache()
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' ' '`
# Call the build system to dump the "<val>=<value>" pairs as a shell script. # Call the build system to dump the "<val>=<value>" pairs as a shell script.
build_dicts_script=`\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ build_dicts_script=`\cd $T; build/soong/soong_ui.bash --dumpvars-mode \
command make --no-print-directory -f build/core/config.mk \ --vars="$cached_vars" \
dump-many-vars \ --abs-vars="$cached_abs_vars" \
DUMP_MANY_VARS="$cached_vars" \ --var-prefix=var_cache_ \
DUMP_MANY_ABS_VARS="$cached_abs_vars" \ --abs-var-prefix=abs_var_cache_`
DUMP_VAR_PREFIX="var_cache_" \
DUMP_ABS_VAR_PREFIX="abs_var_cache_"`
local ret=$? local ret=$?
if [ $ret -ne 0 ] if [ $ret -ne 0 ]
then then
unset build_dicts_script unset build_dicts_script
return $ret return $ret
fi fi
# Excute the script to store the "<val>=<value>" pairs as shell variables. # Execute the script to store the "<val>=<value>" pairs as shell variables.
eval "$build_dicts_script" eval "$build_dicts_script"
ret=$? ret=$?
unset build_dicts_script unset build_dicts_script
@ -105,8 +103,7 @@ function get_abs_build_var()
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
fi fi
(\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ (\cd $T; build/soong/soong_ui.bash --dumpvar-mode --abs $1)
command make --no-print-directory -f build/core/config.mk dumpvar-abs-$1)
} }
# Get the exact value of a build variable. # Get the exact value of a build variable.
@ -123,8 +120,7 @@ function get_build_var()
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
fi fi
(\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ (\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1)
command make --no-print-directory -f build/core/config.mk dumpvar-$1)
} }
# check to see if the supplied product is one we can build # check to see if the supplied product is one we can build