From 7f09c40c4924ac2e8510036bfa6ce264216bc964 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 11 Jul 2018 14:49:31 -0700 Subject: [PATCH] Unset envsetup.sh variables inside build Using ANDROID_BUILD_TOP and other envsetup.sh varialbes is already forbidden in makefiles, but some tools run by the build (like hidl-gen) will use it if it is set. Since they are set by envsetup.sh, and sourcing envsetup.sh before building is optional, unset them inside the build to get consistent behavior. Bug: 79250545 Test: m checkbuild Change-Id: I3e7d9f01390ccdc34c49115f2f15cd7542d9974b --- ui/build/config.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/build/config.go b/ui/build/config.go index d0378ec0b..1f7656eef 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -118,6 +118,18 @@ func NewConfig(ctx Context, args ...string) Config { // Set in envsetup.sh, reset in makefiles "ANDROID_JAVA_TOOLCHAIN", + + // Set by envsetup.sh, but shouldn't be used inside the build because envsetup.sh is optional + "ANDROID_BUILD_TOP", + "ANDROID_HOST_OUT", + "ANDROID_PRODUCT_OUT", + "ANDROID_HOST_OUT_TESTCASES", + "ANDROID_TARGET_OUT_TESTCASES", + "ANDROID_TOOLCHAIN", + "ANDROID_TOOLCHAIN_2ND_ARCH", + "ANDROID_DEV_SCRIPTS", + "ANDROID_EMULATOR_PREBUILTS", + "ANDROID_PRE_BUILD_PATHS", ) // Tell python not to spam the source tree with .pyc files.