Merge "Add TARGET_PLATFORM_VERSION to lunch"

This commit is contained in:
Treehugger Robot
2017-03-24 00:14:00 +00:00
committed by Gerrit Code Review
6 changed files with 73 additions and 36 deletions

View File

@@ -36,6 +36,12 @@ ifndef TARGET_BUILD_VARIANT
#TARGET_BUILD_VARIANT:=eng #TARGET_BUILD_VARIANT:=eng
endif endif
# Choose a targeted release. If you don't pick one, the default is the
# soonest future release.
ifndef TARGET_PLATFORM_RELEASE
#TARGET_PLATFORM_RELEASE:=OPR1
endif
# Choose additional targets to always install, even when building # Choose additional targets to always install, even when building
# minimal targets like "make droid". This takes simple target names # minimal targets like "make droid". This takes simple target names
# like "Browser" or "MyApp", the names used by LOCAL_MODULE or # like "Browser" or "MyApp", the names used by LOCAL_MODULE or
@@ -105,4 +111,4 @@ endif
# variable will be changed. After you have modified this file with the new # variable will be changed. After you have modified this file with the new
# changes (see buildspec.mk.default), update this to the new value from # changes (see buildspec.mk.default), update this to the new value from
# buildspec.mk.default. # buildspec.mk.default.
BUILD_ENV_SEQUENCE_NUMBER := 12 BUILD_ENV_SEQUENCE_NUMBER := 13

View File

@@ -6,6 +6,7 @@ print_build_config_vars := \
TARGET_PRODUCT \ TARGET_PRODUCT \
TARGET_BUILD_VARIANT \ TARGET_BUILD_VARIANT \
TARGET_BUILD_TYPE \ TARGET_BUILD_TYPE \
TARGET_PLATFORM_VERSION \
TARGET_BUILD_APPS \ TARGET_BUILD_APPS \
TARGET_ARCH \ TARGET_ARCH \
TARGET_ARCH_VARIANT \ TARGET_ARCH_VARIANT \

View File

@@ -20,7 +20,7 @@ include $(BUILD_SYSTEM)/version_defaults.mk
# people who haven't re-run those will have to do so before they # people who haven't re-run those will have to do so before they
# can build. Make sure to also update the corresponding value in # can build. Make sure to also update the corresponding value in
# buildspec.mk.default and envsetup.sh. # buildspec.mk.default and envsetup.sh.
CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 12 CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 13
# --------------------------------------------------------------- # ---------------------------------------------------------------
# The product defaults to generic on hardware # The product defaults to generic on hardware

View File

@@ -58,6 +58,8 @@ endef
ALL_VERSIONS := O P ALL_VERSIONS := O P
ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v))) ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
DEFAULT_PLATFORM_VERSION := OPR1
# HACK: forward P to PPR1 until the build server config is updated # HACK: forward P to PPR1 until the build server config is updated
ifeq (P,$(TARGET_PLATFORM_VERSION)) ifeq (P,$(TARGET_PLATFORM_VERSION))
TARGET_PLATFORM_VERSION := PPR1 TARGET_PLATFORM_VERSION := PPR1
@@ -67,7 +69,7 @@ ifeq (,$(TARGET_PLATFORM_VERSION))
# Default targeted platform version # Default targeted platform version
# TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional # TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
# on this # on this
TARGET_PLATFORM_VERSION := OPR1 TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
endif endif
ifeq (,$(filter $(ALL_VERSIONS), $(TARGET_PLATFORM_VERSION))) ifeq (,$(filter $(ALL_VERSIONS), $(TARGET_PLATFORM_VERSION)))

View File

