forked from openkylin/platform_build
releasetools: Use java_path in sign_target_files_apks.py.
Prior to this CL, it was calling the hard-coded "java" although it was
accepting a "--java_path" option.
Also switch OPTIONS.java_args from string to list. Otherwise it won't
work when providing multiple args.
Bug: 32737832
Test: Specify "--java_path=" and "--java_args" when invoking
sign_target_files_apks.py with "-v". Check the commands being
called.
Change-Id: Id7ef98e778646d532027434de7fba9b7a104dbd0
(cherry picked from commit e95540e060
)
This commit is contained in:
parent
c7814837a0
commit
cd4f7c96c0
|
@ -46,7 +46,7 @@ class Options(object):
|
||||||
self.signapk_shared_library_path = "lib64" # Relative to search_path
|
self.signapk_shared_library_path = "lib64" # Relative to search_path
|
||||||
self.extra_signapk_args = []
|
self.extra_signapk_args = []
|
||||||
self.java_path = "java" # Use the one on the path by default.
|
self.java_path = "java" # Use the one on the path by default.
|
||||||
self.java_args = "-Xmx2048m" # JVM Args
|
self.java_args = ["-Xmx2048m"] # The default JVM args.
|
||||||
self.public_key_suffix = ".x509.pem"
|
self.public_key_suffix = ".x509.pem"
|
||||||
self.private_key_suffix = ".pk8"
|
self.private_key_suffix = ".pk8"
|
||||||
# use otatools built boot_signer by default
|
# use otatools built boot_signer by default
|
||||||
|
@ -702,11 +702,10 @@ def SignFile(input_name, output_name, key, password, min_api_level=None,
|
||||||
java_library_path = os.path.join(
|
java_library_path = os.path.join(
|
||||||
OPTIONS.search_path, OPTIONS.signapk_shared_library_path)
|
OPTIONS.search_path, OPTIONS.signapk_shared_library_path)
|
||||||
|
|
||||||
cmd = [OPTIONS.java_path, OPTIONS.java_args,
|
cmd = ([OPTIONS.java_path] + OPTIONS.java_args +
|
||||||
"-Djava.library.path=" + java_library_path,
|
["-Djava.library.path=" + java_library_path,
|
||||||
"-jar",
|
"-jar", os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)] +
|
||||||
os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)]
|
OPTIONS.extra_signapk_args)
|
||||||
cmd.extend(OPTIONS.extra_signapk_args)
|
|
||||||
if whole_file:
|
if whole_file:
|
||||||
cmd.append("-w")
|
cmd.append("-w")
|
||||||
|
|
||||||
|
@ -862,7 +861,7 @@ def ParseOptions(argv,
|
||||||
elif o in ("--java_path",):
|
elif o in ("--java_path",):
|
||||||
OPTIONS.java_path = a
|
OPTIONS.java_path = a
|
||||||
elif o in ("--java_args",):
|
elif o in ("--java_args",):
|
||||||
OPTIONS.java_args = a
|
OPTIONS.java_args = shlex.split(a)
|
||||||
elif o in ("--public_key_suffix",):
|
elif o in ("--public_key_suffix",):
|
||||||
OPTIONS.public_key_suffix = a
|
OPTIONS.public_key_suffix = a
|
||||||
elif o in ("--private_key_suffix",):
|
elif o in ("--private_key_suffix",):
|
||||||
|
|
|
@ -403,11 +403,11 @@ def ReplaceOtaKeys(input_tf_zip, output_tf_zip, misc_info):
|
||||||
# recovery uses a version of the key that has been slightly
|
# recovery uses a version of the key that has been slightly
|
||||||
# predigested (by DumpPublicKey.java) and put in res/keys.
|
# predigested (by DumpPublicKey.java) and put in res/keys.
|
||||||
# extra_recovery_keys are used only in recovery.
|
# extra_recovery_keys are used only in recovery.
|
||||||
|
cmd = ([OPTIONS.java_path] + OPTIONS.java_args +
|
||||||
p = common.Run(["java", "-jar",
|
["-jar",
|
||||||
os.path.join(OPTIONS.search_path, "framework", "dumpkey.jar")]
|
os.path.join(OPTIONS.search_path, "framework", "dumpkey.jar")] +
|
||||||
+ mapped_keys + extra_recovery_keys,
|
mapped_keys + extra_recovery_keys)
|
||||||
stdout=subprocess.PIPE)
|
p = common.Run(cmd, stdout=subprocess.PIPE)
|
||||||
new_recovery_keys, _ = p.communicate()
|
new_recovery_keys, _ = p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise common.ExternalError("failed to run dumpkeys")
|
raise common.ExternalError("failed to run dumpkeys")
|
||||||
|
|
Loading…
Reference in New Issue