summaryrefslogtreecommitdiff
path: root/java/prebuilt_apis_test.go
diff options
context:
space:
mode:
author Todd Lee <leetodd@google.com> 2023-08-25 18:02:13 +0000
committer Todd Lee <leetodd@google.com> 2023-08-25 18:03:44 +0000
commit2ec7e1c55c327f72f963df88c5a36e85885b1f67 (patch)
tree4d52e57c02d73c8ea75ed2601dee09c01e9ba9c7 /java/prebuilt_apis_test.go
parent1725b20d144e7f7054e63f88e297c5461e6dbe9e (diff)
Support for incremetal platform prebuilt APIs
This change provides support for prebuilt incremental platform API (i.e. API changes associated with a QPR, as opposed to a major dessert releas). This feature is provided via the existing prebuilt_apis module with the introduction of a new attribute: allow_incremental_platform_api While typical platform prebuilt APIs are presumed to be under a directory structure that follows the pattern: <version>/<scope>/<module>.jar <version>/<scope>/api/<module>.txt Where <version> is limited to a single integer signifying the API level. For modules where allow_incremental_platform_api is set to 'true' (false by default) the pattern is the same, however <version> is presumed to be of the form MM.m, where MM aligns with the existing API level and m signifies the incremental release (e.g. QPR). Bug: b/280790094 Test: platform build check with both incremental & non-incremental API cd build/soong && go test ./java (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:eee6995093485497bc29cdce01c2a86765ffb4eb) Change-Id: I67e293006ccfa210d0dcc0a294db894632f1b6cb
Diffstat (limited to 'java/prebuilt_apis_test.go')
-rw-r--r--java/prebuilt_apis_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/java/prebuilt_apis_test.go b/java/prebuilt_apis_test.go
index 2b8435325..b6fb2c6bf 100644
--- a/java/prebuilt_apis_test.go
+++ b/java/prebuilt_apis_test.go
@@ -99,3 +99,26 @@ func TestPrebuiltApis_WithExtensions(t *testing.T) {
android.AssertStringEquals(t, "Expected latest bar = extension level 2", "prebuilts/sdk/extensions/2/public/api/bar.txt", bar_input)
android.AssertStringEquals(t, "Expected latest baz = api level 32", "prebuilts/sdk/32/public/api/baz.txt", baz_input)
}
+
+func TestPrebuiltApis_WithIncrementalApi(t *testing.T) {
+ runTestWithIncrementalApi := func() (foo_input, bar_input, baz_input string) {
+ result := android.GroupFixturePreparers(
+ prepareForJavaTest,
+ FixtureWithPrebuiltIncrementalApis(map[string][]string{
+ "33.0": {"foo"},
+ "33.1": {"foo", "bar", "baz"},
+ "33.2": {"foo", "bar"},
+ "current": {"foo", "bar"},
+ }),
+ ).RunTest(t)
+ foo_input = result.ModuleForTests("foo.api.public.latest", "").Rule("generator").Implicits[0].String()
+ bar_input = result.ModuleForTests("bar.api.public.latest", "").Rule("generator").Implicits[0].String()
+ baz_input = result.ModuleForTests("baz.api.public.latest", "").Rule("generator").Implicits[0].String()
+ return
+ }
+ // 33.1 is the latest for baz, 33.2 is the latest for both foo & bar
+ foo_input, bar_input, baz_input := runTestWithIncrementalApi()
+ android.AssertStringEquals(t, "Expected latest foo = api level 33.2", "prebuilts/sdk/33.2/public/api/foo.txt", foo_input)
+ android.AssertStringEquals(t, "Expected latest bar = api level 33.2", "prebuilts/sdk/33.2/public/api/bar.txt", bar_input)
+ android.AssertStringEquals(t, "Expected latest baz = api level 33.1", "prebuilts/sdk/33.1/public/api/baz.txt", baz_input)
+}