art: Enable variable acquisition for art_build.py in CI
This change enables art/tools/art_build.py to correctly acquire
essential build variables (HOST_OUT, TARGET_OUT, etc.) across
different CI build scenarios.
Previously, art_build.py lacked direct access to these variables,
requiring manual workarounds. This update implements a unified
mechanism for the script to establish its build environment context:
- The Android Open Source Project (AOSP) root directory for script
operations (such as invoking 'dumpvars') is determined from the
--android-root command-line argument. The default value for
--android-root is now intelligently sourced from the
ANDROID_BUILD_TOP environment variable if set; otherwise, it
defaults to the current directory ('.').
- For the 'dumpvars' process to function correctly and retrieve other
build-specific variables (e.g., HOST_OUT, TARGET_OUT), the
environment variables TARGET_PRODUCT, TARGET_RELEASE, and
TARGET_BUILD_VARIANT must always be present in the calling
environment. The script now explicitly checks for their existence and
will exit with an error if they are not found. These TARGET_*
variables are inherited directly by the 'dumpvars' subprocess from
the script's execution environment.
This ensures all ART CI tests execute correctly without
variable-related failures.
Flag: EXEMPT Build infra and tools
Bug: 396022230
Test: 1. lunch armv8-trunk_staging-userdebug &&
./art/tools/art_build.py --build-art <other_targets>
2. TARGET_PRODUCT=armv8 TARGET_RELEASE=trunk_staging \
TARGET_BUILD_VARIANT=userdebug \
./art/tools/art_build.py --build-art <other_targets>
Change-Id: I9cfb734471b3bc93cf76305d717bceb595d9ee2d
1 file changed