From ffb31afdacc5bd4e79930c36aa00f53c7bb022bb Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Wed, 1 Mar 2023 19:46:18 +0000 Subject: Support two active sdks in EffectiveVersionString Currently it would return the default one even if the requested one is an active sdk. Bug: 270609292 Test: go test ./java Test: built `rkpdapp` locally in internal and verified that its targetSdkVersion is U and V Test: TH Change-Id: Idb03ff4786ff87fb7911bf31205941618a662404 --- java/app_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'java/app_test.go') diff --git a/java/app_test.go b/java/app_test.go index c77f29d23..5b16cea28 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -1005,6 +1005,7 @@ func TestAppSdkVersion(t *testing.T) { platformSdkInt int platformSdkCodename string platformSdkFinal bool + minSdkVersionBp string expectedMinSdkVersion string platformApis bool activeCodenames []string @@ -1052,6 +1053,14 @@ func TestAppSdkVersion(t *testing.T) { platformSdkCodename: "S", activeCodenames: []string{"S"}, }, + { + name: "two active SDKs", + sdkVersion: "module_current", + minSdkVersionBp: "UpsideDownCake", + expectedMinSdkVersion: "UpsideDownCake", // And not VanillaIceCream + platformSdkCodename: "VanillaIceCream", + activeCodenames: []string{"UpsideDownCake", "VanillaIceCream"}, + }, } for _, moduleType := range []string{"android_app", "android_library"} { @@ -1061,12 +1070,17 @@ func TestAppSdkVersion(t *testing.T) { if test.platformApis { platformApiProp = "platform_apis: true," } + minSdkVersionProp := "" + if test.minSdkVersionBp != "" { + minSdkVersionProp = fmt.Sprintf(` min_sdk_version: "%s",`, test.minSdkVersionBp) + } bp := fmt.Sprintf(`%s { name: "foo", srcs: ["a.java"], sdk_version: "%s", %s - }`, moduleType, test.sdkVersion, platformApiProp) + %s + }`, moduleType, test.sdkVersion, platformApiProp, minSdkVersionProp) result := android.GroupFixturePreparers( prepareForJavaTest, -- cgit v1.2.3-59-g8ed1b