def create_parser():
    parser = argparse.ArgumentParser(prog="jinja_template.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument('--inputs', help='The template files to process.')
    parser.add_argument('--output',
                        help='The output file to generate. Valid '
                        'only if there is a single input.')
    parser.add_argument('--outputs-zip',
                        help='A zip file containing the processed '
                        'templates. Required if there are multiple inputs.')
    parser.add_argument(
        '--inputs-base-dir',
        help='A common ancestor directory of '
        'the inputs. Each output\'s path in the output zip will '
        'match the relative path from INPUTS_BASE_DIR to the '
        'input. Required if --output-zip is given.')
    parser.add_argument('--loader-base-dir',
                        help='Base path used by the template '
                        'loader. Must be a common ancestor directory of '
                        'the inputs. Defaults to DIR_SOURCE_ROOT.',
                        default=host_paths.DIR_SOURCE_ROOT)
    parser.add_argument('--variables',
                        default='',
                        help='Variables to be made available in the '
                        'template processing environment, as a GYP list (e.g. '
                        '--variables "channel=beta mstone=39")')
    return parser
Exemplo n.º 2
0
def create_parser():
    parser = argparse.ArgumentParser(prog="proguard.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--proguard-path",
                        help="Path to the proguard executable.")
    parser.add_argument("--input-paths",
                        help="Paths to the .jar files proguard should run on.")
    parser.add_argument("--output-path",
                        help="Path to the generated .jar file.")
    parser.add_argument("--proguard-configs",
                        help="Paths to proguard configuration files.")
    parser.add_argument("--mapping", help="Path to proguard mapping to apply.")
    parser.add_argument(
        "--is-test",
        action="store_true",
        help="If true, extra progurad options for instrumentation tests will be "
        "added.")
    parser.add_argument(
        "--tested-apk-info",
        help="Path to the proguard .info file for the tested apk.")
    parser.add_argument("--classpath",
                        action="append",
                        help="Classpath for proguard.")
    parser.add_argument("--stamp", help="Path to touch on success.")
    parser.add_argument("-v",
                        "--verbose",
                        action="store_true",
                        help="Print all proguard output.")
    return parser
Exemplo n.º 3
0
def create_parser():
    parser = argparse.ArgumentParser(prog="zipjar_prebuilt.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--zipjar-path", help="The path to output zipjar path")
    parser.add_argument("--jar-path", help="The input jar path.")
    parser.add_argument("--base-dir", help="The working directory.")
    return parser
Exemplo n.º 4
0
def create_parser():
    parser = argparse.ArgumentParser(prog="test_action.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--input", help="The path to the input file.")
    parser.add_argument("--output", help="The output file path.")
    parser.add_argument("options", nargs="*")
    return parser
Exemplo n.º 5
0
def create_parser() -> argparse.ArgumentParser:
    """创建参数的解析器
    """
    parser = argparse.ArgumentParser(prog="write_build_config.py")
    parser.add_argument("--build-config")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--type")
    parser.add_argument("--possible-deps-configs",
                        nargs="*", metavar="CONFIG")  # 依赖项

    # android resources
    parser.add_argument("--srcjar")
    parser.add_argument("--package-name")
    parser.add_argument("--r-text")
    parser.add_argument("--android-manifest")
    parser.add_argument("--resources-zip")
    parser.add_argument("--is-locale-resource",
                        action="store_true")

    # android_assets
    parser.add_argument("--asset-sources", nargs="*")
    parser.add_argument("--asset-renaming-sources", nargs="*")
    parser.add_argument("--asset-renaming-destinations", nargs="*")
    parser.add_argument("--disable-asset-compression", action="store_true")

    # java_library
    parser.add_argument("--jar-path")
    parser.add_argument("--supports-android", action="store_true")
    parser.add_argument("--requires-android", action="store_true")
    parser.add_argument("--bypass-platform-checks", action="store_true")
    parser.add_argument("--srczip-path",
                        help="Specifies the path to the *.srczip")

    # android library options.
    parser.add_argument("--dex-path", help="Path to target's dex output.")

    # native library options
    parser.add_argument("--native-libs", help="List of top-level native libs.")
    parser.add_argument("--readelf-path",
                        help="Path to the toolchain's readelf")

    # android_apk
    parser.add_argument("--apk-path")
    parser.add_argument("--incremental-apk-path")
    parser.add_argument("--incremental-install-script-path")

    parser.add_argument("--tested-apk-config")
    parser.add_argument("--proguard-enabled", action="store_true",
                        help="Whether proguard is enabled for this apk.")
    parser.add_argument("--proguard-info",
                        help="Path to the proguard .info output for this apk.")
    parser.add_argument("--has-alternative-locale-resource",
                        action="store_true",
                        help="Whether there is alternative-locale-resource in direct deps.")
    return parser
Exemplo n.º 6
0
def create_parser():
    parser = argparse.ArgumentParser(prog="aidl.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--aidl-path", help="Path to aidl binary.")
    parser.add_argument("--imports", help="Files to import.")
    parser.add_argument("--includes",
                        help="Directories to add as import search paths.")
    parser.add_argument("--srcjar", help="Path for srcjar output.")
    parser.add_argument("--base-dir", help="The base working directory.")
    parser.add_argument("paths", nargs="+", help="The paths to aidl files.")
    return parser
def main(argv):
    argv = build_utils.expand_file_args(argv)
    parser = argparse.ArgumentParser(prog="create_java_binary_script.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument('--output', help='Output path for executable script.')
    parser.add_argument('--jar-path', help='Path to the main jar.')
    parser.add_argument(
        '--main-class',
        help='Name of the java class with the "main" entry point.')
    parser.add_argument('--classpath',
                        action='append',
                        default=[],
                        help='Classpath for running the jar.')
    parser.add_argument(
        '--bootclasspath',
        action='append',
        default=[],
        help='zip/jar files to add to bootclasspath for java cmd.')
    parser.add_argument("extra_program_args", nargs="*")
    args = parser.parse_args(argv)
    if args.extra_program_args is None:
        args.extra_program_args = []

    classpath = [args.jar_path]
    for cp_arg in args.classpath:
        classpath += build_utils.parse_gyp_list(cp_arg)

    bootclasspath = []
    for bootcp_arg in args.bootclasspath:
        bootclasspath += build_utils.parse_gyp_list(bootcp_arg)

    bootclasspath = [os.path.abspath(p) for p in bootclasspath]
    classpath = [os.path.abspath(p) for p in classpath]

    with open(args.output, 'w') as script:
        script.write(
            script_template.format(classpath=repr(classpath),
                                   bootclasspath=repr(bootclasspath),
                                   main_class=args.main_class,
                                   extra_program_args=repr(
                                       args.extra_program_args)))

    os.chmod(args.output, 0o750)

    if args.depfile:
        build_utils.write_dep_file(args.depfile,
                                   build_utils.get_python_dependencies())
Exemplo n.º 8
0
def create_parser():
    parser = argparse.ArgumentParser(prog="protoc_java.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--protoc",
                        help="Path to protoc binary.")
    parser.add_argument("--proto-path",
                        help="Path to proto directory.")
    parser.add_argument("--java-out-dir",
                        help="Path to output directory for java files.")
    parser.add_argument("--srcjar",
                        help="Path to output srcjar.")
    parser.add_argument("--base-dir",
                        help="The base working directory.")
    parser.add_argument("--stamp", help="File to touch on success.")
    parser.add_argument("paths", nargs="+",
                        help="The paths of .proto files.")
    return parser
Exemplo n.º 9
0
def create_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(prog="main_dex_list.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--proguard-jar-path",
                        required=True,
                        help="Specifies the proguard executable jar path.")
    parser.add_argument("--android-sdk-tools",
                        required=True,
                        help="Android sdk build tools directory.")
    parser.add_argument(
        "--main-dex-rules-path",
        action="append",
        default=[],
        dest="main_dex_rules_paths",
        help="A file containing a list of proguard rules to use "
        "in determining the class to include in the main dex.")
    parser.add_argument("--main-dex-list-path",
                        required=True,
                        help="The main dex list file to generate.")
    parser.add_argument(
        "--enabled-configurations",
        help="The build configurations for which a main dex list "
        "should be generated.")
    parser.add_argument("--configuration-name",
                        help="The current build configuration.")
    parser.add_argument(
        "--multidex-configuration-path",
        help="A JSON file containing multidex buld configuration.")
    parser.add_argument(
        "--inputs", help="JARs for which a main dex list should be generated.")
    parser.add_argument("--base-dir",
                        required=True,
                        help="The base working  directory.")
    parser.add_argument(
        "paths",
        nargs="*",
        default=[],
        help="JARs for which a main dex list should be generated.")
    return parser
Exemplo n.º 10
0
def create_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(prog="dex.py")
    build_utils.add_depfile_option(parser)
    parser.add_argument("--android-sdk-tools",
                        help="Android build tools directory.")
    parser.add_argument("--output-directory",
                        default=os.getcwd(),
                        help="Path to the output build directory.")
    parser.add_argument("--dex-path", help="dex output path")
    parser.add_argument("--configuration-name",
                        help="The build CONFIGURATION_NAME.")
    parser.add_argument("--proguard-enabled",
                        help="\"true\" if proguard is enabled.")
    parser.add_argument("--debug-build-proguard-enabled",
                        help="true if proguard is enabled for debug build.")
    parser.add_argument("--proguard-enabled-input-path",
                        help="Path to dex in Release mode when proguard "
                        "is enabled.")
    parser.add_argument("--no-locals",
                        default="0",
                        help="Exclude locales from the dex list.")
    parser.add_argument("--incremental",
                        action="store_true",
                        help="Enable incremental builds when possible.")
    parser.add_argument("--inputs", help="A list of additional input paths.")
    parser.add_argument("--excluded-paths",
                        help="A list of paths to exclude from the dex file.")
    parser.add_argument("--main-dex-list-path",
                        help="A file containing a list of the classes to "
                        "include in the main dex.")
    parser.add_argument(
        "--multidex-configuration-path",
        help="A json file containing multidex build configuration.")
    parser.add_argument("--multi-dex", action="store_true", default=False)
    parser.add_argument("--base-dir")
    parser.add_argument("paths", nargs="*", default=[])

    return parser