Commit graph

7 commits

Author SHA1 Message Date
Paul Duffin
03d2cef47b Add UpsideDownCake to the releases for which snapshots can be built
Bug: 249769908
Test: packages/modules/common/mainline_modules_sdks.sh
      # With modification to add UpsideDownCake to list of releases
      # to build with.
Change-Id: I050811e7d9a5d0a8cf54a42c03ad889defa3a251
2022-09-30 09:41:08 +01:00
Paul Duffin
42a49f1278 Add current build release
Previously, the build releases only included named releases so did not
have a way to represent the latest build release. This adds the current
build release (named after the current API level) to represent that.

Bug: 240406019
Test: m nothing
Change-Id: Ib8336da716b447448b23bc9684ce3be1ab78648a
2022-08-19 17:39:49 +00:00
Paul Duffin
e7babdbfe1 Use Tiramisu instead of T in supported_build_releases
Make this consistent with how code names are used in the rest of Soong.

Bug: 204763318
Test: m nothing
Change-Id: I1f2f40310df9d619db6aaaad3ed7339bb5e79194
2022-02-10 13:06:54 +00:00
Paul Duffin
106a3a4bec Allow pruning of unsupported fields in structs in maps
Adds support for traversing into a field that is of type:
   map[...]*struct{...}

This is needed to allow java_sdk_library to mark scope specific
properties, e.g. public.annotations as being target build release
specific.

It was necessary to change the Scope field from:
   Scope map[*apiScope]scopeProperties
to:
   Scope map[*apiScope]*scopeProperties

That is because there is no way in go to change the field of a struct
value of a map. i.e. you cannot do the following, not even using
reflection:
   Scope[apiScopePublic].AnnotationsZip = nil

Bug: 204763318
Test: m nothing
Change-Id: Id103f70f55d4202971321ef4925cbec4b55f8136
2022-01-31 12:28:04 +00:00
Paul Duffin
545c59273d Refactor build_release and test code
Minor restructuring of the build_release pruning code to make it easier
to add logic for handling fields of maps of structs. That includes:
1. Moving some code that is specific to clearing a selected field
   inside the associated if block.
2. Replacing an if with a switch.
3. Improving the error handling by separating the reporting of the
   container that broke from information about which field could not be
   set. That allows follow up code to provide information about the map
   key instead.

The tests were restructed by:
1. Switching from using AssertDeepEquals to compare the structs to
   comparing the output of marshalling the structs to JSON. That was
   for a couple of reasons. Firstly, because JSON will marshal (and so
   allow comparison of) the contents of pointers to structs whereas
   AssertDeepEquals will just compare the pointers themselves.
   Secondly, because JSON can pretty print the output and make it
   easier to read.
2. Using a func to create a new instance of the input structure for
   each test. That is to allow the test to modify the input structure,
   e.g. by clearing a field in a struct that is pointed to by a map.
   The test previously relied on the input structure being immutable
   and passed by value but a follow up change will change that by
   adding a map field that contains pointers to structs.

Bug: 204763318
Test: m nothing
Change-Id: I84dc99621497b7263e30466895b823eb02cb2b56
2022-01-31 12:28:04 +00:00
Paul Duffin
0c3acbfd72 Support pruning properties by build release
Adds a general mechanism for pruning selected sdk member properties
(i.e. setting their fields to their zero value) and uses that to prune
any properties that do not support a specified target build release.

Follow up changes will use that to allow building an sdk snapshot that
is compatible with previous release S.

Bug: 197842263
Test: m nothing
Change-Id: Ib949a9cfe85fff30f86228eeb15d3a45c073b037
2021-10-01 17:17:40 +01:00
Paul Duffin
1812294f32 Support handling build releases in sdk snapshot
Adds the following:
1. A buildRelease type to represent a single build release.
2. A buildReleaseSet type to represent a set of build releases.
3. Methods to create parse and use the previous new types.
4. Tests for the above.

Bug: 197842263
Test: m nothing
Change-Id: Ib0dd4fc32851a4fffde3fa02ea22c8369f8c2995
2021-10-01 17:17:34 +01:00