Commit Graph

96 Commits

Author SHA1 Message Date
Paul Duffin
5c78b6d3d6 Merge "Move populate_stubs into LEGACY BuildRelease" am: 2a5e1b5e4e am: f319429eae
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032131

Change-Id: I410cce669f16fac8ee6a30c08a7d312718b5a06b
2022-03-23 10:07:22 +00:00
Paul Duffin
6e6569d1ab Merge "Decouple population of the dist dir from the SnapshotBuilder" am: 726f9ab1bf
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032132

Change-Id: Iebaf30eb3d8b4b8435d6ed201229ed3a44a4e058
2022-03-23 09:50:25 +00:00
Paul Duffin
f319429eae Merge "Move populate_stubs into LEGACY BuildRelease" am: 2a5e1b5e4e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032131

Change-Id: I3ca94c8308138e7a3a467e671fc86db137237a28
2022-03-23 09:50:13 +00:00
Paul Duffin
6a07a5309f Extract unzip_current_stubs from SdkDistProducer am: dc0c4c5d3f am: fbcf0717cc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032130

Change-Id: I0005af509de48a6ce284bc0ac48545ffe1fed0fe
2022-03-21 14:39:37 +00:00
Paul Duffin
cee7573bc6 Add --build-release option to mainline_modules_sdks.sh am: 14c6bd8c38 am: aee5bf605a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032129

Change-Id: I755749ceef97928aa9d962e9de81770dfc9ec23d
2022-03-21 14:39:28 +00:00
Paul Duffin
fbcf0717cc Extract unzip_current_stubs from SdkDistProducer am: dc0c4c5d3f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032130

Change-Id: I7455692f354b4feb729c5c5934cef1a1a61310ff
2022-03-21 14:24:27 +00:00
Paul Duffin
aee5bf605a Add --build-release option to mainline_modules_sdks.sh am: 14c6bd8c38
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032129

Change-Id: I754e7e884cf926e8657d9c8b176628bb780da9d9
2022-03-21 14:24:18 +00:00
Paul Duffin
48e7f7d7d0 Decouple population of the dist dir from the SnapshotBuilder
Previously, the code for populating the dist directory, e.g.
populate_dist and create_legacy_dist_structures assumed that the sdk
snapshot files they needed could be found in the directory referenced
by SnapshotBuilder.mainline_sdks_dir. This change removes that
assumption and instead passes the snapshot_dirs directory into the
populate_dist method and uses it in the create_legacy_dist_structures
function.

This refactoring is needed to allow a follow up change to construct a
set of sdk snapshot files in a different directory while still using
the populate_dist method to copy them into the correct location in the
dist directory.

Bug: 218685706
Test: atest --host mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      pyformat -s 4 --force_quote_type double -i build/mainline_modules_sdks*.py
      /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc build/mainline_modules_sdks*.py
Change-Id: I9fb659df28d7688b3f081bf84f5fae8ee85dc534
2022-03-21 12:53:16 +00:00
Paul Duffin
04b51993d5 Move populate_stubs into LEGACY BuildRelease
Previously, the populate_stubs was handled specially in produce_dist.
However, it is LEGACY behavior and so it makes sense to move the
code into the LEGACY BuildRelease's creator function.

While testing, the script failed because the LEGACY BuildRelease does
not build the snapshots, it assumes that the LEGACY is always run after
LATEST. This change makes the LEGACY build the snapshots. In normal use
it will not cause any increase in build time as it will always run
after LATEST and build the snapshots with the same environment turning
the build command into a no-op.

Bug: 218685706
Test: rm -fr out/soong/mainline-sdks
      packages/modules/common/build/mainline_modules_sdks.sh --build-release=LEGACY
      # Before this change it fails due to missing files, after it works.
      pyformat -s 4 --force_quote_type double -i build/mainline_modules_sdks*.py
      /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc build/mainline_modules_sdks*.py
