aboutsummaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-03-22 00:41:03 (GMT)
committerColin Cross <ccross@android.com>2017-03-23 16:44:08 (GMT)
commit8873713f36c4b0a737947b31ea8e28300e6df759 (patch)
tree51ecb5243c3a413834c9da08d7604ed7e61abd96 /envsetup.sh
parent2c280271ac43f546023545f8921a418d370bbf1e (diff)
downloadandroid_build-8873713f36c4b0a737947b31ea8e28300e6df759.zip
android_build-8873713f36c4b0a737947b31ea8e28300e6df759.tar.gz
android_build-8873713f36c4b0a737947b31ea8e28300e6df759.tar.bz2
Add TARGET_PLATFORM_VERSION to lunch
lunch can now take combos in the form: $TARGET_PRODUCT $TARGET_PRODUCT-$TARGET_BUILD_VARIANT $TARGET_PRODUCT-$TARGET_BUILD_VARIANT-$TARGET_PLATFORM_VERSION If all 3 are not specified the unspecified ones will take the default values provided by the build system (eng, and currently OPR1). In addition, error handling for invalid products, variants and versions is moved to the build system. Bug: 34972208 Test: build/make/tests/envsetup_tests.sh Change-Id: Ib0aaa98633448ba9bd8df911704c9cb3a8ebbe85
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh48
1 files changed, 20 insertions, 28 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 9680780..22808f4 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -296,7 +296,7 @@ function set_stuff_for_environment()
function set_sequence_number()
{
- export BUILD_ENV_SEQUENCE_NUMBER=12
+ export BUILD_ENV_SEQUENCE_NUMBER=13
}
function settitle()
@@ -569,50 +569,42 @@ function lunch()
then
selection=${LUNCH_MENU_CHOICES[$(($answer-1))]}
fi
- elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$")
- then
+ else
selection=$answer
fi
- if [ -z "$selection" ]
- then
- echo
- echo "Invalid lunch combo: $answer"
- return 1
- fi
-
export TARGET_BUILD_APPS=
- local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
- check_variant $variant
- if [ $? -ne 0 ]
+ local product variant_and_version variant version
+
+ product=${selection%%-*} # Trim everything after first dash
+ variant_and_version=${selection#*-} # Trim everything up to first dash
+ if [ "$variant_and_version" != "$selection" ]; then
+ variant=${variant_and_version%%-*}
+ if [ "$variant" != "$variant_and_version" ]; then
+ version=${variant_and_version#*-}
+ fi
+ fi
+
+ if [ -z "$product" ]
then
echo
- echo "** Invalid variant: '$variant'"
- echo "** Must be one of ${VARIANT_CHOICES[@]}"
- variant=
+ echo "Invalid lunch combo: $selection"
+ return 1
fi
- local product=$(echo -n $selection | sed -e "s/-.*$//")
TARGET_PRODUCT=$product \
TARGET_BUILD_VARIANT=$variant \
+ TARGET_PLATFORM_VERSION=$version \
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
- echo
return 1
fi
- export TARGET_PRODUCT=$product
- export TARGET_BUILD_VARIANT=$variant
+ 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
echo