Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: build/config/android/rules.gni

Issue 1680233002: Android Add _incremental targets for instrumentation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing dep Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | testing/test.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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("//base/android/linker/config.gni") 5 import("//base/android/linker/config.gni")
6 import("//build/config/android/config.gni") 6 import("//build/config/android/config.gni")
7 import("//build/config/android/internal_rules.gni") 7 import("//build/config/android/internal_rules.gni")
8 import("//build/config/sanitizers/sanitizers.gni") 8 import("//build/config/sanitizers/sanitizers.gni")
9 import("//build/toolchain/toolchain.gni") 9 import("//build/toolchain/toolchain.gni")
10 import("//third_party/android_platform/config.gni") 10 import("//third_party/android_platform/config.gni")
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 # create_dist_ijar: Whether to define the "${target_name}_dist_ijar" target 1194 # create_dist_ijar: Whether to define the "${target_name}_dist_ijar" target
1195 # (used by instrumentation_test_apk). 1195 # (used by instrumentation_test_apk).
1196 # data_deps: List of dependencies needed at runtime. These will be built but 1196 # data_deps: List of dependencies needed at runtime. These will be built but
1197 # won't change the generated .apk in any way (in fact they may be built 1197 # won't change the generated .apk in any way (in fact they may be built
1198 # after the .apk is). 1198 # after the .apk is).
1199 # deps: List of dependencies. All Android java resources and libraries in the 1199 # deps: List of dependencies. All Android java resources and libraries in the
1200 # "transitive closure" of these dependencies will be included in the apk. 1200 # "transitive closure" of these dependencies will be included in the apk.
1201 # Note: this "transitive closure" actually only includes such targets if 1201 # Note: this "transitive closure" actually only includes such targets if
1202 # they are depended on through android_library or android_resources targets 1202 # they are depended on through android_library or android_resources targets
1203 # (and so not through builtin targets like 'action', 'group', etc). 1203 # (and so not through builtin targets like 'action', 'group', etc).
1204 # install_script_name: Name of wrapper script (default=target_name).
1204 # java_files: List of .java files to include in the apk. 1205 # java_files: List of .java files to include in the apk.
1205 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars 1206 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
1206 # will be added to java_files and be included in this apk. 1207 # will be added to java_files and be included in this apk.
1207 # apk_name: Name for final apk. 1208 # apk_name: Name for final apk.
1208 # final_apk_path: Path to final built apk. Default is 1209 # final_apk_path: Path to final built apk. Default is
1209 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name. 1210 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name.
1210 # loadable_modules: List of paths to native libraries to include. Different 1211 # loadable_modules: List of paths to native libraries to include. Different
1211 # from |native_libs| in that: 1212 # from |native_libs| in that:
1212 # * dependencies of this .so are not automatically included 1213 # * dependencies of this .so are not automatically included
1213 # * ".cr.so" is never added 1214 # * ".cr.so" is never added
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 _final_apk_path = invoker.final_apk_path 1284 _final_apk_path = invoker.final_apk_path
1284 } else if (defined(invoker.apk_name)) { 1285 } else if (defined(invoker.apk_name)) {
1285 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" 1286 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk"
1286 } 1287 }
1287 _final_apk_path_no_ext_list = 1288 _final_apk_path_no_ext_list =
1288 process_file_template([ _final_apk_path ], 1289 process_file_template([ _final_apk_path ],
1289 "{{source_dir}}/{{source_name_part}}") 1290 "{{source_dir}}/{{source_name_part}}")
1290 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] 1291 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0]
1291 assert(_final_apk_path_no_ext != "") # Mark as used. 1292 assert(_final_apk_path_no_ext != "") # Mark as used.
1292 1293
1294 _install_script_name = "install_$_template_name"
1295 if (defined(invoker.install_script_name)) {
1296 _install_script_name = invoker.install_script_name
1297 }
1298 _incremental_install_script_path =
1299 "${root_out_dir}/bin/${_install_script_name}_incremental"
1300
1293 _native_libs = [] 1301 _native_libs = []
1294 1302
1295 _version_code = android_default_version_code 1303 _version_code = android_default_version_code
1296 if (defined(invoker.version_code)) { 1304 if (defined(invoker.version_code)) {
1297 _version_code = invoker.version_code 1305 _version_code = invoker.version_code
1298 } 1306 }
1299 1307
1300 _version_name = android_default_version_name 1308 _version_name = android_default_version_name
1301 if (defined(invoker.version_name)) { 1309 if (defined(invoker.version_name)) {
1302 _version_name = invoker.version_name 1310 _version_name = invoker.version_name
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 1391
1384 _emma_never_instrument = defined(invoker.testonly) && invoker.testonly 1392 _emma_never_instrument = defined(invoker.testonly) && invoker.testonly
1385 1393
1386 build_config_target = "${_template_name}__build_config" 1394 build_config_target = "${_template_name}__build_config"
1387 write_build_config(build_config_target) { 1395 write_build_config(build_config_target) {
1388 forward_variables_from(invoker, [ "apk_under_test" ]) 1396 forward_variables_from(invoker, [ "apk_under_test" ])
1389 type = "android_apk" 1397 type = "android_apk"
1390 jar_path = _jar_path 1398 jar_path = _jar_path
1391 dex_path = final_dex_path 1399 dex_path = final_dex_path
1392 apk_path = _final_apk_path 1400 apk_path = _final_apk_path
1401 incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk"
1402 incremental_install_script_path = _incremental_install_script_path
1393 resources_zip = resources_zip_path 1403 resources_zip = resources_zip_path
1394 build_config = _build_config 1404 build_config = _build_config
1395 android_manifest = _android_manifest 1405 android_manifest = _android_manifest
1396 1406
1397 deps = _native_libs_deps + _android_manifest_deps 1407 deps = _native_libs_deps + _android_manifest_deps
1398 if (defined(invoker.deps)) { 1408 if (defined(invoker.deps)) {
1399 deps += invoker.deps 1409 deps += invoker.deps
1400 } 1410 }
1401 1411
1402 if (defined(invoker.alternative_locale_resource_dep)) { 1412 if (defined(invoker.alternative_locale_resource_dep)) {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 } 1825 }
1816 1826
1817 _create_incremental_script_rule_name = "${_template_name}__incremental_script" 1827 _create_incremental_script_rule_name = "${_template_name}__incremental_script"
1818 action(_create_incremental_script_rule_name) { 1828 action(_create_incremental_script_rule_name) {
1819 script = "//build/android/incremental_install/create_install_script.py" 1829 script = "//build/android/incremental_install/create_install_script.py"
1820 depfile = "$target_gen_dir/$target_name.d" 1830 depfile = "$target_gen_dir/$target_name.d"
1821 deps = [ 1831 deps = [
1822 _native_libs_file_arg_dep, 1832 _native_libs_file_arg_dep,
1823 ] 1833 ]
1824 1834
1825 _generated_script_path =
1826 "${root_out_dir}/bin/install_${_template_name}_incremental"
1827 outputs = [ 1835 outputs = [
1828 depfile, 1836 depfile,
1829 _generated_script_path, 1837 _incremental_install_script_path,
1830 ] 1838 ]
1831 1839
1832 _rebased_apk_path_no_ext = 1840 _rebased_apk_path_no_ext =
1833 rebase_path(_final_apk_path_no_ext, root_build_dir) 1841 rebase_path(_final_apk_path_no_ext, root_build_dir)
1834 _rebased_generated_script_path = 1842 _rebased_incremental_install_script_path =
1835 rebase_path(_generated_script_path, root_build_dir) 1843 rebase_path(_incremental_install_script_path, root_build_dir)
1836 _rebased_depfile = rebase_path(depfile, root_build_dir) 1844 _rebased_depfile = rebase_path(depfile, root_build_dir)
1837 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" 1845 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files"
1838 args = [ 1846 args = [
1839 "--apk-path=${_rebased_apk_path_no_ext}_incremental.apk", 1847 "--apk-path=${_rebased_apk_path_no_ext}_incremental.apk",
1840 "--script-output-path=$_rebased_generated_script_path", 1848 "--script-output-path=$_rebased_incremental_install_script_path",
1841 "--dex-file=$_rebased_lib_dex_path", 1849 "--dex-file=$_rebased_lib_dex_path",
1842 "--dex-file-list=@FileArg($_dex_arg_key)", 1850 "--dex-file-list=@FileArg($_dex_arg_key)",
1843 "--depfile=$_rebased_depfile", 1851 "--depfile=$_rebased_depfile",
1844 ] 1852 ]
1845 if (_proguard_enabled) { 1853 if (_proguard_enabled) {
1846 args += [ "--show-proguard-warning" ] 1854 args += [ "--show-proguard-warning" ]
1847 } 1855 }
1848 if (defined(_native_libs_file_arg)) { 1856 if (defined(_native_libs_file_arg)) {
1849 args += [ "--native-libs=$_native_libs_file_arg" ] 1857 args += [ "--native-libs=$_native_libs_file_arg" ]
1850 } 1858 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 # "android/org/chromium/foo/FooExampleTest.java", 1934 # "android/org/chromium/foo/FooExampleTest.java",
1927 # ] 1935 # ]
1928 # deps = [ 1936 # deps = [
1929 # ":foo_test_support_java" 1937 # ":foo_test_support_java"
1930 # ] 1938 # ]
1931 # } 1939 # }
1932 template("instrumentation_test_apk") { 1940 template("instrumentation_test_apk") {
1933 testonly = true 1941 testonly = true
1934 _apk_target_name = "${target_name}__apk" 1942 _apk_target_name = "${target_name}__apk"
1935 _test_runner_target_name = "${target_name}__test_runner_script" 1943 _test_runner_target_name = "${target_name}__test_runner_script"
1944 _install_script_name = "install_$target_name"
1936 1945
1937 test_runner_script(_test_runner_target_name) { 1946 test_runner_script(_test_runner_target_name) {
1938 forward_variables_from(invoker, 1947 forward_variables_from(invoker,
1939 [ 1948 [
1940 "additional_apks", 1949 "additional_apks",
1950 "apk_under_test",
1941 "isolate_file", 1951 "isolate_file",
1942 ]) 1952 ])
1943 test_name = invoker.target_name 1953 test_name = invoker.target_name
1944 test_type = "instrumentation" 1954 test_type = "instrumentation"
1945 apk_target = ":$_apk_target_name" 1955 apk_target = ":$_apk_target_name"
1946 } 1956 }
1947 1957
1958 test_runner_script("${_test_runner_target_name}_incremental") {
1959 forward_variables_from(invoker,
1960 [
1961 "additional_apks",
1962 "apk_under_test",
1963 "isolate_file",
1964 ])
1965 test_name = "${invoker.target_name}_incremental"
1966 test_type = "instrumentation"
1967 apk_target = ":$_apk_target_name"
1968 incremental_install = true
1969 }
1970
1948 android_apk(_apk_target_name) { 1971 android_apk(_apk_target_name) {
1949 deps = [] 1972 deps = []
1950 data_deps = [] 1973 data_deps = []
1951 forward_variables_from(invoker, "*") 1974 forward_variables_from(invoker, "*")
1975 install_script_name = _install_script_name
1952 deps += [ "//testing/android/broker:broker_java" ] 1976 deps += [ "//testing/android/broker:broker_java" ]
1953 data_deps += [ 1977 data_deps += [
1954 "//testing/android/driver:driver_apk", 1978 "//testing/android/driver:driver_apk",
1955 "//tools/android/forwarder2", 1979 "//tools/android/forwarder2",
1956 "//tools/android/md5sum", 1980 "//tools/android/md5sum",
1957 ] 1981 ]
1958 if (defined(invoker.additional_apks)) { 1982 if (defined(invoker.additional_apks)) {
1959 data_deps += invoker.additional_apks 1983 data_deps += invoker.additional_apks
1960 } 1984 }
1961 1985
1962 create_dist_ijar = true 1986 create_dist_ijar = true
1963 run_findbugs = 1987 run_findbugs =
1964 defined(invoker.run_findbugs) && invoker.run_findbugs && 1988 defined(invoker.run_findbugs) && invoker.run_findbugs &&
1965 (defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)) 1989 (defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir))
1966 } 1990 }
1967 1991
1968 group(target_name) { 1992 group(target_name) {
1969 public_deps = [ 1993 public_deps = [
1970 ":$_apk_target_name", 1994 ":$_apk_target_name",
1971 ":$_test_runner_target_name", 1995 ":$_test_runner_target_name",
1972 1996
1973 # Required by test runner to enumerate test list. 1997 # Required by test runner to enumerate test list.
1974 ":${_apk_target_name}_dist_ijar", 1998 ":${_apk_target_name}_dist_ijar",
1975 ] 1999 ]
1976 } 2000 }
2001 group("${target_name}_incremental") {
2002 public_deps = [
2003 ":${_apk_target_name}_dist_ijar",
2004 ":${_apk_target_name}_incremental",
2005 ":${_test_runner_target_name}_incremental",
2006 "${invoker.apk_under_test}_incremental",
2007 ]
2008 }
1977 } 2009 }
1978 2010
1979 # Declare an Android gtest apk 2011 # Declare an Android gtest apk
1980 # 2012 #
1981 # This target creates an Android apk for running gtest-based unittests. 2013 # This target creates an Android apk for running gtest-based unittests.
1982 # 2014 #
1983 # Variables 2015 # Variables
1984 # deps: Specifies the dependencies of this target. These will be passed to 2016 # deps: Specifies the dependencies of this target. These will be passed to
1985 # the underlying android_apk invocation and should include the java and 2017 # the underlying android_apk invocation and should include the java and
1986 # resource dependencies of the apk. 2018 # resource dependencies of the apk.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 } 2316 }
2285 2317
2286 android_library(target_name) { 2318 android_library(target_name) {
2287 java_files = [] 2319 java_files = []
2288 srcjar_deps = [ ":${_template_name}__protoc_java" ] 2320 srcjar_deps = [ ":${_template_name}__protoc_java" ]
2289 deps = [ 2321 deps = [
2290 "//third_party/android_protobuf:protobuf_nano_javalib", 2322 "//third_party/android_protobuf:protobuf_nano_javalib",
2291 ] 2323 ]
2292 } 2324 }
2293 } 2325 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | testing/test.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698