OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 | 6 |
7 assert(is_android) | 7 assert(is_android) |
8 | 8 |
9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) | 10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) |
11 rebased_android_sdk_build_tools = | 11 rebased_android_sdk_build_tools = |
12 rebase_path(android_sdk_build_tools, root_build_dir) | 12 rebase_path(android_sdk_build_tools, root_build_dir) |
13 | 13 |
14 android_sdk_jar = "$android_sdk/android.jar" | 14 android_sdk_jar = "$android_sdk/android.jar" |
15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) | 15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) |
16 | 16 |
17 template("android_lint") { | 17 template("android_lint") { |
| 18 set_sources_assignment_filter([]) |
18 if (defined(invoker.testonly)) { | 19 if (defined(invoker.testonly)) { |
19 testonly = invoker.testonly | 20 testonly = invoker.testonly |
20 } | 21 } |
21 | 22 |
22 jar_path = invoker.jar_path | 23 jar_path = invoker.jar_path |
23 android_manifest = invoker.android_manifest | 24 android_manifest = invoker.android_manifest |
24 java_files = invoker.java_files | 25 java_files = invoker.java_files |
25 base_path = "$target_gen_dir/$target_name" | 26 base_path = "$target_gen_dir/$target_name" |
26 | 27 |
27 action(target_name) { | 28 action(target_name) { |
(...skipping 27 matching lines...) Expand all Loading... |
55 rebase_path(config_path, root_build_dir), | 56 rebase_path(config_path, root_build_dir), |
56 "--result-path", | 57 "--result-path", |
57 rebase_path(result_path, root_build_dir), | 58 rebase_path(result_path, root_build_dir), |
58 "--java-files=$rebased_java_files", | 59 "--java-files=$rebased_java_files", |
59 "--enable", | 60 "--enable", |
60 ] | 61 ] |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 template("dex") { | 65 template("dex") { |
| 66 set_sources_assignment_filter([]) |
65 if (defined(invoker.testonly)) { | 67 if (defined(invoker.testonly)) { |
66 testonly = invoker.testonly | 68 testonly = invoker.testonly |
67 } | 69 } |
68 | 70 |
69 assert(defined(invoker.output)) | 71 assert(defined(invoker.output)) |
70 action(target_name) { | 72 action(target_name) { |
71 script = "//build/android/gyp/dex.py" | 73 script = "//build/android/gyp/dex.py" |
72 depfile = "$target_gen_dir/$target_name.d" | 74 depfile = "$target_gen_dir/$target_name.d" |
73 if (defined(invoker.sources)) { | 75 if (defined(invoker.sources)) { |
74 sources = invoker.sources | 76 sources = invoker.sources |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 108 |
107 if (defined(invoker.sources)) { | 109 if (defined(invoker.sources)) { |
108 args += rebase_path(invoker.sources, root_build_dir) | 110 args += rebase_path(invoker.sources, root_build_dir) |
109 } | 111 } |
110 } | 112 } |
111 } | 113 } |
112 | 114 |
113 # Creates a zip archive of the inputs. | 115 # Creates a zip archive of the inputs. |
114 # If base_dir is provided, the archive paths will be relative to it. | 116 # If base_dir is provided, the archive paths will be relative to it. |
115 template("zip") { | 117 template("zip") { |
| 118 set_sources_assignment_filter([]) |
116 if (defined(invoker.testonly)) { | 119 if (defined(invoker.testonly)) { |
117 testonly = invoker.testonly | 120 testonly = invoker.testonly |
118 } | 121 } |
119 | 122 |
120 assert(defined(invoker.inputs)) | 123 assert(defined(invoker.inputs)) |
121 assert(defined(invoker.output)) | 124 assert(defined(invoker.output)) |
122 | 125 |
123 rebase_inputs = rebase_path(invoker.inputs, root_build_dir) | 126 rebase_inputs = rebase_path(invoker.inputs, root_build_dir) |
124 rebase_output = rebase_path(invoker.output, root_build_dir) | 127 rebase_output = rebase_path(invoker.output, root_build_dir) |
125 action(target_name) { | 128 action(target_name) { |
(...skipping 22 matching lines...) Expand all Loading... |
148 # Write the target's .build_config file. This is a json file that contains a | 151 # Write the target's .build_config file. This is a json file that contains a |
149 # dictionary of information about how to build this target (things that | 152 # dictionary of information about how to build this target (things that |
150 # require knowledge about this target's dependencies and cannot be calculated | 153 # require knowledge about this target's dependencies and cannot be calculated |
151 # at gn-time). There is a special syntax to add a value in that dictionary to | 154 # at gn-time). There is a special syntax to add a value in that dictionary to |
152 # an action/action_foreachs args: | 155 # an action/action_foreachs args: |
153 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) | 156 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) |
154 # At runtime, such an arg will be replaced by the value in the build_config. | 157 # At runtime, such an arg will be replaced by the value in the build_config. |
155 # See build/android/gyp/write_build_config.py and | 158 # See build/android/gyp/write_build_config.py and |
156 # build/android/gyp/util/build_utils.py:ExpandFileArgs | 159 # build/android/gyp/util/build_utils.py:ExpandFileArgs |
157 template("write_build_config") { | 160 template("write_build_config") { |
| 161 set_sources_assignment_filter([]) |
158 if (defined(invoker.testonly)) { | 162 if (defined(invoker.testonly)) { |
159 testonly = invoker.testonly | 163 testonly = invoker.testonly |
160 } | 164 } |
161 | 165 |
162 assert(defined(invoker.type)) | 166 assert(defined(invoker.type)) |
163 assert(defined(invoker.build_config)) | 167 assert(defined(invoker.build_config)) |
164 | 168 |
165 type = invoker.type | 169 type = invoker.type |
166 build_config = invoker.build_config | 170 build_config = invoker.build_config |
167 | 171 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 if (defined(invoker.srcjar)) { | 285 if (defined(invoker.srcjar)) { |
282 args += [ | 286 args += [ |
283 "--srcjar", | 287 "--srcjar", |
284 rebase_path(invoker.srcjar, root_build_dir), | 288 rebase_path(invoker.srcjar, root_build_dir), |
285 ] | 289 ] |
286 } | 290 } |
287 } | 291 } |
288 } | 292 } |
289 | 293 |
290 template("process_java_prebuilt") { | 294 template("process_java_prebuilt") { |
| 295 set_sources_assignment_filter([]) |
291 if (defined(invoker.testonly)) { | 296 if (defined(invoker.testonly)) { |
292 testonly = invoker.testonly | 297 testonly = invoker.testonly |
293 } | 298 } |
294 | 299 |
295 _input_jar_path = invoker.input_jar_path | 300 _input_jar_path = invoker.input_jar_path |
296 _output_jar_path = invoker.output_jar_path | 301 _output_jar_path = invoker.output_jar_path |
297 _jar_toc_path = _output_jar_path + ".TOC" | 302 _jar_toc_path = _output_jar_path + ".TOC" |
298 | 303 |
299 assert(invoker.build_config != "") | 304 assert(invoker.build_config != "") |
300 | 305 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 group(target_name) { | 373 group(target_name) { |
369 deps = [ | 374 deps = [ |
370 ":${target_name}__jar_toc", | 375 ":${target_name}__jar_toc", |
371 ] | 376 ] |
372 } | 377 } |
373 } | 378 } |
374 | 379 |
375 # Packages resources, assets, dex, and native libraries into an apk. Signs and | 380 # Packages resources, assets, dex, and native libraries into an apk. Signs and |
376 # zipaligns the apk. | 381 # zipaligns the apk. |
377 template("create_apk") { | 382 template("create_apk") { |
| 383 set_sources_assignment_filter([]) |
378 if (defined(invoker.testonly)) { | 384 if (defined(invoker.testonly)) { |
379 testonly = invoker.testonly | 385 testonly = invoker.testonly |
380 } | 386 } |
381 | 387 |
382 _android_manifest = invoker.android_manifest | 388 _android_manifest = invoker.android_manifest |
383 _base_path = invoker.base_path | 389 _base_path = invoker.base_path |
384 _final_apk_path = invoker.apk_path | 390 _final_apk_path = invoker.apk_path |
385 _resources_zip = invoker.resources_zip | 391 _resources_zip = invoker.resources_zip |
386 _dex_path = invoker.dex_path | 392 _dex_path = invoker.dex_path |
387 _keystore_path = invoker.keystore_path | 393 _keystore_path = invoker.keystore_path |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 } | 553 } |
548 | 554 |
549 group(target_name) { | 555 group(target_name) { |
550 deps = [ | 556 deps = [ |
551 ":${target_name}__finalize", | 557 ":${target_name}__finalize", |
552 ] | 558 ] |
553 } | 559 } |
554 } | 560 } |
555 | 561 |
556 template("java_prebuilt_impl") { | 562 template("java_prebuilt_impl") { |
| 563 set_sources_assignment_filter([]) |
557 if (defined(invoker.testonly)) { | 564 if (defined(invoker.testonly)) { |
558 testonly = invoker.testonly | 565 testonly = invoker.testonly |
559 } | 566 } |
560 _supports_android = | 567 _supports_android = |
561 defined(invoker.supports_android) && invoker.supports_android | 568 defined(invoker.supports_android) && invoker.supports_android |
562 | 569 |
563 assert(defined(invoker.jar_path)) | 570 assert(defined(invoker.jar_path)) |
564 _base_path = "${target_gen_dir}/$target_name" | 571 _base_path = "${target_gen_dir}/$target_name" |
565 _jar_path = _base_path + ".jar" | 572 _jar_path = _base_path + ".jar" |
566 _build_config = _base_path + ".build_config" | 573 _build_config = _base_path + ".build_config" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 # Variables | 633 # Variables |
627 # java_files: List of .java files to compile. | 634 # java_files: List of .java files to compile. |
628 # java_deps: List of java dependencies. These should all have a .jar output | 635 # java_deps: List of java dependencies. These should all have a .jar output |
629 # at "${target_gen_dir}/${target_name}.jar. | 636 # at "${target_gen_dir}/${target_name}.jar. |
630 # chromium_code: If true, enable extra warnings. | 637 # chromium_code: If true, enable extra warnings. |
631 # srcjar_deps: List of srcjar dependencies. The .java files contained in the | 638 # srcjar_deps: List of srcjar dependencies. The .java files contained in the |
632 # dependencies srcjar outputs will be compiled and added to the output jar. | 639 # dependencies srcjar outputs will be compiled and added to the output jar. |
633 # jar_path: Use this to explicitly set the output jar path. Defaults to | 640 # jar_path: Use this to explicitly set the output jar path. Defaults to |
634 # "${target_gen_dir}/${target_name}.jar. | 641 # "${target_gen_dir}/${target_name}.jar. |
635 template("compile_java") { | 642 template("compile_java") { |
| 643 set_sources_assignment_filter([]) |
636 if (defined(invoker.testonly)) { | 644 if (defined(invoker.testonly)) { |
637 testonly = invoker.testonly | 645 testonly = invoker.testonly |
638 } | 646 } |
639 | 647 |
640 assert(defined(invoker.java_files)) | 648 assert(defined(invoker.java_files)) |
641 assert(defined(invoker.build_config)) | 649 assert(defined(invoker.build_config)) |
642 assert(defined(invoker.jar_path)) | 650 assert(defined(invoker.jar_path)) |
643 | 651 |
644 _java_files = invoker.java_files | 652 _java_files = invoker.java_files |
645 _final_jar_path = invoker.jar_path | 653 _final_jar_path = invoker.jar_path |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 proguard_config = invoker.proguard_config | 734 proguard_config = invoker.proguard_config |
727 } | 735 } |
728 } | 736 } |
729 | 737 |
730 group(target_name) { | 738 group(target_name) { |
731 deps = _final_deps | 739 deps = _final_deps |
732 } | 740 } |
733 } | 741 } |
734 | 742 |
735 template("java_library_impl") { | 743 template("java_library_impl") { |
| 744 set_sources_assignment_filter([]) |
736 if (defined(invoker.testonly)) { | 745 if (defined(invoker.testonly)) { |
737 testonly = invoker.testonly | 746 testonly = invoker.testonly |
738 } | 747 } |
739 | 748 |
740 assert( | 749 assert( |
741 defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) || | 750 defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) || |
742 defined(invoker.srcjars) || defined(invoker.srcjar_deps)) | 751 defined(invoker.srcjars) || defined(invoker.srcjar_deps)) |
743 _base_path = "$target_gen_dir/$target_name" | 752 _base_path = "$target_gen_dir/$target_name" |
744 _jar_path = _base_path + ".jar" | 753 _jar_path = _base_path + ".jar" |
745 if (defined(invoker.jar_path)) { | 754 if (defined(invoker.jar_path)) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 if (defined(invoker.visibility)) { | 918 if (defined(invoker.visibility)) { |
910 visibility = invoker.visibility | 919 visibility = invoker.visibility |
911 } | 920 } |
912 deps = _final_deps | 921 deps = _final_deps |
913 datadeps = _final_datadeps | 922 datadeps = _final_datadeps |
914 } | 923 } |
915 } | 924 } |
916 | 925 |
917 # Runs process_resources.py | 926 # Runs process_resources.py |
918 template("process_resources") { | 927 template("process_resources") { |
| 928 set_sources_assignment_filter([]) |
919 if (defined(invoker.testonly)) { | 929 if (defined(invoker.testonly)) { |
920 testonly = invoker.testonly | 930 testonly = invoker.testonly |
921 } | 931 } |
922 | 932 |
923 zip_path = invoker.zip_path | 933 zip_path = invoker.zip_path |
924 srcjar_path = invoker.srcjar_path | 934 srcjar_path = invoker.srcjar_path |
925 build_config = invoker.build_config | 935 build_config = invoker.build_config |
926 resource_dirs = invoker.resource_dirs | 936 resource_dirs = invoker.resource_dirs |
927 android_manifest = invoker.android_manifest | 937 android_manifest = invoker.android_manifest |
928 | 938 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 ] | 1009 ] |
1000 } | 1010 } |
1001 | 1011 |
1002 if (defined(invoker.args)) { | 1012 if (defined(invoker.args)) { |
1003 args += invoker.args | 1013 args += invoker.args |
1004 } | 1014 } |
1005 } | 1015 } |
1006 } | 1016 } |
1007 | 1017 |
1008 template("copy_ex") { | 1018 template("copy_ex") { |
| 1019 set_sources_assignment_filter([]) |
1009 if (defined(invoker.testonly)) { | 1020 if (defined(invoker.testonly)) { |
1010 testonly = invoker.testonly | 1021 testonly = invoker.testonly |
1011 } | 1022 } |
1012 | 1023 |
1013 action(target_name) { | 1024 action(target_name) { |
1014 script = "//build/android/gyp/copy_ex.py" | 1025 script = "//build/android/gyp/copy_ex.py" |
1015 | 1026 |
1016 if (defined(invoker.deps)) { | 1027 if (defined(invoker.deps)) { |
1017 deps = invoker.deps | 1028 deps = invoker.deps |
1018 } | 1029 } |
(...skipping 27 matching lines...) Expand all Loading... |
1046 } | 1057 } |
1047 | 1058 |
1048 if (defined(invoker.args)) { | 1059 if (defined(invoker.args)) { |
1049 args += invoker.args | 1060 args += invoker.args |
1050 } | 1061 } |
1051 } | 1062 } |
1052 } | 1063 } |
1053 | 1064 |
1054 # Produces a single .dex.jar out of a set of Java dependencies. | 1065 # Produces a single .dex.jar out of a set of Java dependencies. |
1055 template("deps_dex") { | 1066 template("deps_dex") { |
| 1067 set_sources_assignment_filter([]) |
1056 build_config = "$target_gen_dir/${target_name}.build_config" | 1068 build_config = "$target_gen_dir/${target_name}.build_config" |
1057 write_build_config("${target_name}__build_config") { | 1069 write_build_config("${target_name}__build_config") { |
1058 type = "deps_dex" | 1070 type = "deps_dex" |
1059 deps = invoker.deps | 1071 deps = invoker.deps |
1060 | 1072 |
1061 build_config = build_config | 1073 build_config = build_config |
1062 dex_path = invoker.dex_path | 1074 dex_path = invoker.dex_path |
1063 } | 1075 } |
1064 | 1076 |
1065 rebased_build_config = rebase_path(build_config, root_build_dir) | 1077 rebased_build_config = rebase_path(build_config, root_build_dir) |
1066 dex(target_name) { | 1078 dex(target_name) { |
1067 inputs = [ | 1079 inputs = [ |
1068 build_config, | 1080 build_config, |
1069 ] | 1081 ] |
1070 output = invoker.dex_path | 1082 output = invoker.dex_path |
1071 dex_arg_key = "${rebased_build_config}:final_dex:dependency_dex_files" | 1083 dex_arg_key = "${rebased_build_config}:final_dex:dependency_dex_files" |
1072 args = [ "--inputs=@FileArg($dex_arg_key)" ] | 1084 args = [ "--inputs=@FileArg($dex_arg_key)" ] |
1073 } | 1085 } |
1074 } | 1086 } |
OLD | NEW |