From 530d237a82373a2a45048906337a73909d012061 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 24 Nov 2023 14:16:12 +0000 Subject: [PATCH] Add next BuildRelease for use by SDK finalization Currently, the SDK finalization script consumes the SDK snapshots from the `for-latest-build` directory. However, in trunk stable that is no longer viable as that directory will include flagged APIs but the finalized SDK cannot use flagged APIs. It is not possible to remove flagged APIs from `for-latest-build` as the snapshots in there are dropped into Android itself and so must include flagged APIs. This change adds a new `NEXT` `BuildRelease` which will create a `for-next-build` that will contain SDK snapshots that do not contain flagged APIs. It also adds an `include_flagged_apis` property which is `False` for everything except `LATEST`. For now that property is for informational purposes but a follow up change will use it to determine whether the SDK snapshots include flagged APIs. A separate follow up change will modify the finalize script to use the `for-next-build` directory. It is done separately as it will take a while for this change to have an impact on the build targets that the finalize script consumes. Bug: 313065235 Test: packages/modules/common/build/mainline_modules_sdks.sh # Make sure that out/dist/mainline-sdks/for-next-build is # identical to for-latest-build. Change-Id: Ib6d18fda129d081e8bbc8bf148cb5d7f38c070ba --- build/mainline_modules_sdks.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build/mainline_modules_sdks.py b/build/mainline_modules_sdks.py index 027d01c..ece503c 100755 --- a/build/mainline_modules_sdks.py +++ b/build/mainline_modules_sdks.py @@ -708,6 +708,10 @@ class BuildRelease: preferHandling: PreferHandling = \ PreferHandling.USE_SOURCE_CONFIG_VAR_PROPERTY + # Whether the generated snapshots should include flagged APIs. Defaults to + # false because flagged APIs are not suitable for use outside Android. + include_flagged_apis: bool = False + def __post_init__(self): # The following use object.__setattr__ as this object is frozen and # attempting to set the fields directly would cause an exception to be @@ -809,6 +813,15 @@ UpsideDownCake = BuildRelease( # Insert additional BuildRelease definitions for following releases here, # before LATEST. +# A build release for the latest build excluding flagged apis. +NEXT = BuildRelease( + name="next", + creator=create_latest_sdk_snapshots, + # There are no build release specific environment variables to pass to + # Soong. + soong_env={}, +) + # The build release for the latest build supported by this build, i.e. the # current build. This must be the last BuildRelease defined in this script. LATEST = BuildRelease( @@ -817,6 +830,9 @@ LATEST = BuildRelease( # There are no build release specific environment variables to pass to # Soong. soong_env={}, + # Latest must include flagged APIs because it may be dropped into the main + # Android branches. + include_flagged_apis=True, )