Change-Id: Iaa2f9f71dd5085965d3ad32110b324453df87ee6
2022-03-21 12:53:16 +00:00
Paul Duffin
dc0c4c5d3f Extract unzip_current_stubs from SdkDistProducer
A minor refactoring that generalizes the method, making it usable for
other cases and decouples it from SdkDistProducer and SnapshotBuilder.

Bug: 218685706
Test: atest --host mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      pyformat -s 4 --force_quote_type double -i build/mainline_modules_sdks*.py
      /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc build/mainline_modules_sdks*.py
Change-Id: I885b7d0e792691f7028cdfb91e72896be48333a1
2022-03-21 12:53:16 +00:00
Paul Duffin
14c6bd8c38 Add --build-release option to mainline_modules_sdks.sh
This change makes it easier to test the behavior of specific build
releases.

Bug: 218685706
Test: atest --host mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      packages/modules/common/build/mainline_modules_sdks.sh --build-release=S --build-release=latest
      pyformat -s 4 --force_quote_type double -i build/mainline_modules_sdks*.py
      /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc build/mainline_modules_sdks*.py
Change-Id: Ib9ef2f35d27d10cd960c4b6225417d930cb10afc
2022-03-21 12:53:14 +00:00
Paul Duffin
f9fd1430c5 Improve testing of mainline_modules_sdks.py am: de60aeb525 am: 54573b92c4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032128

Change-Id: Idded48ba06edd50485e9ac2b8c8231ef3b0519ac
2022-03-21 12:35:08 +00:00
Paul Duffin
dab41503d5 Cleanup pylint errors in mainline_modules_sdks*.py am: 4f192a156b am: 1a02635227
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032127

Change-Id: Ic261a74a102d46c9cca6986bf8172475c62582d4
2022-03-21 12:35:06 +00:00
Paul Duffin
54573b92c4 Improve testing of mainline_modules_sdks.py am: de60aeb525
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032128

Change-Id: Id3c26e1876d532a398eec54013349c1834eea99f
2022-03-21 12:00:34 +00:00
Paul Duffin
1a02635227 Cleanup pylint errors in mainline_modules_sdks*.py am: 4f192a156b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2032127

Change-Id: Iad68e03c056473f19ea146de2417c0abc7848623
2022-03-21 12:00:31 +00:00
Paul Duffin
de60aeb525 Improve testing of mainline_modules_sdks.py
Adds a test for a com.google name module and makes the structure of the
test snapshot created by FakeSnapshotBuilder.create_snapshot_file()
match the names used in an actual sdk snapshot.

Bug: 218685706
Test: atest --host mainline_modules_sdks_test
      pyformat -s 4 --force_quote_type double -i build/mainline_modules_sdks*.py
      /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc build/mainline_modules_sdks*.py
Change-Id: Ia11cbb2da717218ba0b2da9a2238856dc8cebf8f
2022-03-18 15:59:33 +00:00
Paul Duffin
4f192a156b Cleanup pylint errors in mainline_modules_sdks*.py
Bug: 218685706
Test: atest --host mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      pyformat -s 4 --force_quote_type double -i build/mainline_modules_sdks*.py
      /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc build/mainline_modules_sdks*.py
Change-Id: I5ba3da7dcde6d44b1855b41bac8eb80e0f3a593c
2022-03-18 15:58:57 +00:00
Anton Kulakov
9c7cd416a2 Add AdServices in mainline_modules_sdks.py
Ignore-AOSP-First: The module is not in AOSP yet
Test: Build
Bug: 223771864
Change-Id: I89817d2aab035394a630d1af4b6575b95c9f0a7e
2022-03-10 11:56:28 +00:00
Cole Faust
6bfe973823 Merge "Don't explicitly mention SOONG_CONFIG_ variables" am: 9f8ee5f71f am: fb6f9fe611
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2002776

