Commit Graph

10 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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