Add lunch support for TARGET_RELEASE

This replaces support for the unused
TARGET_PLATFORM_VERSION variable.

Now, if you pass three - separated
items the first is product, the
second is release and the third
is variant. If you only pass two
they're still product-variant
and the build system will choose
a reasonable default for release.

Test: run lunch with two and three items, confirmed values in the build banner
Change-Id: I128177d96ffe81b79b6945a24ebf37861c3b25fc
This commit is contained in:
Jeff Hamilton
2023-05-08 03:13:29 +00:00
parent d00675c764
commit a02c747449
2 changed files with 17 additions and 11 deletions

View File

@@ -223,7 +223,7 @@ _product_config_saved_KATI_ALLOW_RULES := $(.KATI_ALLOW_RULES)
endif endif
ifeq (,$(current_product_makefile)) ifeq (,$(current_product_makefile))
$(error Can not locate config makefile for product "$(TARGET_PRODUCT)") $(error Cannot locate config makefile for product "$(TARGET_PRODUCT)")
endif endif
ifneq (,$(filter $(TARGET_PRODUCT),$(products_using_starlark_config))) ifneq (,$(filter $(TARGET_PRODUCT),$(products_using_starlark_config)))

View File

@@ -804,13 +804,19 @@ function lunch()
export TARGET_BUILD_APPS= export TARGET_BUILD_APPS=
local product variant_and_version variant version # Support either <product>-<variant> or <product>-<release>-<variant>
local product release_and_variant release variant
product=${selection%%-*} # Trim everything after first dash product=${selection%%-*} # Trim everything after first dash
variant_and_version=${selection#*-} # Trim everything up to first dash release_and_variant=${selection#*-} # Trim everything up to first dash
if [ "$variant_and_version" != "$selection" ]; then if [ "$release_and_variant" != "$selection" ]; then
variant=${variant_and_version%%-*} local first=${release_and_variant%%-*} # Trim everything after first dash
if [ "$variant" != "$variant_and_version" ]; then if [ "$first" != "$release_and_variant" ]; then
version=${variant_and_version#*-} # There is a 2nd dash, split into release-variant
release=$first # Everything up to the dash
variant=${release_and_variant#*-} # Trim everything up to dash
else
# There is not a 2nd dash, default to variant as the second param
variant=$first
fi fi
fi fi
@@ -823,7 +829,7 @@ function lunch()
TARGET_PRODUCT=$product \ TARGET_PRODUCT=$product \
TARGET_BUILD_VARIANT=$variant \ TARGET_BUILD_VARIANT=$variant \
TARGET_PLATFORM_VERSION=$version \ TARGET_RELEASE=$release \
build_build_var_cache build_build_var_cache
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
@@ -835,10 +841,10 @@ function lunch()
fi fi
export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT) export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT) export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)
if [ -n "$version" ]; then if [ -n "$release" ]; then
export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION) export TARGET_RELEASE=$(get_build_var TARGET_RELEASE)
else else
unset TARGET_PLATFORM_VERSION unset TARGET_RELEASE
fi fi
export TARGET_BUILD_TYPE=release export TARGET_BUILD_TYPE=release