Previously, the snapshots would be built in the order in which the
build releases were defined. This change groups the snapshots with the
same build environment and builds them in sequence in order to minimize
the regeneration of the ninja files.
The test revealed that the produce_bundled_dist_for_build_release
method would call build_snapshots even if there were no bundled
snapshots needed which was a waste so that was also optimized as part
of this change.
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: I5bb8d864a50318b4b5390a8e5a3601aa33c18fef
Moves the generated Android.bp file from the root of the snapshot zip
file into the sdk_library/ sub-directory to allow the zip to be
unpacked in a directory that already contains an Android.bp file that
defines the apex_set for the corresponding APEX.
Also, removes the stubs_src property from the generated Android.bp
file.
Bug: 218685706
Test: packages/modules/common/build/mainline_modules_sdks.sh --build-release=R
atest --host mainline_modules_sdks_test
# deleted vendor/unbundled_google/modules/IpSecGooglePrebuilt from rvc-dev checkout.
# unpacked out/soong/mainline-sdks/for-R-build/ipsec-module-sdk-current.zip
# ran "m nothing"
Change-Id: I03e2060dc06338a8d0102744f79c75d33d567a17
Mainline.
These are used in the ART thin manifest. They are added here to allow
using the common module build scripts for them as well.
The Python script is extended to work for these modules, and their SDKs
end up in DIST_DIR/bundled-mainline-sdks, so DIST_DIR/mainline-sdks
only carries the SDKs for unbundled modules that are to be distributed
to partners etc.
This change has the effect to (re)enable building these SDKs in CI.
Test: env TARGET_BUILD_APPS="com.android.i18n com.android.runtime com.android.tzdata" \
packages/modules/common/build/mainline_modules_sdks.sh \
--build-platform-sdks-for-mainline --build-release=latest
Replace SDK snapshots under prebuilts/runtime/mainline with
those produced in out/dist/bundled-mainline-sdks
in a master-art tree, with https://r.android.com/2046463 applied,
then `banchan com.android.art && m`
Test: env -u TARGET_BUILD_APPS \
packages/modules/common/build/mainline_modules_sdks.sh \
--build-release=latest
Check that all SDKs are built, and that the bundled SDKs get copied
to out/dist/bundled-mainline-sdks so the contents of
out/dist/mainline-sdks and out/dist/stubs remain unchanged.
Test: env -u TARGET_BUILD_APPS \
packages/modules/common/build/mainline_modules_sdks.sh \
--build-release=S
Check that out/dist/bundled-mainline-sdks isn't producted.
Test: env -u TARGET_BUILD_APPS \
vendor/google/build/mainline_modules_sdks.sh
Check that all SDKs are built, and that the bundled SDKs get copied
to out/dist/bundled-mainline-sdks so the contents of
out/dist/mainline-sdks and out/dist/stubs remain unchanged.
Test: atest --host mainline_modules_sdks_test
Bug: 216762037
Change-Id: Ie6182fa42dc9c2c7f35ed95a040c05be0f0e878a
This change replicates the behavior of the generate_ml_bundle.sh that
creates an Android.bp file along with the necessary file structure for
an R build.
It adds the information needed to a ForRBuild object which is set on
those MainlineModules that need to provide SDKs for R. That includes
a list of SdkLibrary objects each of which has a name and a flag that
indicates whether it is a shared library.
The R BuildRelease creator function builds the sdk snapshots as normal
and then extracts information from those snapshot files to construct
snapshots suitable for an R build. It then passes the directory
containing those new snapshot files to populate_dist() which will then
copy them into the correct location in the dist directory.
For each MainlineModule that provides an SDK for R the following is
created in the out/soong/mainline-sdks/for-R-build directory:
* A sub-directory using the apex name containing:
* An Android.bp file with definitions for each SdkLibrary.
* A file structure containing API txt file, removed API txt file,
a srcjar containing the stub sources and a stubs jar.
* A zip file containing the contents of the previous directory whose
name is <sdk-name>-current.zip, to match the files that are
generated by Soong when building sdk snapshots.
As R does not support the Soong config boilerplate code that
transformation is disabled for R.
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: I70001782496a3e9805bf56181c0e08419e31e191
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
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
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
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
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
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
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
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
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
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
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
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
Change the list of modules to match AOSP list.
Bug: 205100626
Test: atest mainline_modules_sdks_test
Change-Id: I250c4aafcda5c3c1d636dac27ff5ffaa78b69b2a