Commit aec22778 authored by Samuel Huang's avatar Samuel Huang Committed by Commit Bot

[SuperSize] Basic refactoring to archive with multiple containers.

To accommodate .aab files and TriChrome, we'd like SuperSize to handle
multiple "containers" and store data in a single .size file.

This CL performs refactoring archive.py to prepare for extending
SuperSize for multiple containers. Details:
* Move temp-file extraction logic with |args.minimal_apks_file| depper,
  into _DeduceMainPaths().
  * Remove |args.extracted_minimal_apk_path|.
* CreateSizeInfo():
  * Change params to take lists of
    {metadata, section_sizes, raw_symbols}.
  * Implementation TODO; keep old behavior by simply using the first
    element of the above.
* _DeduceMainPaths():
  * Change to a generator that yield multiple param sets, one for each
    container.
  * Resolve |apk_prefix| and |apk_path| as separate concepts.
  * Move most of the logic to _Inner() function.
  * Split out _DeduceAuxPaths().
* Run():
  * Merge with _RunInternal().
  * Main action changes:
    * Visits param sets generated from _DeduceMainPaths().
    * Potentially create multiple
      {metadata, section_sizes, raw_symbols},
      now stored into |*_list| variables.

Bug: 900259, 1040645
Change-Id: Ib158f3d5c8b11567f09826fd0c0b31729f4e065c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2125388Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754466}
parent 563b12d3
This diff is collapsed.
......@@ -233,13 +233,15 @@ def _SaveSizeInfoToFile(size_info,
Args:
size_info: Data to write to the file
file_obj: File opened for writing
sparse_symbols: If present, only save these symbols to the file
file_obj: File opened for writing.
include_padding: Whether to save padding data, useful if adding a subset of
symbols.
sparse_symbols: If present, only save these symbols to the file.
"""
if sparse_symbols is not None:
# Any aliases of sparse symbols must also be included, or else file parsing
# will attribute symbols that happen to follow an incomplete alias group to
# that alias group.
# Any aliases of sparse symbols must also be included, or else file
# parsing will attribute symbols that happen to follow an incomplete alias
# group to that alias group.
raw_symbols = _ExpandSparseSymbols(sparse_symbols)
else:
raw_symbols = size_info.raw_symbols
......@@ -362,7 +364,7 @@ def _ReadValuesFromLine(file_iter, split):
def _LoadSizeInfoFromFile(file_obj, size_path):
"""Loads a size_info from the given file.
See _SaveSizeInfoToFile for details on the .size file format.
See _SaveSizeInfoToFile() for details on the .size file format.
Args:
file_obj: File to read, should be a GzipFile
......
......@@ -216,7 +216,7 @@ class IntegrationTest(unittest.TestCase):
size_info_prefix=size_info_prefix,
knobs=knobs)
IntegrationTest.cached_size_info[cache_key] = archive.CreateSizeInfo(
section_sizes, raw_symbols, metadata=metadata)
[section_sizes], [raw_symbols], [metadata])
return copy.deepcopy(IntegrationTest.cached_size_info[cache_key])
def _DoArchive(self,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment