def parse_args(argv): argv = list(sys.argv[1:]) argv = build_utils.expand_file_args(argv) parser = create_parser() args = parser.parse_args(argv) requires_options = [ "android_sdk_jar", "aapt_path", "android_manifest", "dependency_res_zips", "resource_dirs", "resource_zip_out" ] build_utils.check_options(args, parser, required=requires_options) args.resource_dirs = build_utils.parse_gyp_list(args.resource_dirs) args.dependency_res_zips = build_utils.parse_gyp_list( args.dependency_res_zips) if args.extra_r_text_files: args.extra_r_text_files = build_utils.parse_gyp_list( args.extra_r_text_files) else: args.extra_r_text_files = [] if args.extra_res_packages: args.extra_res_packages = build_utils.parse_gyp_list( args.extra_res_packages) else: args.extra_res_packages = [] return args
def main(argv): argv = build_utils.expand_file_args(argv) args = parse_args(argv) # print(args) proguard = proguard_util.ProguardCmdBuilder(args.proguard_path) proguard.injars(build_utils.parse_gyp_list(args.input_paths)) proguard.configs(build_utils.parse_gyp_list(args.proguard_configs)) proguard.outjar(args.output_path) if args.mapping: proguard.mapping(args.mapping) if args.tested_apk_info: proguard.tested_apk_info(args.tested_apk_info) classpath = list(set(args.classpath)) proguard.libraryjars(classpath) proguard.verbose(args.verbose) input_paths = proguard.get_inputs() proguard.check_output() if args.depfile: all_dep_paths = list(input_paths) all_dep_paths.extend(build_utils.get_python_dependencies()) build_utils.write_dep_file(args.depfile, all_dep_paths) pass pass
def parse_args(argv): argv = build_utils.expand_file_args(argv) parser = create_parser() args = parser.parse_args(argv) args.assets = build_utils.parse_gyp_list(args.assets) args.uncompressed_assets = build_utils.parse_gyp_list( args.uncompressed_assets) args.native_lib_placeholders = build_utils.parse_gyp_list( args.native_lib_placeholders) all_libs = [] for item in args.native_libs: all_libs.extend(build_utils.parse_gyp_list(item)) args.native_libs = all_libs secondary_libs = [] for item in args.secondary_native_libs: secondary_libs.extend(build_utils.parse_gyp_list(item)) args.secondary_native_libs = secondary_libs if not args.android_abi and (args.native_libs or args.native_lib_placeholders): raise Exception("Must specify --android-abi with --native-libs") if not args.secondary_android_abi and args.secondary_native_libs: raise Exception("Must specify --secondary-android-abi with" " --secondary-native-libs") return args
def parse_args(argv): argv = build_utils.expand_file_args(argv) parser = create_parser() args = parser.parse_args(argv) input_list = [] for item in args.inputs: input_list.extend(build_utils.parse_gyp_list(item)) args.inputs = input_list return args
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())
def main(argv): argv = build_utils.expand_file_args(argv) parser = create_parser() args = parser.parse_args(argv) defines = [] for arg in args.defines: defines.extend(build_utils.parse_gyp_list(arg)) args.defines = defines do_gcc(args) if args.depfile: build_utils.write_dep_file(args.depfile, build_utils.get_python_dependencies()) if args.stamp: build_utils.touch(args.stamp) pass
def main(argv): argv = build_utils.expand_file_args(argv) args = parse_options(argv) # print(args) java_files = list(args.java_files) if args.src_gendirs: java_files.extend( build_utils.find_in_directories(args.src_gendirs, "*.java")) java_files = _filter_java_files(java_files, args.javac_includes) javac_cmd = ["javac"] javac_cmd.extend([ "-g", "-encoding", "utf-8", "-classpath", build_utils.CLASSPATH_SEP.join(args.classpath), "-sourcepath", "", "-source", "1.8", "-target", "1.8", ]) if args.bootclasspath: javac_cmd.extend([ "-bootclasspath", build_utils.CLASSPATH_SEP.join(args.bootclasspath) ]) _on_stale_md5(args, javac_cmd, java_files) all_inputs = build_utils.get_python_dependencies() build_utils.write_dep_file(args.depfile, all_inputs) pass
def parse_args(parser, argv): argv = build_utils.expand_file_args(argv) args = parser.parse_args(argv) required_options = ("android_sdk_tools", ) build_utils.check_options(args, parser, required=required_options) if args.multidex_configuration_path: with open(args.multidex_configuration_path) as multidex_config_file: multidex_config = json.load(multidex_config_file) args.multi_dex = multidex_config.get("enabled", False) pass # if args.multi_dex and not args.main_dex_list_path: # print("multidex cannot be enabled without --main-dex-list-path") # args.multi_dex = False elif args.main_dex_list_path and not args.multi_dex: print("--main-dex-list-path is unused if --multi-dex is not enabled") if args.inputs: args.inputs = build_utils.parse_gyp_list(args.inputs) if args.excluded_paths: args.excluded_paths = build_utils.parse_gyp_list(args.excluded_paths) return args
def main(argv): argv = build_utils.expand_file_args(argv) parser = create_parser() args = parser.parse_args(argv) # print(args) if args.multidex_configuration_path: multidex_config = build_utils.read_json( args.multidex_configuration_path) if not multidex_config.get("enabled", False): return 0 if args.inputs: args.paths.extend(build_utils.parse_gyp_list(args.inputs)) shrinked_android_jar = os.path.abspath( os.path.join(args.android_sdk_tools, 'lib', 'shrinkedAndroid.jar')) dx_jar = os.path.abspath( os.path.join(args.android_sdk_tools, 'lib', 'dx.jar')) rules_file = os.path.abspath( os.path.join(args.android_sdk_tools, 'mainDexClasses.rules')) proguard_cmd = [ "java", "-jar", args.proguard_jar_path, '-forceprocessing', '-dontwarn', '-dontoptimize', '-dontobfuscate', '-dontpreverify', '-libraryjars', shrinked_android_jar, '-include', rules_file, ] for m in args.main_dex_rules_paths: proguard_cmd.extend(["-include", m]) pass main_dex_list_cmd = [ "java", "-cp", dx_jar, "com.android.multidex.MainDexListBuilder", ] input_paths = list(args.paths) input_paths += [ shrinked_android_jar, dx_jar, rules_file, ] input_paths += args.main_dex_rules_paths input_strings = [ proguard_cmd, main_dex_list_cmd, ] output_paths = [ args.main_dex_list_path, ] _on_stale_md5(args, proguard_cmd, main_dex_list_cmd, args.paths, args.main_dex_list_path) if args.depfile: all_dep_paths = list(input_paths) all_dep_paths.extend(build_utils.get_python_dependencies()) build_utils.write_dep_file(args.depfile, all_dep_paths) pass