diff options
author | Paul Duffin <paulduffin@google.com> | 2022-03-17 17:39:57 +0000 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2022-03-21 12:53:16 +0000 |
commit | 48e7f7d7d0f13f3521f463d05e7e9840b79f1242 (patch) | |
tree | 27f7277b07960bea8a0ed4b90bac381f199941fe /build/mainline_modules_sdks_test.py | |
parent | 04b51993d5b3c3f941f32e0402947f9890384a6e (diff) | |
download | common-48e7f7d7d0f13f3521f463d05e7e9840b79f1242.tar.gz |
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
Diffstat (limited to 'build/mainline_modules_sdks_test.py')
-rw-r--r-- | build/mainline_modules_sdks_test.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/build/mainline_modules_sdks_test.py b/build/mainline_modules_sdks_test.py index 35603676..38a6e9e0 100644 --- a/build/mainline_modules_sdks_test.py +++ b/build/mainline_modules_sdks_test.py @@ -41,8 +41,8 @@ class FakeSnapshotBuilder(mm.SnapshotBuilder): z.writestr(f"sdk_library/public/{name}-stubs.jar", "") z.writestr(f"sdk_library/public/{name}.txt", "") - def create_snapshot_file(self, name, version): - zip_file = Path(self.get_sdk_path(name, version)) + def create_snapshot_file(self, out_dir, name, version): + zip_file = Path(mm.sdk_snapshot_zip_file(out_dir, name, version)) with zipfile.ZipFile(zip_file, "w") as z: z.writestr("Android.bp", "") if name.endswith("-sdk"): @@ -50,13 +50,14 @@ class FakeSnapshotBuilder(mm.SnapshotBuilder): def build_snapshots(self, build_release, sdk_versions, modules): # Create input file structure. - sdks_out_dir = Path(self.get_mainline_sdks_path()) + sdks_out_dir = Path(self.mainline_sdks_dir).joinpath("test") sdks_out_dir.mkdir(parents=True, exist_ok=True) # Create a fake sdk zip file for each module. for module in modules: for sdk in module.sdks: for sdk_version in sdk_versions: - self.create_snapshot_file(sdk, sdk_version) + self.create_snapshot_file(sdks_out_dir, sdk, sdk_version) + return sdks_out_dir class TestProduceDist(unittest.TestCase): |