Change-Id: I8d48d180f6d07175d0cac5d4ab204569bfd8bcff
2022-03-02 19:42:55 +00:00
Cole Faust
fb6f9fe611 Merge "Don't explicitly mention SOONG_CONFIG_ variables" am: 9f8ee5f71f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2002776

Change-Id: Ied2313893373aa3810c28e578813964c2c79b625
2022-03-02 19:20:06 +00:00
Cole Faust
2f9bf4a102 Don't explicitly mention SOONG_CONFIG_ variables
The soong config variables should be controlled via
$(call soong_config_set/get) instead of using the
underlaying variable. Update the comments in the
auto generated makefiles to reflect that.

Bug: 220940864
Test: m mainline_modules_sdks_test && /ssd/aosp-master/out/host/linux-x86/nativetest64/mainline_modules_sdks_test/mainline_modules_sdks_test
Change-Id: I8907d89ceb12e0a1e9ce53220a784e4a69502687
2022-02-28 16:51:32 -08:00
Paul Duffin
b4610ab6ae Set first_release for odp to Tiramisu
Ignore-AOSP-First: The module is not in AOSP yet
Test: packages/modules/common/mainline_modules_sdks.py
Bug: 218749359
Change-Id: Ic0b7c9de5582907b43666ce13e327595942d9da4
2022-02-18 17:38:53 +00:00
Paul Duffin
8bfda18d42 Add Tiramisu build release am: 654d81ef49 am: 949d682f7f am: 2dbd8916a2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1990896

Change-Id: I16521959002dc63c2320e3b48001e0927c0c43a5
2022-02-18 17:04:11 +00:00
Paul Duffin
8aae79f5c7 Add Tiramisu build release am: 654d81ef49
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1990896

Change-Id: I8bee2fd4f162120b28620466aa70572ca1aca36b
2022-02-18 16:05:39 +00:00
Paul Duffin
654d81ef49 Add Tiramisu build release
Bug: 204763318
Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      tree out/dist/mainline-sdks out/dist/stubs
      - check that it adds the for-Tiramisu-build directory but is
        otherwise identical to what was produced before this change.
      - check that the for-Tiramisu-build directory contains zip
        files that include the new in T annotations property.
Change-Id: I4bd8c1350101d84644a7a63f2632634b8c9a488b
2022-02-18 14:28:36 +00:00
Frank Wang
a366bc3a4e Add ondevicepersonalization in mainline_modules_sdks.py
Ignore-AOSP-First: The module is not in AOSP yet
Test: Build
Bug: 218749359
Change-Id: I2f892d12611f0d3d7d8ef6c13d5997fb85a899e7
2022-02-17 18:29:22 +00:00
Paul Duffin
5d9320c9f8 Merge "Support building build target specific snapshots" am: 27aef8152b am: 6df607c0d0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1958805

Change-Id: I0f6b1a760de06a9ecb35c2156a07c021d03cace5
2022-02-10 14:57:18 +00:00
Paul Duffin
6df607c0d0 Merge "Support building build target specific snapshots" am: 27aef8152b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1958805

Change-Id: Ic6d998f91943e25964b3e2868dfc304a2f80089b
2022-02-10 14:40:23 +00:00
Paul Duffin
01ea57c593 Support building build target specific snapshots
This changes adds support for building target build release specific
snapshots.

It adds a BuildRelease class that defines the characteristics of the
build release, e.g. name, how to create it, etc. It also adds a
first_release field to MainlineModule which specifies the first
BuildRelease for which a snapshot of the module is required and
initializes that field for each module.

After these changes this script will generate:
1. A legacy set of snapshots that match the file structure that was
   generated without this change. This is intended to allow existing
   consumers of the generated artifacts to continue to work while they
   are modified to make use of target build release specific snapshots.

2. The set of snapshots for the latest build release, i.e. the build
   release containing the source from which the snapshots are produced.
   This includes snapshots for all the modules.

