• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import argparse
16import shlex
17
18
19def ParseSignerArgs(args):
20  if args is None:
21    return None
22  return shlex.split(args)
23
24
25def AddSigningArgumentParse(parser: argparse.ArgumentParser):
26  parser.add_argument('--java_path', type=str,
27                      help='Path to JVM if other than default')
28  parser.add_argument('--package_key', type=str,
29                      help='Paths to private key for signing payload')
30  parser.add_argument('--search_path', '--path', type=str,
31                      help='Search path for framework/signapk.jar')
32  parser.add_argument('--signapk_path', type=str,
33                      help='Path to signapk.jar, relative to search_path')
34  parser.add_argument('--extra_signapk_args', type=ParseSignerArgs,
35                      help='Extra arguments for signapk.jar')
36  parser.add_argument('--signapk_shared_library_path', type=str,
37                      help='Path to lib64 libraries used by signapk.jar')
38  parser.add_argument('--payload_signer', type=str,
39                      help='Path to custom payload signer')
40  parser.add_argument('--payload_signer_args', type=ParseSignerArgs,
41                      help='Arguments for payload signer if necessary')
42  parser.add_argument('--payload_signer_maximum_signature_size', type=str,
43                      help='Maximum signature size (in bytes) that would be '
44                      'generated by the given payload signer')
45  parser.add_argument('--private_key_suffix', type=str,
46                      help='Suffix to be appended to package_key path', default=".pk8")
47