Merge "releasetools: PRESIGNED APEX container entails PRESIGNED payload."
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 9692a99..6a76fc4 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -51,6 +51,13 @@
$(intermediates.COMMON)/jacoco-report-classes.jar)
endif
+ifdef LOCAL_SOONG_PROGUARD_DICT
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
+ $(intermediates.COMMON)/proguard_dictionary))
+ $(call add-dependency,$(LOCAL_BUILT_MODULE),\
+ $(intermediates.COMMON)/proguard_dictionary)
+endif
+
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
my_res_package := $(intermediates.COMMON)/package-res.apk
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 941ef65..e1105bb 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -15,11 +15,18 @@
# limitations under the License.
"""
-Given a target-files zipfile, produces an image zipfile suitable for
-use with 'fastboot update'.
+Given target-files, produces an image zipfile suitable for use
+with 'fastboot update'.
Usage: img_from_target_files [flags] input_target_files output_image_zip
+input_target_files: one of the following:
+ - directory containing extracted target files. It will load info from
+ OTA/android-info.txt and build the image zipfile using images from IMAGES/.
+ - target files package. Same as above, but extracts the archive before
+ building the image zipfile.
+
+Flags:
-z (--bootable_zip)
Include only the bootable images (eg 'boot' and 'recovery') in
the output.
@@ -76,7 +83,16 @@
common.InitLogging()
- OPTIONS.input_tmp = common.UnzipTemp(args[0], ["IMAGES/*", "OTA/*"])
+ target_files = args[0]
+ if os.path.isdir(target_files):
+ logger.info("Building image zip from extracted target files.")
+ OPTIONS.input_tmp = target_files
+ elif zipfile.is_zipfile(target_files):
+ logger.info("Building image zip from target files zip.")
+ OPTIONS.input_tmp = common.UnzipTemp(args[0], ["IMAGES/*", "OTA/*"])
+ else:
+ raise ValueError("%s is not a valid path." % target_files)
+
output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
CopyInfo(output_zip)
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index 2e5cbca..0902d90 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -698,6 +698,16 @@
if output_super_empty:
shutil.copyfile(super_empty_img, output_super_empty)
+ # Create the IMG package from the merged target files (before zipping, in
+ # order to avoid an unnecessary unzip and copy).
+
+ if output_img:
+ img_from_target_files_args = [
+ output_target_files_temp_dir,
+ output_img,
+ ]
+ img_from_target_files.main(img_from_target_files_args)
+
# Finally, create the output target files zip archive and/or copy the
# output items to the output target files directory.
@@ -751,14 +761,6 @@
]
ota_from_target_files.main(ota_from_target_files_args)
- # Create the IMG package from the merged target files package.
-
- if output_img:
- img_from_target_files_args = [
- output_zip,
- output_img,
- ]
- img_from_target_files.main(img_from_target_files_args)
def call_func_with_temp_dir(func, keep_tmp):