3. For each build release from S onwards a set of snapshots for the
   modules it supports.

It does not currently generate snapshots for Q and R releases as Soong
cannot generate a compatible snapshot for them. If it is necessary to
generate snapshots for those target build releases (similar to what the
packages/modules/common/generate_ml_bundle.sh would produce) then a
follow up change will add that capability to this script.

Bug: 204763318
Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      tree out/dist/mainline-sdks out/dist/stubs
      - check that it adds the for-latest-build directory but is
        otherwise identical to what was produced before this change.
Change-Id: I48eb0b69cbe8664106b826ee0898557c98e039c2
2022-02-07 14:12:17 +00:00
Paul Duffin
40c09bc728 Move MAINLINE_MODULE_BY_APEX into the test file am: 300ec921e5 am: 19e34a43a1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1957400

Change-Id: Ic47bc18230ee4002d288cbe8d67417e1e7d071b4
2022-01-24 14:22:29 +00:00
Paul Duffin
1069442940 Split populate_stubs out of populate_dist am: 661845d4ec am: 13e3e100e1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1957399

Change-Id: Iab3a52d3ad897a581c4ba6ac83cacdc3b669ae6e
2022-01-24 14:22:28 +00:00
Paul Duffin
fa7baea7c3 Extract logic for building the snapshots to improve testability am: f5245ce53d am: 86ef162110
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1954695

Change-Id: I834a2f757a3cd2352b46f17685028cf0fa1148b5
2022-01-24 14:22:27 +00:00
Paul Duffin
0a7a139149 Extract subprocess run calls into SubprocessRunner am: b349358ae2 am: d2b40e7550
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1954694

Change-Id: I3589eb7d41f3cf96699759c1cc5a8bb336a967d3
2022-01-24 14:22:27 +00:00
Paul Duffin
19e34a43a1 Move MAINLINE_MODULE_BY_APEX into the test file am: 300ec921e5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1957400

Change-Id: I67d0b71ba28450ea254080e293d5a5994d7f9fbe
2022-01-24 14:06:33 +00:00
Paul Duffin
13e3e100e1 Split populate_stubs out of populate_dist am: 661845d4ec
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1957399

Change-Id: If7b7efe09606f7fa2f9219d360baa74fcada825e
2022-01-24 14:06:32 +00:00
Paul Duffin
86ef162110 Extract logic for building the snapshots to improve testability am: f5245ce53d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1954695

Change-Id: Ia8be7376929a0cc29074b31562c7e888fce371d5
2022-01-24 14:06:31 +00:00
Paul Duffin
d2b40e7550 Extract subprocess run calls into SubprocessRunner am: b349358ae2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/1954694

Change-Id: I5f65d36f33595f90f24f565a7c2dc9eceb602ac2
2022-01-24 14:06:31 +00:00
Paul Duffin
300ec921e5 Move MAINLINE_MODULE_BY_APEX into the test file
The variable is only used by the tests.

Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      tree out/dist/mainline-sdks out/dist/stubs
      - check that it is identical to before this change
Bug: 204763318
Change-Id: I38c4ce218825d79de831868af814c43ce8a6d60f
2022-01-21 19:36:46 +00:00
Paul Duffin
661845d4ec Split populate_stubs out of populate_dist
Separates the logic from populate_dist which handles the legacy stubs
directory into its own populate_stubs directory. That is in preparation
for calling populate_dist multiple times to create sdk snapshots for
different build releases.

Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      tree out/dist/mainline-sdks out/dist/stubs
      - check that it is identical to before this change
Bug: 204763318
Change-Id: Idada531b7f88dee3fea861a059a0773bc983853d
2022-01-21 19:36:46 +00:00
Paul Duffin
f5245ce53d Extract logic for building the snapshots to improve testability
Previously, the produce_dist() method of SdkDistProducer was not
testable because it attempted to invoke Soong to build the sdk
snapshots. So, the TestPopulateDist tested the populate_dist() method
instead. That was a problem because it meant that future changes to
the produce_dist() method could not be tested, at least not without
duplicating its functionality.

This change extracts the logic for building the snapshots (i.e. the
code that invokes soong to build the snapshot files) from the
SdkDistProducer into a separate SnapshotBuilder class. That allows
the test to substitute a FakeSnapshotBuilder that generates some fake
sdk snapshot zip files and call produce_dist() instead of calling
populate_dist() and populate_stubs().

It also renames the test to TestProduceDist to reflect that change.

This is part of a larger refactoring to improve the testability of the
mainline_modules_sdks.py file in preparation for adding support for
building build release specific snapshots.

Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      tree out/dist/mainline-sdks out/dist/stubs
      - check that it is identical to before this change
Bug: 204763318
Change-Id: Icf2e4b0200cc53863e45cf68208fbc8ec13c6f2c
2022-01-21 19:36:46 +00:00
Paul Duffin
b349358ae2 Extract subprocess run calls into SubprocessRunner
The SdkDistProducer has special stdout/stderr objects to pass to the
subprocess.run. This change extracts the handling of stdout/stderr into
the SubprocessRunner class to allow it to be more easily reused.

This is part of a larger refactoring to improve the testability of the
mainline_modules_sdks.py file in preparation for adding support for
building build release specific snapshots.

Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      tree out/dist/mainline-sdks out/dist/stubs
      - check that it is identical to before this change
Change-Id: If40199551934b0620953a2e4e3cefcb61282f051
2022-01-21 19:36:46 +00:00
Paul Duffin
092b9fdcfc Add internal only modules to standard module list
Adds the com.android.uwb and com.android.scheduling modules to the
standard list of modules. This ensures that when they are released to
AOSP that the packages/modules/common/build/mainline_modules_sdks.sh
build script will build them correctly.

Ignore-AOSP-First: internal only changes.

Bug: 204763318
Test: vendor/google/build/mainline_modules_sdks.sh
      atest mainline_modules_sdks_test
Merged-In: Idd83a71c477422ddf35d32f0f72293ac6f8626cd
Change-Id: Idd83a71c477422ddf35d32f0f72293ac6f8626cd
(cherry picked from commit adb67d1944)
2022-01-19 12:41:41 +00:00
Paul Duffin
adb67d1944 Add internal only modules to standard module list
Adds the com.android.uwb and com.android.scheduling modules to the
standard list of modules. This ensures that when they are released to
AOSP that the packages/modules/common/build/mainline_modules_sdks.sh
build script will build them correctly.

Ignore-AOSP-First: internal only changes.

Bug: 204763318
Test: vendor/google/build/mainline_modules_sdks.sh
      atest mainline_modules_sdks_test
Change-Id: Idd83a71c477422ddf35d32f0f72293ac6f8626cd
2022-01-19 10:04:06 +00:00
satayev
5511d9becd Simplify main function for mainline_modules_sdks.py
Bug: 205100626
Test: presubmit
Change-Id: I2fdd371aad6a9c37703a190754604da2d86975b2
Merged-In: I2fdd371aad6a9c37703a190754604da2d86975b2
(cherry picked from commit a584ab5dc0)
2021-11-26 12:36:52 +00:00
satayev
a584ab5dc0 Simplify main function for mainline_modules_sdks.py
Bug: 205100626
Test: presubmit
Ignore-AOSP-First: internal topic. will cp later
Change-Id: I2fdd371aad6a9c37703a190754604da2d86975b2
2021-11-24 18:58:21 +00:00
satayev
51133ffa60 Add mainline_modules_sdks to packages/modules/common/.
Change the list of modules to match AOSP list.

Bug: 205100626
Test: atest mainline_modules_sdks_test
Change-Id: I250c4aafcda5c3c1d636dac27ff5ffaa78b69b2a
2021-11-04 14:48:39 +00:00