@@ -296,7 +296,7 @@ function set_stuff_for_environment()
function set_sequence_number() function set_sequence_number()
{ {
export BUILD_ENV_SEQUENCE_NUMBER=12 export BUILD_ENV_SEQUENCE_NUMBER=13
} }
function settitle() function settitle()
@@ -569,50 +569,42 @@ function lunch()
then then
selection=${LUNCH_MENU_CHOICES[$(($answer-1))]} selection=${LUNCH_MENU_CHOICES[$(($answer-1))]}
fi fi
elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$") else
then
selection=$answer selection=$answer
fi fi
if [ -z "$selection" ]
then
echo
echo "Invalid lunch combo: $answer"
return 1
fi
export TARGET_BUILD_APPS= export TARGET_BUILD_APPS=
local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//") local product variant_and_version variant version
check_variant $variant
if [ $? -ne 0 ] product=${selection%%-*} # Trim everything after first dash
then variant_and_version=${selection#*-} # Trim everything up to first dash
echo if [ "$variant_and_version" != "$selection" ]; then
echo "** Invalid variant: '$variant'" variant=${variant_and_version%%-*}
echo "** Must be one of ${VARIANT_CHOICES[@]}" if [ "$variant" != "$variant_and_version" ]; then
variant= version=${variant_and_version#*-}
fi
fi fi
local product=$(echo -n $selection | sed -e "s/-.*$//") if [ -z "$product" ]
TARGET_PRODUCT=$product \
TARGET_BUILD_VARIANT=$variant \
build_build_var_cache
if [ $? -ne 0 ]
then
echo
echo "** Don't have a product spec for: '$product'"
echo "** Do you have the right repo manifest?"
product=
fi
if [ -z "$product" -o -z "$variant" ]
then then
echo echo
echo "Invalid lunch combo: $selection"
return 1 return 1
fi fi
export TARGET_PRODUCT=$product TARGET_PRODUCT=$product \
export TARGET_BUILD_VARIANT=$variant TARGET_BUILD_VARIANT=$variant \
TARGET_PLATFORM_VERSION=$version \
build_build_var_cache
if [ $? -ne 0 ]
then
return 1
fi
export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)
export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)
export TARGET_BUILD_TYPE=release export TARGET_BUILD_TYPE=release
echo echo

36
tests/envsetup_tests.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash -e
source $(dirname $0)/../envsetup.sh
unset TARGET_PRODUCT TARGET_BUILD_VARIANT TARGET_PLATFORM_VERSION
function check_lunch
(
echo lunch $1
set +e
lunch $1 > /dev/null 2> /dev/null
set -e
[ "$TARGET_PRODUCT" = "$2" ] || ( echo "lunch $1: expected TARGET_PRODUCT='$2', got '$TARGET_PRODUCT'" && exit 1 )
[ "$TARGET_BUILD_VARIANT" = "$3" ] || ( echo "lunch $1: expected TARGET_BUILD_VARIANT='$3', got '$TARGET_BUILD_VARIANT'" && exit 1 )
[ "$TARGET_PLATFORM_VERSION" = "$4" ] || ( echo "lunch $1: expected TARGET_PLATFORM_VERSION='$4', got '$TARGET_PLATFORM_VERSION'" && exit 1 )
)
default_version=$(get_build_var DEFAULT_PLATFORM_VERSION)
valid_version=PPR1
# lunch tests
check_lunch "aosp_arm64" "aosp_arm64" "eng" "$default_version"
check_lunch "aosp_arm64-userdebug" "aosp_arm64" "userdebug" "$default_version"
check_lunch "aosp_arm64-userdebug-$valid_version" "aosp_arm64" "userdebug" "$valid_version"
check_lunch "abc" "" "" ""
check_lunch "aosp_arm64-abc" "" "" ""
check_lunch "aosp_arm64-userdebug-abc" "" "" ""
check_lunch "aosp_arm64-abc-$valid_version" "" "" ""
check_lunch "abc-userdebug-$valid_version" "" "" ""
check_lunch "-" "" "" ""
check_lunch "--" "" "" ""
check_lunch "-userdebug" "" "" ""
check_lunch "-userdebug-" "" "" ""
check_lunch "-userdebug-$valid_version" "" "" ""
check_lunch "aosp_arm64-userdebug-$valid_version-" "" "" ""
check_lunch "aosp_arm64-userdebug-$valid_version-abc" "" "" ""