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 import("//build/config/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
7 | 7 |
8 assert(is_android) | 8 assert(is_android) |
9 | 9 |
10 # These identify targets that have .build_config files (except for android_apk, | 10 # These identify targets that have .build_config files (except for android_apk, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 sources = [] | 95 sources = [] |
96 } | 96 } |
97 | 97 |
98 action(target_name) { | 98 action(target_name) { |
99 set_sources_assignment_filter([]) | 99 set_sources_assignment_filter([]) |
100 build_config = invoker.build_config | 100 build_config = invoker.build_config |
101 | 101 |
102 assert(type == "android_apk" || type == "java_library" || | 102 assert(type == "android_apk" || type == "java_library" || |
103 type == "android_resources" || type == "deps_dex" || | 103 type == "android_resources" || type == "deps_dex" || |
104 type == "android_assets" || type == "resource_rewriter" || | 104 type == "android_assets" || type == "resource_rewriter" || |
105 type == "java_binary" || type == "group") | 105 type == "java_binary" || type == "group" || type == "java_prebuilt") |
106 | 106 |
107 forward_variables_from(invoker, | 107 forward_variables_from(invoker, |
108 [ | 108 [ |
109 "deps", | 109 "deps", |
110 "testonly", | 110 "testonly", |
111 ]) | 111 ]) |
112 if (!defined(deps)) { | 112 if (!defined(deps)) { |
113 deps = [] | 113 deps = [] |
114 } | 114 } |
115 | 115 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 args = [ | 152 args = [ |
153 "--type", | 153 "--type", |
154 type, | 154 type, |
155 "--depfile", | 155 "--depfile", |
156 rebase_path(depfile, root_build_dir), | 156 rebase_path(depfile, root_build_dir), |
157 "--deps-configs=$_rebased_deps_configs", | 157 "--deps-configs=$_rebased_deps_configs", |
158 "--build-config", | 158 "--build-config", |
159 rebase_path(build_config, root_build_dir), | 159 rebase_path(build_config, root_build_dir), |
160 ] | 160 ] |
161 | 161 |
162 is_java = type == "java_library" || type == "java_binary" | 162 is_java = type == "java_library" || type == "java_binary" || |
| 163 type == "java_prebuilt" |
163 is_apk = type == "android_apk" | 164 is_apk = type == "android_apk" |
164 is_android_assets = type == "android_assets" | 165 is_android_assets = type == "android_assets" |
165 is_android_resources = type == "android_resources" | 166 is_android_resources = type == "android_resources" |
166 is_deps_dex = type == "deps_dex" | 167 is_deps_dex = type == "deps_dex" |
167 is_group = type == "group" | 168 is_group = type == "group" |
168 | 169 |
169 supports_android = is_apk || is_android_assets || is_android_resources || | 170 supports_android = is_apk || is_android_assets || is_android_resources || |
170 is_deps_dex || is_group || | 171 is_deps_dex || is_group || |
171 (is_java && defined(invoker.supports_android) && | 172 (is_java && defined(invoker.supports_android) && |
172 invoker.supports_android) | 173 invoker.supports_android) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 _rebased_incremental_apk_path = | 308 _rebased_incremental_apk_path = |
308 rebase_path(invoker.incremental_apk_path, root_build_dir) | 309 rebase_path(invoker.incremental_apk_path, root_build_dir) |
309 _rebased_incremental_install_script_path = | 310 _rebased_incremental_install_script_path = |
310 rebase_path(invoker.incremental_install_script_path, root_build_dir) | 311 rebase_path(invoker.incremental_install_script_path, root_build_dir) |
311 args += [ "--apk-path=$_rebased_apk_path" ] | 312 args += [ "--apk-path=$_rebased_apk_path" ] |
312 args += [ "--incremental-apk-path=$_rebased_incremental_apk_path" ] | 313 args += [ "--incremental-apk-path=$_rebased_incremental_apk_path" ] |
313 args += [ "--incremental-install-script-path=$_rebased_incremental_insta
ll_script_path" ] | 314 args += [ "--incremental-install-script-path=$_rebased_incremental_insta
ll_script_path" ] |
314 } | 315 } |
315 } | 316 } |
316 | 317 |
| 318 if (defined(invoker.java_sources_file)) { |
| 319 args += [ |
| 320 "--java-sources-file", |
| 321 rebase_path(invoker.java_sources_file, root_build_dir), |
| 322 ] |
| 323 } |
317 if (defined(invoker.srcjar)) { | 324 if (defined(invoker.srcjar)) { |
318 args += [ | 325 args += [ |
319 "--srcjar", | 326 "--srcjar", |
320 rebase_path(invoker.srcjar, root_build_dir), | 327 rebase_path(invoker.srcjar, root_build_dir), |
321 ] | 328 ] |
322 } | 329 } |
323 } | 330 } |
324 } | 331 } |
325 | 332 |
326 template("copy_ex") { | 333 template("copy_ex") { |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 "data_deps", | 1039 "data_deps", |
1033 "visibility", | 1040 "visibility", |
1034 ]) | 1041 ]) |
1035 public_deps = [ | 1042 public_deps = [ |
1036 ":$_output_jar_target", | 1043 ":$_output_jar_target", |
1037 ] | 1044 ] |
1038 } | 1045 } |
1039 } | 1046 } |
1040 | 1047 |
1041 template("emma_instr") { | 1048 template("emma_instr") { |
1042 set_sources_assignment_filter([]) | 1049 action(target_name) { |
1043 forward_variables_from(invoker, [ "testonly" ]) | 1050 forward_variables_from(invoker, |
| 1051 [ |
| 1052 "deps", |
| 1053 "testonly", |
| 1054 ]) |
1044 | 1055 |
1045 assert(invoker.source_files != [] || true) # Mark as used | |
1046 | |
1047 if (invoker.emma_instrument) { | |
1048 _output_jar_target = "${target_name}__process" | |
1049 _coverage_file = "$target_out_dir/${target_name}.em" | 1056 _coverage_file = "$target_out_dir/${target_name}.em" |
1050 _source_dirs_listing_file = "$target_out_dir/${target_name}_sources.txt" | 1057 _source_dirs_listing_file = "$target_out_dir/${target_name}_sources.txt" |
1051 _emma_jar = "${android_sdk_root}/tools/lib/emma.jar" | 1058 _emma_jar = "${android_sdk_root}/tools/lib/emma.jar" |
1052 _rebased_source_files = rebase_path(invoker.source_files, root_build_dir) | |
1053 action(_output_jar_target) { | |
1054 forward_variables_from(invoker, [ "deps" ]) | |
1055 | 1059 |
1056 script = "//build/android/gyp/emma_instr.py" | 1060 script = "//build/android/gyp/emma_instr.py" |
1057 depfile = "${target_gen_dir}/${target_name}.d" | 1061 depfile = "${target_gen_dir}/${target_name}.d" |
1058 inputs = [ | 1062 inputs = [ |
1059 _emma_jar, | 1063 _emma_jar, |
1060 invoker.input_jar_path, | 1064 invoker.input_jar_path, |
1061 ] | 1065 ] |
1062 outputs = [ | 1066 outputs = [ |
1063 depfile, | 1067 depfile, |
1064 _coverage_file, | 1068 _coverage_file, |
1065 _source_dirs_listing_file, | 1069 _source_dirs_listing_file, |
1066 invoker.output_jar_path, | 1070 invoker.output_jar_path, |
1067 ] | 1071 ] |
1068 args = [ | 1072 args = [ |
1069 "instrument_jar", | 1073 "instrument_jar", |
1070 "--input-path", | 1074 "--input-path", |
1071 rebase_path(invoker.input_jar_path, root_build_dir), | 1075 rebase_path(invoker.input_jar_path, root_build_dir), |
1072 "--output-path", | 1076 "--output-path", |
1073 rebase_path(invoker.output_jar_path, root_build_dir), | 1077 rebase_path(invoker.output_jar_path, root_build_dir), |
1074 "--depfile", | 1078 "--depfile", |
1075 rebase_path(depfile, root_build_dir), | 1079 rebase_path(depfile, root_build_dir), |
1076 "--coverage-file", | 1080 "--coverage-file", |
1077 rebase_path(_coverage_file, root_build_dir), | 1081 rebase_path(_coverage_file, root_build_dir), |
1078 "--sources-list-file", | 1082 "--sources-list-file", |
1079 rebase_path(_source_dirs_listing_file, root_build_dir), | 1083 rebase_path(_source_dirs_listing_file, root_build_dir), |
1080 "--source-files=$_rebased_source_files", | 1084 "--src-root", |
1081 "--src-root", | 1085 rebase_path("//", root_build_dir), |
1082 rebase_path("//", root_build_dir), | 1086 "--emma-jar", |
1083 "--emma-jar", | 1087 rebase_path(_emma_jar, root_build_dir), |
1084 rebase_path(_emma_jar, root_build_dir), | 1088 ] |
1085 ] | 1089 if (defined(invoker.java_files)) { |
| 1090 _rebased_java_files = rebase_path(invoker.java_files, root_build_dir) |
| 1091 args += [ "--source-files=$_rebased_java_files" ] |
| 1092 } |
| 1093 if (defined(invoker.java_sources_file)) { |
| 1094 _rebased_java_sources_file = |
| 1095 rebase_path(invoker.java_sources_file, root_build_dir) |
| 1096 args += [ "--java-sources-file=$_rebased_java_sources_file" ] |
| 1097 } |
1086 | 1098 |
1087 if (emma_filter != "") { | 1099 if (emma_filter != "") { |
1088 args += [ | 1100 args += [ |
1089 "--filter-string", | 1101 "--filter-string", |
1090 emma_filter, | 1102 emma_filter, |
1091 ] | |
1092 } | |
1093 } | |
1094 } else { | |
1095 _output_jar_target = "${target_name}__copy_jar" | |
1096 copy(_output_jar_target) { | |
1097 forward_variables_from(invoker, [ "deps" ]) | |
1098 | |
1099 sources = [ | |
1100 invoker.input_jar_path, | |
1101 ] | |
1102 outputs = [ | |
1103 invoker.output_jar_path, | |
1104 ] | 1103 ] |
1105 } | 1104 } |
1106 } | 1105 } |
1107 | |
1108 group(target_name) { | |
1109 forward_variables_from(invoker, [ "visibility" ]) | |
1110 public_deps = [ | |
1111 ":$_output_jar_target", | |
1112 ] | |
1113 } | |
1114 } | 1106 } |
1115 | 1107 |
1116 # Creates an unsigned .apk. | 1108 # Creates an unsigned .apk. |
1117 # | 1109 # |
1118 # Variables | 1110 # Variables |
1119 # assets_build_config: Path to android_apk .build_config containing merged | 1111 # assets_build_config: Path to android_apk .build_config containing merged |
1120 # asset information. | 1112 # asset information. |
1121 # deps: Specifies the dependencies of this target. | 1113 # deps: Specifies the dependencies of this target. |
1122 # dex_path: Path to classes.dex file to include (optional). | 1114 # dex_path: Path to classes.dex file to include (optional). |
1123 # resource_packaged_apk_path: Path to .ap_ to use. | 1115 # resource_packaged_apk_path: Path to .ap_ to use. |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 _template_name = target_name | 1673 _template_name = target_name |
1682 | 1674 |
1683 _build_config_target_name = "${_template_name}__build_config" | 1675 _build_config_target_name = "${_template_name}__build_config" |
1684 _process_jar_target_name = "${_template_name}__process_jar" | 1676 _process_jar_target_name = "${_template_name}__process_jar" |
1685 _ijar_target_name = "${_template_name}__ijar" | 1677 _ijar_target_name = "${_template_name}__ijar" |
1686 if (_supports_android) { | 1678 if (_supports_android) { |
1687 _dex_target_name = "${_template_name}__dex" | 1679 _dex_target_name = "${_template_name}__dex" |
1688 } | 1680 } |
1689 | 1681 |
1690 write_build_config(_build_config_target_name) { | 1682 write_build_config(_build_config_target_name) { |
1691 type = "java_library" | 1683 type = "java_prebuilt" |
1692 supports_android = _supports_android | 1684 supports_android = _supports_android |
1693 requires_android = | 1685 requires_android = |
1694 defined(invoker.requires_android) && invoker.requires_android | 1686 defined(invoker.requires_android) && invoker.requires_android |
1695 | 1687 |
1696 if (defined(invoker.deps)) { | 1688 if (defined(invoker.deps)) { |
1697 possible_config_deps = _deps | 1689 possible_config_deps = _deps |
1698 } | 1690 } |
1699 build_config = _build_config | 1691 build_config = _build_config |
1700 jar_path = _jar_path | 1692 jar_path = _jar_path |
1701 if (_supports_android) { | 1693 if (_supports_android) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 } | 1783 } |
1792 | 1784 |
1793 # Compiles and jars a set of java files. | 1785 # Compiles and jars a set of java files. |
1794 # | 1786 # |
1795 # Outputs: | 1787 # Outputs: |
1796 # $jar_path.jar | 1788 # $jar_path.jar |
1797 # $jar_path.interface.jar | 1789 # $jar_path.interface.jar |
1798 # | 1790 # |
1799 # Variables | 1791 # Variables |
1800 # java_files: List of .java files to compile. | 1792 # java_files: List of .java files to compile. |
| 1793 # java_sources_file: Path to file containing list of files to compile. |
1801 # chromium_code: If true, enable extra warnings. | 1794 # chromium_code: If true, enable extra warnings. |
1802 # srcjar_deps: List of srcjar dependencies. The .java files contained in the | 1795 # srcjar_deps: List of srcjar dependencies. The .java files contained in the |
1803 # dependencies srcjar outputs will be compiled and added to the output jar
. | 1796 # dependencies srcjar outputs will be compiled and added to the output jar
. |
1804 # jar_path: Use this to explicitly set the output jar path. Defaults to | 1797 # jar_path: Use this to explicitly set the output jar path. Defaults to |
1805 # "${target_gen_dir}/${target_name}.jar. | 1798 # "${target_gen_dir}/${target_name}.jar. |
1806 template("compile_java") { | 1799 template("compile_java") { |
1807 set_sources_assignment_filter([]) | 1800 set_sources_assignment_filter([]) |
1808 forward_variables_from(invoker, [ "testonly" ]) | 1801 forward_variables_from(invoker, [ "testonly" ]) |
1809 | 1802 |
1810 assert(defined(invoker.java_files)) | 1803 assert(defined(invoker.java_files) || defined(invoker.java_sources_file)) |
1811 assert(defined(invoker.build_config)) | 1804 assert(defined(invoker.build_config)) |
1812 assert(defined(invoker.jar_path)) | 1805 assert(defined(invoker.jar_path)) |
1813 | 1806 |
1814 _java_files = invoker.java_files | |
1815 _final_jar_path = invoker.jar_path | |
1816 _javac_jar_path = "$target_gen_dir/$target_name.javac.jar" | |
1817 _process_prebuilt_jar_path = | |
1818 "$target_gen_dir/$target_name.process_prebuilt.jar" | |
1819 _final_ijar_path = get_path_info(_final_jar_path, "dir") + "/" + | |
1820 get_path_info(_final_jar_path, "name") + ".interface.jar" | |
1821 | |
1822 _build_config = invoker.build_config | 1807 _build_config = invoker.build_config |
1823 | 1808 |
1824 _input_jars_paths = [] | 1809 _input_jars_paths = [] |
1825 if (defined(invoker.input_jars_paths)) { | 1810 if (defined(invoker.input_jars_paths)) { |
1826 _input_jars_paths += invoker.input_jars_paths | 1811 _input_jars_paths += invoker.input_jars_paths |
1827 } | 1812 } |
1828 | 1813 |
1829 _chromium_code = false | 1814 _chromium_code = false |
1830 if (defined(invoker.chromium_code)) { | 1815 if (defined(invoker.chromium_code)) { |
1831 _chromium_code = invoker.chromium_code | 1816 _chromium_code = invoker.chromium_code |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 } | 1869 } |
1885 foreach(dep, _srcjar_deps) { | 1870 foreach(dep, _srcjar_deps) { |
1886 _dep_gen_dir = get_label_info(dep, "target_gen_dir") | 1871 _dep_gen_dir = get_label_info(dep, "target_gen_dir") |
1887 _dep_name = get_label_info(dep, "name") | 1872 _dep_name = get_label_info(dep, "name") |
1888 _java_srcjars += [ "$_dep_gen_dir/$_dep_name.srcjar" ] | 1873 _java_srcjars += [ "$_dep_gen_dir/$_dep_name.srcjar" ] |
1889 } | 1874 } |
1890 | 1875 |
1891 # Mark srcjar_deps as used. | 1876 # Mark srcjar_deps as used. |
1892 assert(_srcjar_deps == [] || true) | 1877 assert(_srcjar_deps == [] || true) |
1893 | 1878 |
| 1879 _javac_target_name = "${target_name}__javac" |
| 1880 _process_prebuilt_target_name = "${target_name}__process_prebuilt" |
| 1881 _ijar_target_name = "${target_name}__ijar" |
| 1882 _final_target_name = target_name |
| 1883 |
| 1884 _final_jar_path = invoker.jar_path |
| 1885 _javac_jar_path = "$target_gen_dir/$target_name.javac.jar" |
| 1886 _process_prebuilt_jar_path = _final_jar_path |
| 1887 _final_ijar_path = get_path_info(_final_jar_path, "dir") + "/" + |
| 1888 get_path_info(_final_jar_path, "name") + ".interface.jar" |
| 1889 |
| 1890 _emma_instrument = |
| 1891 defined(invoker.emma_instrument) && invoker.emma_instrument |
| 1892 if (_emma_instrument) { |
| 1893 _emma_instr_target_name = "${target_name}__emma_instr" |
| 1894 _process_prebuilt_jar_path = |
| 1895 "$target_gen_dir/$target_name.process_prebuilt.jar" |
| 1896 } |
| 1897 |
1894 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 1898 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
1895 _rebased_jar_path = rebase_path(_javac_jar_path, root_build_dir) | 1899 _rebased_jar_path = rebase_path(_javac_jar_path, root_build_dir) |
1896 | 1900 |
1897 _javac_target_name = "${target_name}__javac" | |
1898 _process_prebuilt_target_name = "${target_name}__process_prebuilt" | |
1899 _emma_instr_target_name = "${target_name}__emma_instr" | |
1900 _ijar_target_name = "${target_name}__ijar" | |
1901 _final_target_name = target_name | |
1902 | |
1903 action(_javac_target_name) { | 1901 action(_javac_target_name) { |
1904 script = "//build/android/gyp/javac.py" | 1902 script = "//build/android/gyp/javac.py" |
1905 depfile = "$target_gen_dir/$target_name.d" | 1903 depfile = "$target_gen_dir/$target_name.d" |
1906 deps = _srcjar_deps | 1904 deps = _srcjar_deps |
1907 if (defined(invoker.deps)) { | 1905 if (defined(invoker.deps)) { |
1908 deps += invoker.deps | 1906 deps += invoker.deps |
1909 } | 1907 } |
1910 | 1908 |
1911 outputs = [ | 1909 outputs = [ |
1912 depfile, | 1910 depfile, |
1913 _javac_jar_path, | 1911 _javac_jar_path, |
1914 _javac_jar_path + ".md5.stamp", | 1912 _javac_jar_path + ".md5.stamp", |
1915 ] | 1913 ] |
1916 sources = _java_files + _java_srcjars | 1914 sources = _java_srcjars |
| 1915 if (defined(invoker.java_files)) { |
| 1916 sources += invoker.java_files |
| 1917 } |
1917 inputs = [ | 1918 inputs = [ |
1918 _build_config, | 1919 _build_config, |
1919 ] | 1920 ] |
| 1921 if (defined(invoker.java_sources_file)) { |
| 1922 inputs += [ invoker.java_sources_file ] |
| 1923 } |
1920 | 1924 |
1921 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir) | 1925 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir) |
1922 _rebased_depfile = rebase_path(depfile, root_build_dir) | 1926 _rebased_depfile = rebase_path(depfile, root_build_dir) |
1923 args = [ | 1927 args = [ |
1924 "--depfile=$_rebased_depfile", | 1928 "--depfile=$_rebased_depfile", |
1925 "--jar-path=$_rebased_jar_path", | 1929 "--jar-path=$_rebased_jar_path", |
1926 "--java-srcjars=$_rebased_java_srcjars", | 1930 "--java-srcjars=$_rebased_java_srcjars", |
1927 "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)", | 1931 "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)", |
1928 ] | 1932 ] |
1929 if (_enable_interface_jars_javac) { | 1933 if (_enable_interface_jars_javac) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 } | 1973 } |
1970 foreach(e, _provider_configurations) { | 1974 foreach(e, _provider_configurations) { |
1971 args += [ "--provider-configuration=" + rebase_path(e, root_build_dir) ] | 1975 args += [ "--provider-configuration=" + rebase_path(e, root_build_dir) ] |
1972 } | 1976 } |
1973 foreach(e, _processors) { | 1977 foreach(e, _processors) { |
1974 args += [ "--processor=" + e ] | 1978 args += [ "--processor=" + e ] |
1975 } | 1979 } |
1976 foreach(e, _processor_args) { | 1980 foreach(e, _processor_args) { |
1977 args += [ "--processor-arg=" + e ] | 1981 args += [ "--processor-arg=" + e ] |
1978 } | 1982 } |
1979 args += rebase_path(_java_files, root_build_dir) | 1983 if (defined(invoker.java_files)) { |
| 1984 args += rebase_path(invoker.java_files, root_build_dir) |
| 1985 } |
| 1986 if (defined(invoker.java_sources_file)) { |
| 1987 args += [ "@" + rebase_path(invoker.java_sources_file, root_build_dir) ] |
| 1988 } |
1980 } | 1989 } |
1981 | 1990 |
1982 process_java_prebuilt(_process_prebuilt_target_name) { | 1991 process_java_prebuilt(_process_prebuilt_target_name) { |
1983 forward_variables_from(invoker, [ "jar_excluded_patterns" ]) | 1992 forward_variables_from(invoker, [ "jar_excluded_patterns" ]) |
1984 build_config = _build_config | 1993 build_config = _build_config |
1985 input_jar_path = _javac_jar_path | 1994 input_jar_path = _javac_jar_path |
1986 output_jar_path = _process_prebuilt_jar_path | 1995 output_jar_path = _process_prebuilt_jar_path |
1987 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 1996 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
1988 proguard_preprocess = invoker.proguard_preprocess | 1997 proguard_preprocess = invoker.proguard_preprocess |
1989 proguard_config = invoker.proguard_config | 1998 proguard_config = invoker.proguard_config |
1990 } | 1999 } |
1991 deps = [ | 2000 deps = [ |
1992 ":$_javac_target_name", | 2001 ":$_javac_target_name", |
1993 ] | 2002 ] |
1994 if (defined(invoker.deps)) { | 2003 if (defined(invoker.deps)) { |
1995 deps += invoker.deps | 2004 deps += invoker.deps |
1996 } | 2005 } |
1997 } | 2006 } |
1998 | 2007 |
1999 emma_instr(_emma_instr_target_name) { | 2008 if (_emma_instrument) { |
2000 visibility = [ | 2009 emma_instr(_emma_instr_target_name) { |
2001 ":$_ijar_target_name", | 2010 forward_variables_from(invoker, |
2002 ":$_final_target_name", | 2011 [ |
2003 ] | 2012 "java_files", |
| 2013 "java_sources_file", |
| 2014 ]) |
2004 | 2015 |
2005 forward_variables_from(invoker, [ "emma_instrument" ]) | 2016 input_jar_path = _process_prebuilt_jar_path |
| 2017 output_jar_path = _final_jar_path |
2006 | 2018 |
2007 input_jar_path = _process_prebuilt_jar_path | 2019 deps = [ |
2008 output_jar_path = _final_jar_path | 2020 ":$_process_prebuilt_target_name", |
2009 source_files = _java_files | 2021 ] |
2010 | 2022 } |
2011 deps = [ | |
2012 ":$_process_prebuilt_target_name", | |
2013 ] | |
2014 } | 2023 } |
2015 | 2024 |
2016 generate_interface_jar(_ijar_target_name) { | 2025 generate_interface_jar(_ijar_target_name) { |
2017 input_jar = _final_jar_path | 2026 input_jar = _final_jar_path |
2018 output_jar = _final_ijar_path | 2027 output_jar = _final_ijar_path |
2019 deps = [ | 2028 if (_emma_instrument) { |
2020 ":$_emma_instr_target_name", | 2029 deps = [ |
2021 ] | 2030 ":$_emma_instr_target_name", |
| 2031 ] |
| 2032 } else { |
| 2033 deps = [ |
| 2034 ":$_process_prebuilt_target_name", |
| 2035 ] |
| 2036 } |
2022 } | 2037 } |
2023 | 2038 |
2024 group(_final_target_name) { | 2039 group(_final_target_name) { |
2025 forward_variables_from(invoker, [ "visibility" ]) | 2040 forward_variables_from(invoker, [ "visibility" ]) |
2026 public_deps = [ | 2041 public_deps = [ |
2027 ":$_emma_instr_target_name", | |
2028 ":$_ijar_target_name", | 2042 ":$_ijar_target_name", |
2029 ] | 2043 ] |
| 2044 if (_emma_instrument) { |
| 2045 public_deps += [ ":$_emma_instr_target_name" ] |
| 2046 } else { |
| 2047 public_deps += [ ":$_process_prebuilt_target_name" ] |
| 2048 } |
2030 } | 2049 } |
2031 } | 2050 } |
2032 | 2051 |
2033 template("java_library_impl") { | 2052 template("java_library_impl") { |
2034 set_sources_assignment_filter([]) | 2053 set_sources_assignment_filter([]) |
2035 forward_variables_from(invoker, [ "testonly" ]) | 2054 forward_variables_from(invoker, [ "testonly" ]) |
2036 _accumulated_deps = [] | 2055 _accumulated_deps = [] |
2037 if (defined(invoker.deps)) { | 2056 if (defined(invoker.deps)) { |
2038 _accumulated_deps = invoker.deps | 2057 _accumulated_deps = invoker.deps |
2039 } | 2058 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 assert(_emma_never_instrument || true) # Mark as used | 2124 assert(_emma_never_instrument || true) # Mark as used |
2106 _emma_instrument = emma_coverage && !_emma_never_instrument | 2125 _emma_instrument = emma_coverage && !_emma_never_instrument |
2107 | 2126 |
2108 if (_supports_android) { | 2127 if (_supports_android) { |
2109 _dex_path = _base_path + ".dex.jar" | 2128 _dex_path = _base_path + ".dex.jar" |
2110 if (defined(invoker.dex_path)) { | 2129 if (defined(invoker.dex_path)) { |
2111 _dex_path = invoker.dex_path | 2130 _dex_path = invoker.dex_path |
2112 } | 2131 } |
2113 } | 2132 } |
2114 | 2133 |
| 2134 _java_files = [] |
| 2135 if (defined(invoker.java_files)) { |
| 2136 _java_files += invoker.java_files |
| 2137 } |
| 2138 if (_java_files != []) { |
| 2139 _java_sources_file = "$_base_path.sources" |
| 2140 write_file(_java_sources_file, rebase_path(_java_files, root_build_dir)) |
| 2141 } |
| 2142 |
2115 # Define build_config_deps which will be a list of targets required to | 2143 # Define build_config_deps which will be a list of targets required to |
2116 # build the _build_config. | 2144 # build the _build_config. |
2117 if (defined(invoker.override_build_config)) { | 2145 if (defined(invoker.override_build_config)) { |
2118 _build_config = invoker.override_build_config | 2146 _build_config = invoker.override_build_config |
2119 } else { | 2147 } else { |
2120 _build_config = _base_path + ".build_config" | 2148 _build_config = _base_path + ".build_config" |
2121 build_config_target_name = "${_template_name}__build_config" | 2149 build_config_target_name = "${_template_name}__build_config" |
2122 | 2150 |
2123 write_build_config(build_config_target_name) { | 2151 write_build_config(build_config_target_name) { |
2124 if (defined(invoker.is_java_binary) && invoker.is_java_binary) { | 2152 if (defined(invoker.is_java_binary) && invoker.is_java_binary) { |
2125 type = "java_binary" | 2153 type = "java_binary" |
2126 } else { | 2154 } else { |
2127 type = "java_library" | 2155 type = "java_library" |
2128 } | 2156 } |
2129 if (defined(invoker.deps)) { | 2157 if (defined(invoker.deps)) { |
2130 possible_config_deps = invoker.deps | 2158 possible_config_deps = invoker.deps |
2131 } | 2159 } |
2132 supports_android = _supports_android | 2160 supports_android = _supports_android |
2133 requires_android = _requires_android | 2161 requires_android = _requires_android |
2134 bypass_platform_checks = defined(invoker.bypass_platform_checks) && | 2162 bypass_platform_checks = defined(invoker.bypass_platform_checks) && |
2135 invoker.bypass_platform_checks | 2163 invoker.bypass_platform_checks |
2136 | 2164 |
2137 build_config = _build_config | 2165 build_config = _build_config |
2138 jar_path = _jar_path | 2166 jar_path = _jar_path |
2139 if (_supports_android) { | 2167 if (_supports_android) { |
2140 dex_path = _dex_path | 2168 dex_path = _dex_path |
2141 } | 2169 } |
| 2170 if (_java_files != []) { |
| 2171 java_sources_file = _java_sources_file |
| 2172 } |
2142 } | 2173 } |
2143 _accumulated_deps += [ ":$build_config_target_name" ] | 2174 _accumulated_deps += [ ":$build_config_target_name" ] |
2144 } | 2175 } |
2145 | 2176 |
2146 _srcjar_deps = [] | 2177 _srcjar_deps = [] |
2147 if (defined(invoker.srcjar_deps)) { | 2178 if (defined(invoker.srcjar_deps)) { |
2148 _srcjar_deps = invoker.srcjar_deps | 2179 _srcjar_deps = invoker.srcjar_deps |
2149 } | 2180 } |
2150 | 2181 |
2151 _srcjars = [] | 2182 _srcjars = [] |
2152 if (defined(invoker.srcjars)) { | 2183 if (defined(invoker.srcjars)) { |
2153 _srcjars = invoker.srcjars | 2184 _srcjars = invoker.srcjars |
2154 } | 2185 } |
2155 | 2186 |
2156 _java_files = [] | |
2157 if (defined(invoker.java_files)) { | |
2158 _java_files += invoker.java_files | |
2159 } | |
2160 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != []) | 2187 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != []) |
2161 | 2188 |
2162 _compile_java_target = "${_template_name}__compile_java" | 2189 _compile_java_target = "${_template_name}__compile_java" |
2163 _final_deps += [ ":$_compile_java_target" ] | 2190 _final_deps += [ ":$_compile_java_target" ] |
2164 compile_java(_compile_java_target) { | 2191 compile_java(_compile_java_target) { |
2165 forward_variables_from(invoker, | 2192 forward_variables_from(invoker, |
2166 [ | 2193 [ |
2167 "alternative_android_sdk_ijar", | 2194 "alternative_android_sdk_ijar", |
2168 "alternative_android_sdk_ijar_dep", | 2195 "alternative_android_sdk_ijar_dep", |
2169 "dist_jar_path", | 2196 "dist_jar_path", |
2170 "enable_errorprone", | 2197 "enable_errorprone", |
2171 "enable_incremental_javac_override", | 2198 "enable_incremental_javac_override", |
2172 "input_jars_paths", | 2199 "input_jars_paths", |
2173 "jar_excluded_patterns", | 2200 "jar_excluded_patterns", |
2174 "manifest_entries", | 2201 "manifest_entries", |
2175 "processors_javac", | 2202 "processors_javac", |
2176 "processor_args_javac", | 2203 "processor_args_javac", |
2177 "proguard_config", | 2204 "proguard_config", |
2178 "proguard_preprocess", | 2205 "proguard_preprocess", |
2179 "provider_configurations", | 2206 "provider_configurations", |
2180 ]) | 2207 ]) |
2181 jar_path = _jar_path | 2208 jar_path = _jar_path |
2182 build_config = _build_config | 2209 build_config = _build_config |
2183 java_files = _java_files | 2210 if (_java_files != []) { |
| 2211 java_sources_file = _java_sources_file |
| 2212 } else { |
| 2213 java_files = [] |
| 2214 } |
2184 srcjar_deps = _srcjar_deps | 2215 srcjar_deps = _srcjar_deps |
2185 srcjars = _srcjars | 2216 srcjars = _srcjars |
2186 chromium_code = _chromium_code | 2217 chromium_code = _chromium_code |
2187 supports_android = _supports_android | 2218 supports_android = _supports_android |
2188 emma_instrument = _emma_instrument | 2219 emma_instrument = _emma_instrument |
2189 deps = _accumulated_deps | 2220 deps = _accumulated_deps |
2190 } | 2221 } |
2191 _accumulated_deps += [ ":$_compile_java_target" ] | 2222 _accumulated_deps += [ ":$_compile_java_target" ] |
2192 assert(_accumulated_deps != []) # Mark used. | 2223 assert(_accumulated_deps != []) # Mark used. |
2193 | 2224 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 outputs = [ | 2535 outputs = [ |
2505 depfile, | 2536 depfile, |
2506 invoker.out_manifest, | 2537 invoker.out_manifest, |
2507 ] | 2538 ] |
2508 inputs = [ | 2539 inputs = [ |
2509 invoker.main_manifest, | 2540 invoker.main_manifest, |
2510 ] | 2541 ] |
2511 } | 2542 } |
2512 } | 2543 } |
2513 } | 2544 } |
OLD | NEW |