1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/android/config.gni")
9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir)
10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir)
11 rebased_android_sdk_build_tools =
12 rebase_path(android_sdk_build_tools, root_build_dir)
14 android_sdk_jar = "$android_sdk/android.jar"
15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir)
17 template("android_lint") {
18 set_sources_assignment_filter([])
19 if (defined(invoker.testonly)) {
20 testonly = invoker.testonly
23 jar_path = invoker.jar_path
24 android_manifest = invoker.android_manifest
25 java_files = invoker.java_files
26 base_path = "$target_gen_dir/$target_name"
29 script = "//build/android/gyp/lint.py"
30 result_path = base_path + "/result.xml"
31 config_path = base_path + "/config.xml"
32 suppressions_file = "//build/android/lint/suppressions.xml"
44 rebased_java_files = rebase_path(java_files, root_build_dir)
47 "--lint-path=$rebased_android_sdk_root/tools/lint",
49 rebase_path(suppressions_file, root_build_dir),
51 rebase_path(android_manifest, root_build_dir),
54 rebase_path(jar_path, root_build_dir),
55 "--processed-config-path",
56 rebase_path(config_path, root_build_dir),
58 rebase_path(result_path, root_build_dir),
59 "--java-files=$rebased_java_files",
66 set_sources_assignment_filter([])
67 if (defined(invoker.testonly)) {
68 testonly = invoker.testonly
71 assert(defined(invoker.output))
73 script = "//build/android/gyp/dex.py"
74 depfile = "$target_gen_dir/$target_name.d"
75 if (defined(invoker.sources)) {
76 sources = invoker.sources
82 if (defined(invoker.inputs)) {
83 inputs = invoker.inputs
86 if (defined(invoker.deps)) {
90 rebased_output = rebase_path(invoker.output, root_build_dir)
94 rebase_path(depfile, root_build_dir),
95 "--android-sdk-tools",
96 rebased_android_sdk_build_tools,
101 if (defined(invoker.no_locals) && invoker.no_locals) {
102 args += [ "--no-locals=1" ]
105 if (defined(invoker.args)) {
109 if (defined(invoker.sources)) {
110 args += rebase_path(invoker.sources, root_build_dir)
115 # Creates a zip archive of the inputs.
116 # If base_dir is provided, the archive paths will be relative to it.
118 set_sources_assignment_filter([])
119 if (defined(invoker.testonly)) {
120 testonly = invoker.testonly
123 assert(defined(invoker.inputs))
124 assert(defined(invoker.output))
126 rebase_inputs = rebase_path(invoker.inputs, root_build_dir)
127 rebase_output = rebase_path(invoker.output, root_build_dir)
128 action(target_name) {
129 script = "//build/android/gn/zip.py"
130 depfile = "$target_gen_dir/$target_name.d"
131 inputs = invoker.inputs
138 rebase_path(depfile, root_build_dir),
139 "--inputs=$rebase_inputs",
140 "--output=$rebase_output",
142 if (defined(invoker.base_dir)) {
145 rebase_path(invoker.base_dir, root_build_dir),
151 # Write the target's .build_config file. This is a json file that contains a
152 # dictionary of information about how to build this target (things that
153 # require knowledge about this target's dependencies and cannot be calculated
154 # at gn-time). There is a special syntax to add a value in that dictionary to
155 # an action/action_foreachs args:
156 # --python-arg=@FileArg($rebased_build_config_path:key0:key1)
157 # At runtime, such an arg will be replaced by the value in the build_config.
158 # See build/android/gyp/write_build_config.py and
159 # build/android/gyp/util/build_utils.py:ExpandFileArgs
160 template("write_build_config") {
161 set_sources_assignment_filter([])
162 if (defined(invoker.testonly)) {
163 testonly = invoker.testonly
166 assert(defined(invoker.type))
167 assert(defined(invoker.build_config))
170 build_config = invoker.build_config
172 assert(type == "android_apk" || type == "java_library" ||
173 type == "android_resources" || type == "deps_dex")
175 action(target_name) {
176 script = "//build/android/gyp/write_build_config.py"
177 depfile = "$target_gen_dir/$target_name.d"
181 if (defined(invoker.deps)) {
185 possible_deps_configs = []
187 dep_gen_dir = get_label_info(d, "target_gen_dir")
188 dep_name = get_label_info(d, "name")
189 possible_deps_configs += [ "$dep_gen_dir/$dep_name.build_config" ]
191 rebase_possible_deps_configs = rebase_path(possible_deps_configs)
202 rebase_path(depfile, root_build_dir),
203 "--possible-deps-configs=$rebase_possible_deps_configs",
205 rebase_path(build_config, root_build_dir),
208 is_java_library = type == "java_library"
209 is_apk = type == "android_apk"
210 is_android_resources = type == "android_resources"
211 is_deps_dex = type == "deps_dex"
213 supports_android = is_apk || is_android_resources || is_deps_dex ||
214 (is_java_library && defined(invoker.supports_android) &&
215 invoker.supports_android)
216 requires_android = is_apk || is_android_resources || is_deps_dex ||
217 (is_java_library && defined(invoker.requires_android) &&
218 invoker.requires_android)
220 assert(!requires_android || supports_android,
221 "requires_android requires" + " supports_android")
223 # Mark these variables as used.
224 assert(is_java_library || true)
225 assert(is_apk || true)
226 assert(is_android_resources || true)
227 assert(is_deps_dex || true)
229 if (is_java_library || is_apk) {
232 rebase_path(invoker.jar_path, root_build_dir),
236 if (is_apk || is_deps_dex || (is_java_library && supports_android)) {
239 rebase_path(invoker.dex_path, root_build_dir),
242 if (supports_android) {
243 args += [ "--supports-android" ]
245 if (requires_android) {
246 args += [ "--requires-android" ]
248 if (defined(invoker.bypass_platform_checks) &&
249 invoker.bypass_platform_checks) {
250 args += [ "--bypass-platform-checks" ]
253 if (is_android_resources || is_apk) {
254 assert(defined(invoker.resources_zip))
257 rebase_path(invoker.resources_zip, root_build_dir),
259 if (defined(invoker.android_manifest)) {
260 inputs += [ invoker.android_manifest ]
262 "--android-manifest",
263 rebase_path(invoker.android_manifest, root_build_dir),
266 if (defined(invoker.custom_package)) {
269 invoker.custom_package,
275 if (defined(invoker.native_libs)) {
276 inputs += invoker.native_libs
277 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir)
278 rebased_android_readelf = rebase_path(android_readelf, root_build_dir)
280 "--native-libs=$rebased_native_libs",
281 "--readelf-path=$rebased_android_readelf",
286 if (defined(invoker.srcjar)) {
289 rebase_path(invoker.srcjar, root_build_dir),
295 template("process_java_prebuilt") {
296 set_sources_assignment_filter([])
297 if (defined(invoker.testonly)) {
298 testonly = invoker.testonly
301 _input_jar_path = invoker.input_jar_path
302 _output_jar_path = invoker.output_jar_path
303 _jar_toc_path = _output_jar_path + ".TOC"
305 assert(invoker.build_config != "")
307 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
308 _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar"
309 _proguard_config_path = invoker.proguard_config
310 _build_config = invoker.build_config
311 _rebased_build_config = rebase_path(_build_config, root_build_dir)
312 action("${target_name}__proguard_process") {
313 script = "//build/android/gyp/proguard.py"
319 _proguard_config_path,
321 depfile = "${target_gen_dir}/${target_name}.d"
328 rebase_path(depfile, root_build_dir),
330 rebase_path(_proguard_jar_path, root_build_dir),
332 rebase_path(_input_jar_path, root_build_dir),
334 rebase_path(_output_jar_path, root_build_dir),
336 rebase_path(_proguard_config_path, root_build_dir),
338 rebased_android_sdk_jar,
339 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
343 copy("${target_name}__copy_jar") {
353 action("${target_name}__jar_toc") {
354 script = "//build/android/gyp/jar_toc.py"
355 depfile = "$target_gen_dir/$target_name.d"
359 _jar_toc_path + ".md5.stamp",
366 rebase_path(depfile, root_build_dir),
368 rebase_path(_output_jar_path, root_build_dir),
370 rebase_path(_jar_toc_path, root_build_dir),
376 ":${target_name}__jar_toc",
381 # Packages resources, assets, dex, and native libraries into an apk. Signs and
383 template("create_apk") {
384 set_sources_assignment_filter([])
385 if (defined(invoker.testonly)) {
386 testonly = invoker.testonly
389 _android_manifest = invoker.android_manifest
390 _base_path = invoker.base_path
391 _final_apk_path = invoker.apk_path
392 _resources_zip = invoker.resources_zip
393 _dex_path = invoker.dex_path
394 _keystore_path = invoker.keystore_path
395 _keystore_name = invoker.keystore_name
396 _keystore_password = invoker.keystore_password
397 _load_library_from_apk = invoker.load_library_from_apk
400 if (defined(invoker.deps)) {
404 _native_libs_dir = "//build/android/empty/res"
405 if (defined(invoker.native_libs_dir)) {
406 _native_libs_dir = invoker.native_libs_dir
409 _asset_location = "//build/android/empty/res"
410 if (defined(invoker.asset_location)) {
411 _asset_location = invoker.asset_location
414 _version_code = invoker.version_code
415 _version_name = invoker.version_name
417 _base_apk_path = _base_path + ".apk_intermediates"
419 _resource_packaged_apk_path = _base_apk_path + ".ap_"
420 _packaged_apk_path = _base_apk_path + ".unfinished.apk"
422 defined(invoker.shared_resources) && invoker.shared_resources
424 _configuration_name = "Release"
426 _configuration_name = "Debug"
429 action("${target_name}__package_resources") {
432 script = "//build/android/gyp/package_resources.py"
433 depfile = "${target_gen_dir}/${target_name}.d"
440 _resource_packaged_apk_path,
443 _rebased_resources_zips = [ rebase_path(_resources_zip, root_build_dir) ]
446 rebase_path(depfile, root_build_dir),
449 "--android-sdk-tools",
450 rebased_android_sdk_build_tools,
451 "--configuration-name=$_configuration_name",
452 "--android-manifest",
453 rebase_path(_android_manifest, root_build_dir),
459 rebase_path(_asset_location, root_build_dir),
460 "--resource-zips=$_rebased_resources_zips",
462 rebase_path(_resource_packaged_apk_path, root_build_dir),
465 if (_shared_resources) {
466 args += [ "--shared-resources" ]
470 action("${target_name}__package") {
471 script = "//build/android/gyp/ant.py"
472 _ant_script = "//build/android/ant/apk-package.xml"
474 depfile = "$target_gen_dir/$target_name.d"
478 _resource_packaged_apk_path,
487 _rebased_emma_jar = ""
488 _rebased_resource_packaged_apk_path =
489 rebase_path(_resource_packaged_apk_path, root_build_dir)
490 _rebased_packaged_apk_path = rebase_path(_packaged_apk_path, root_build_dir)
491 _rebased_native_libs_dir = rebase_path(_native_libs_dir, root_build_dir)
492 _rebased_dex_path = rebase_path(_dex_path, root_build_dir)
495 rebase_path(depfile, root_build_dir),
498 "-DANDROID_SDK_ROOT=$rebased_android_sdk_root",
499 "-DANDROID_SDK_TOOLS=$rebased_android_sdk_build_tools",
500 "-DRESOURCE_PACKAGED_APK_NAME=$_rebased_resource_packaged_apk_path",
501 "-DCONFIGURATION_NAME=$_configuration_name",
502 "-DNATIVE_LIBS_DIR=$_rebased_native_libs_dir",
504 "-DUNSIGNED_APK_PATH=$_rebased_packaged_apk_path",
505 "-DEMMA_INSTRUMENT=0",
506 "-DEMMA_DEVICE_JAR=$_rebased_emma_jar",
507 "-DDEX_FILE_PATH=$_rebased_dex_path",
510 rebase_path(_ant_script, root_build_dir),
514 action("${target_name}__finalize") {
515 script = "//build/android/gyp/finalize_apk.py"
516 depfile = "$target_gen_dir/$target_name.d"
531 rebase_path(depfile, root_build_dir),
533 rebase_path(zipalign_path, root_build_dir),
534 "--unsigned-apk-path",
535 rebase_path(_packaged_apk_path, root_build_dir),
537 rebase_path(_final_apk_path, root_build_dir),
539 rebase_path(_keystore_path, root_build_dir),
545 if (_load_library_from_apk) {
546 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar"
547 inputs += [ _rezip_jar_path ]
549 "--load-library-from-zip-file=1",
550 "--rezip-apk-jar-path",
551 rebase_path(_rezip_jar_path, root_build_dir),
558 ":${target_name}__finalize",
563 template("java_prebuilt_impl") {
564 set_sources_assignment_filter([])
565 if (defined(invoker.testonly)) {
566 testonly = invoker.testonly
569 defined(invoker.supports_android) && invoker.supports_android
571 assert(defined(invoker.jar_path))
572 _base_path = "${target_gen_dir}/$target_name"
573 _jar_path = _base_path + ".jar"
574 _build_config = _base_path + ".build_config"
576 if (_supports_android) {
577 _dex_path = _base_path + ".dex.jar"
581 _template_name = target_name
583 _final_deps += [ ":${_template_name}__build_config" ]
584 write_build_config("${_template_name}__build_config") {
585 type = "java_library"
586 supports_android = _supports_android
588 defined(invoker.requires_android) && invoker.requires_android
591 if (defined(invoker.deps)) {
594 build_config = _build_config
596 if (_supports_android) {
601 _final_deps += [ ":${_template_name}__process_jar" ]
602 process_java_prebuilt("${_template_name}__process_jar") {
603 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
604 proguard_preprocess = true
605 proguard_config = invoker.proguard_config
608 build_config = _build_config
609 input_jar_path = invoker.jar_path
610 output_jar_path = _jar_path
613 if (_supports_android) {
614 _final_deps += [ ":${_template_name}__dex" ]
615 dex("${_template_name}__dex") {
628 # Compiles and jars a set of java files.
635 # java_files: List of .java files to compile.
636 # java_deps: List of java dependencies. These should all have a .jar output
637 # at "${target_gen_dir}/${target_name}.jar.
638 # chromium_code: If true, enable extra warnings.
639 # srcjar_deps: List of srcjar dependencies. The .java files contained in the
640 # dependencies srcjar outputs will be compiled and added to the output jar.
641 # jar_path: Use this to explicitly set the output jar path. Defaults to
642 # "${target_gen_dir}/${target_name}.jar.
643 template("compile_java") {
644 set_sources_assignment_filter([])
645 if (defined(invoker.testonly)) {
646 testonly = invoker.testonly
649 assert(defined(invoker.java_files))
650 assert(defined(invoker.build_config))
651 assert(defined(invoker.jar_path))
653 _java_files = invoker.java_files
654 _final_jar_path = invoker.jar_path
655 _intermediate_jar_path = "$target_gen_dir/$target_name.initial.jar"
657 _build_config = invoker.build_config
659 _jar_excluded_patterns = []
660 if (defined(invoker.jar_excluded_patterns)) {
661 _jar_excluded_patterns += invoker.jar_excluded_patterns
664 _chromium_code = false
665 if (defined(invoker.chromium_code)) {
666 _chromium_code = invoker.chromium_code
668 _manifest_entries = []
669 if (defined(invoker.manifest_entries)) {
670 _manifest_entries = invoker.manifest_entries
674 if (defined(invoker.srcjar_deps)) {
675 _srcjar_deps += invoker.srcjar_deps
679 if (defined(invoker.srcjars)) {
680 _java_srcjars = invoker.srcjars
682 foreach(dep, _srcjar_deps) {
683 _dep_gen_dir = get_label_info(dep, "target_gen_dir")
684 _dep_name = get_label_info(dep, "name")
685 _java_srcjars += [ "$_dep_gen_dir/$_dep_name.srcjar" ]
688 # Mark srcjar_deps as used.
689 assert(_srcjar_deps == [] || true)
692 if (defined(invoker.android) && invoker.android) {
693 _system_jars += [ android_sdk_jar ]
696 _rebased_build_config = rebase_path(_build_config, root_build_dir)
697 _rebased_jar_path = rebase_path(_intermediate_jar_path, root_build_dir)
699 _template_name = target_name
700 _final_deps = [ ":${_template_name}__javac" ]
701 action("${_template_name}__javac") {
702 script = "//build/android/gyp/javac.py"
703 depfile = "$target_gen_dir/$target_name.d"
707 _intermediate_jar_path,
708 _intermediate_jar_path + ".md5.stamp",
710 sources = _java_files + _java_srcjars
711 inputs = _system_jars + [ _build_config ]
713 _rebased_system_jars = rebase_path(_system_jars, root_build_dir)
714 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir)
715 _rebased_depfile = rebase_path(depfile, root_build_dir)
717 "--depfile=$_rebased_depfile",
718 "--classpath=$_rebased_system_jars",
719 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
720 "--jar-path=$_rebased_jar_path",
721 "--java-srcjars=$_rebased_java_srcjars",
722 "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)",
723 "--jar-excluded-classes=$_jar_excluded_patterns",
725 foreach(e, _manifest_entries) {
726 args += [ "--manifest-entry=" + e ]
728 if (_chromium_code) {
729 args += [ "--chromium-code=1" ]
732 args += rebase_path(_java_files, root_build_dir)
735 _final_deps += [ ":${_template_name}__finish" ]
736 process_java_prebuilt("${_template_name}__finish") {
737 build_config = _build_config
738 input_jar_path = _intermediate_jar_path
739 output_jar_path = _final_jar_path
740 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
741 proguard_preprocess = invoker.proguard_preprocess
742 proguard_config = invoker.proguard_config
751 template("java_library_impl") {
752 set_sources_assignment_filter([])
753 if (defined(invoker.testonly)) {
754 testonly = invoker.testonly
758 defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) ||
759 defined(invoker.srcjars) || defined(invoker.srcjar_deps))
760 _base_path = "$target_gen_dir/$target_name"
761 _jar_path = _base_path + ".jar"
762 if (defined(invoker.jar_path)) {
763 _jar_path = invoker.jar_path
765 _template_name = target_name
769 if (defined(invoker.datadeps)) {
770 _final_datadeps = invoker.datadeps
774 defined(invoker.supports_android) && invoker.supports_android
776 defined(invoker.requires_android) && invoker.requires_android
778 if (_supports_android) {
779 _dex_path = _base_path + ".dex.jar"
780 if (defined(invoker.dex_path)) {
781 _dex_path = invoker.dex_path
785 if (defined(invoker.override_build_config)) {
786 _build_config = invoker.override_build_config
788 _build_config = _base_path + ".build_config"
789 _final_deps += [ ":${_template_name}__build_config" ]
790 write_build_config("${_template_name}__build_config") {
791 type = "java_library"
792 supports_android = _supports_android
793 requires_android = _requires_android
794 bypass_platform_checks = defined(invoker.bypass_platform_checks) &&
795 invoker.bypass_platform_checks
798 if (defined(invoker.deps)) {
802 build_config = _build_config
804 if (_supports_android) {
810 _chromium_code = true
811 if (defined(invoker.chromium_code)) {
812 _chromium_code = invoker.chromium_code
816 if (defined(invoker.srcjar_deps)) {
817 _srcjar_deps = invoker.srcjar_deps
821 if (defined(invoker.srcjars)) {
822 _srcjars = invoker.srcjars
826 if (defined(invoker.java_files)) {
827 _java_files = invoker.java_files
828 } else if (defined(invoker.DEPRECATED_java_in_dir)) {
829 _src_dir = invoker.DEPRECATED_java_in_dir + "/src"
830 _src_dir_exists = exec_script("//build/dir_exists.py",
831 [ rebase_path(_src_dir, root_build_dir) ],
833 assert(_src_dir_exists == "False",
834 "In GN, java_in_dir should be the fully specified java directory " +
835 "(i.e. including the trailing \"/src\")")
837 _java_files_build_rel = exec_script(
838 "//build/android/gyp/find.py",
842 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir),
845 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir)
847 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != [])
849 _final_deps += [ ":${_template_name}__compile_java" ]
850 compile_java("${_template_name}__compile_java") {
852 build_config = _build_config
853 java_files = _java_files
854 srcjar_deps = _srcjar_deps
856 chromium_code = _chromium_code
857 android = _requires_android
859 if (defined(invoker.jar_excluded_patterns)) {
860 jar_excluded_patterns = invoker.jar_excluded_patterns
862 if (defined(invoker.proguard_preprocess)) {
863 proguard_preprocess = invoker.proguard_preprocess
865 if (defined(invoker.proguard_config)) {
866 proguard_config = invoker.proguard_config
868 if (defined(invoker.dist_jar_path)) {
869 dist_jar_path = invoker.dist_jar_path
871 if (defined(invoker.manifest_entries)) {
872 manifest_entries = invoker.manifest_entries
876 if (defined(invoker.main_class)) {
877 _final_deps += [ ":${_template_name}__binary_script" ]
878 action("${_template_name}__binary_script") {
879 script = "//build/android/gyp/create_java_binary_script.py"
880 depfile = "$target_gen_dir/$target_name.d"
881 java_script = "$root_build_dir/bin/$_template_name"
889 _rebased_build_config = rebase_path(_build_config, root_build_dir)
892 rebase_path(depfile, root_build_dir),
894 rebase_path(java_script, root_build_dir),
895 "--classpath=@FileArg($_rebased_build_config:java:full_classpath)",
897 rebase_path(_jar_path, root_build_dir),
904 if (_supports_android) {
905 if (defined(invoker.chromium_code) && invoker.chromium_code) {
906 _android_manifest = "//build/android/AndroidManifest.xml"
907 if (defined(invoker.android_manifest)) {
908 _android_manifest = invoker.android_manifest
911 _final_datadeps += [ ":${_template_name}__lint" ]
912 android_lint("${_template_name}__lint") {
913 android_manifest = _android_manifest
915 java_files = _java_files
919 _final_deps += [ ":${_template_name}__dex" ]
920 dex("${_template_name}__dex") {
929 if (defined(invoker.visibility)) {
930 visibility = invoker.visibility
933 datadeps = _final_datadeps
937 # Runs process_resources.py
938 template("process_resources") {
939 set_sources_assignment_filter([])
940 if (defined(invoker.testonly)) {
941 testonly = invoker.testonly
944 zip_path = invoker.zip_path
945 srcjar_path = invoker.srcjar_path
946 build_config = invoker.build_config
947 resource_dirs = invoker.resource_dirs
948 android_manifest = invoker.android_manifest
950 non_constant_id = true
951 if (defined(invoker.generate_constant_ids) && invoker.generate_constant_ids) {
952 non_constant_id = false
955 action(target_name) {
956 script = "//build/android/gyp/process_resources.py"
958 depfile = "$target_gen_dir/$target_name.d"
965 sources_build_rel = exec_script("//build/android/gyp/find.py",
966 rebase_path(resource_dirs, root_build_dir),
968 sources = rebase_path(sources_build_rel, ".", root_build_dir)
975 rebase_resource_dirs = rebase_path(resource_dirs, root_build_dir)
976 rebase_build_config = rebase_path(build_config, root_build_dir)
979 rebase_path(depfile, root_build_dir),
981 rebase_path(android_sdk, root_build_dir),
982 "--android-sdk-tools",
983 rebase_path(android_sdk_build_tools, root_build_dir),
984 "--android-manifest",
985 rebase_path(android_manifest, root_build_dir),
986 "--resource-dirs=$rebase_resource_dirs",
988 rebase_path(srcjar_path, root_build_dir),
989 "--resource-zip-out",
990 rebase_path(zip_path, root_build_dir),
991 "--dependencies-res-zips=@FileArg($rebase_build_config:resources:dependency_zips)",
992 "--extra-res-packages=@FileArg($rebase_build_config:resources:extra_package_names)",
995 if (non_constant_id) {
996 args += [ "--non-constant-id" ]
999 if (defined(invoker.custom_package)) {
1002 invoker.custom_package,
1006 if (defined(invoker.v14_verify_only) && invoker.v14_verify_only) {
1007 args += [ "--v14-verify-only" ]
1010 if (defined(invoker.shared_resources) && invoker.shared_resources) {
1011 args += [ "--shared-resources" ]
1014 if (defined(invoker.all_resources_zip_path)) {
1015 all_resources_zip = invoker.all_resources_zip_path
1016 outputs += [ all_resources_zip ]
1018 "--all-resources-zip-out",
1019 rebase_path(all_resources_zip, root_build_dir),
1023 if (defined(invoker.args)) {
1024 args += invoker.args
1029 template("copy_ex") {
1030 set_sources_assignment_filter([])
1031 if (defined(invoker.testonly)) {
1032 testonly = invoker.testonly
1035 action(target_name) {
1036 script = "//build/android/gyp/copy_ex.py"
1038 if (defined(invoker.deps)) {
1043 if (defined(invoker.sources)) {
1044 sources += invoker.sources
1048 if (defined(invoker.inputs)) {
1049 inputs += invoker.inputs
1052 depfile = "$target_gen_dir/$target_name.d"
1059 rebase_path(depfile, root_build_dir),
1061 rebase_path(invoker.dest, root_build_dir),
1063 rebased_sources = rebase_path(sources, root_build_dir)
1064 args += [ "--files=$rebased_sources" ]
1066 if (defined(invoker.clear_dir) && invoker.clear_dir) {
1067 args += [ "--clear" ]
1070 if (defined(invoker.args)) {
1071 args += invoker.args
1076 # Produces a single .dex.jar out of a set of Java dependencies.
1077 template("deps_dex") {
1078 set_sources_assignment_filter([])
1079 build_config = "$target_gen_dir/${target_name}.build_config"
1080 write_build_config("${target_name}__build_config") {
1084 build_config = build_config
1085 dex_path = invoker.dex_path
1088 rebased_build_config = rebase_path(build_config, root_build_dir)
1093 output = invoker.dex_path
1094 dex_arg_key = "${rebased_build_config}:final_dex:dependency_dex_files"
1095 args = [ "--inputs=@FileArg($dex_arg_key)" ]
1096 if (defined(invoker.excluded_jars)) {
1097 excluded_jars = rebase_path(invoker.excluded_jars, root_build_dir)
1098 args += [ "--excluded-paths=${excluded_jars}" ]