Skip to content

Commit

Permalink
Only set TARGET_PLATFORM version in lunch when explicitly requested
Browse files Browse the repository at this point in the history
Setting TARGET_PLATFORM_VERSION to DEFAULT_PLATFORM_VERSION during
"lunch sailfish-userdebug" causes unnecessary pain when
DEFAULT_PLATFORM_VERSION becomes invalid after branching.  Only
set TARGET_PLATFORM_VERSION if it was explicitly requested with
lunch sailfish-userdebug-OPR1.

Test: build/make/tests/envsetup_tests.sh
Bug: 34972208
Bug: 37208937
Change-Id: I40ba4617e73803c5bec1a8d317382f70fb3ec3a2
Merged-In: I40ba4617e73803c5bec1a8d317382f70fb3ec3a2
  • Loading branch information
colincross committed May 3, 2017
1 parent 30c33b1 commit 1c1e142
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions core/version_defaults.mk
Expand Up @@ -49,6 +49,12 @@ ALLOWED_VERSIONS := $(call allowed-platform-versions,\

ifndef TARGET_PLATFORM_VERSION
TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
else ifeq ($(TARGET_PLATFORM_VERSION),OPR1)
# HACK: lunch currently sets TARGET_PLATFORM_VERSION to
# DEFAULT_PLATFORM_VERSION, which causes unnecessary pain
# when the old DEFAULT_PLATFORM_VERSION becomes invalid.
# For now, silently upgrade OPR1 to the current default.
TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
endif

ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION)))
Expand Down
6 changes: 5 additions & 1 deletion envsetup.sh
Expand Up @@ -608,7 +608,11 @@ function lunch()

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)
if [ -n "$version" ]; then
export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)
else
unset TARGET_PLATFORM_VERSION
fi
export TARGET_BUILD_TYPE=release

echo
Expand Down
5 changes: 3 additions & 2 deletions tests/envsetup_tests.sh
Expand Up @@ -19,8 +19,9 @@ 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" "aosp_arm64" "eng" ""
check_lunch "aosp_arm64-userdebug" "aosp_arm64" "userdebug" ""
check_lunch "aosp_arm64-userdebug-$default_version" "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" "" "" ""
Expand Down

0 comments on commit 1c1e142

Please sign in to comment.