Chromium Code Reviews| 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("//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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1184 # and (possibly) native libraries. | 1184 # and (possibly) native libraries. |
| 1185 # | 1185 # |
| 1186 # Variables | 1186 # Variables |
| 1187 # alternative_android_sdk_jar: The alternative android sdk jar used in | 1187 # alternative_android_sdk_jar: The alternative android sdk jar used in |
| 1188 # proguard. | 1188 # proguard. |
| 1189 # android_aapt_path: Android aapt tool to replace default one to build | 1189 # android_aapt_path: Android aapt tool to replace default one to build |
| 1190 # resource. | 1190 # resource. |
| 1191 # android_manifest: Path to AndroidManifest.xml. | 1191 # android_manifest: Path to AndroidManifest.xml. |
| 1192 # android_manifest_dep: Target that generates AndroidManifest (if applicable) | 1192 # android_manifest_dep: Target that generates AndroidManifest (if applicable) |
| 1193 # chromium_code: If true, extra analysis warning/errors will be enabled. | 1193 # chromium_code: If true, extra analysis warning/errors will be enabled. |
| 1194 # create_dist_ijar: Whether to define the "${target_name}_dist_ijar" target | |
| 1195 # (used by instrumentation_test_apk). | |
| 1194 # 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 |
| 1195 # 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 |
| 1196 # after the .apk is). | 1198 # after the .apk is). |
| 1197 # 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 |
| 1198 # "transitive closure" of these dependencies will be included in the apk. | 1200 # "transitive closure" of these dependencies will be included in the apk. |
| 1199 # Note: this "transitive closure" actually only includes such targets if | 1201 # Note: this "transitive closure" actually only includes such targets if |
| 1200 # they are depended on through android_library or android_resources targets | 1202 # they are depended on through android_library or android_resources targets |
| 1201 # (and so not through builtin targets like 'action', 'group', etc). | 1203 # (and so not through builtin targets like 'action', 'group', etc). |
| 1202 # java_files: List of .java files to include in the apk. | 1204 # java_files: List of .java files to include in the apk. |
| 1203 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars | 1205 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1275 final_dex_path = "$gen_dir/classes.dex" | 1277 final_dex_path = "$gen_dir/classes.dex" |
| 1276 } | 1278 } |
| 1277 final_dex_target_name = "${_template_name}__final_dex" | 1279 final_dex_target_name = "${_template_name}__final_dex" |
| 1278 | 1280 |
| 1279 _final_apk_path = "" | 1281 _final_apk_path = "" |
| 1280 if (defined(invoker.final_apk_path)) { | 1282 if (defined(invoker.final_apk_path)) { |
| 1281 _final_apk_path = invoker.final_apk_path | 1283 _final_apk_path = invoker.final_apk_path |
| 1282 } else if (defined(invoker.apk_name)) { | 1284 } else if (defined(invoker.apk_name)) { |
| 1283 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" | 1285 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" |
| 1284 } | 1286 } |
| 1285 _dist_jar_path_list = | |
| 1286 process_file_template( | |
| 1287 [ _final_apk_path ], | |
| 1288 "$root_build_dir/test.lib.java/{{source_name_part}}.jar") | |
| 1289 _dist_jar_path = _dist_jar_path_list[0] | |
| 1290 _final_apk_path_no_ext_list = | 1287 _final_apk_path_no_ext_list = |
| 1291 process_file_template([ _final_apk_path ], | 1288 process_file_template([ _final_apk_path ], |
| 1292 "{{source_dir}}/{{source_name_part}}") | 1289 "{{source_dir}}/{{source_name_part}}") |
| 1293 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] | 1290 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] |
| 1294 assert(_final_apk_path_no_ext != "") # Mark as used. | 1291 assert(_final_apk_path_no_ext != "") # Mark as used. |
| 1295 | 1292 |
| 1296 _native_libs = [] | 1293 _native_libs = [] |
| 1297 | 1294 |
| 1298 _version_code = android_default_version_code | 1295 _version_code = android_default_version_code |
| 1299 if (defined(invoker.version_code)) { | 1296 if (defined(invoker.version_code)) { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1523 srcjar_deps = _srcjar_deps | 1520 srcjar_deps = _srcjar_deps |
| 1524 jar_path = _jar_path | 1521 jar_path = _jar_path |
| 1525 dex_path = _lib_dex_path | 1522 dex_path = _lib_dex_path |
| 1526 emma_never_instrument = _emma_never_instrument | 1523 emma_never_instrument = _emma_never_instrument |
| 1527 | 1524 |
| 1528 if (defined(invoker.deps)) { | 1525 if (defined(invoker.deps)) { |
| 1529 deps += invoker.deps | 1526 deps += invoker.deps |
| 1530 } | 1527 } |
| 1531 } | 1528 } |
| 1532 | 1529 |
| 1533 if (_dist_jar_path != "") { | 1530 # TODO(cjhopman): This is only ever needed to calculate the list of tests to |
| 1534 create_dist_target = "${_template_name}__create_dist_jar" | 1531 # run. See build/android/pylib/instrumentation/test_jar.py. We should be |
| 1535 _final_deps += [ ":$create_dist_target" ] | 1532 # able to just do that calculation at build time instead. |
| 1536 | 1533 if (defined(invoker.create_dist_ijar) && invoker.create_dist_ijar) { |
| 1537 # TODO(cjhopman): This is only ever needed to calculate the list of tests to | 1534 _dist_ijar_path = "$root_build_dir/test.lib.java/" + |
| 1538 # run. See build/android/pylib/instrumentation/test_jar.py. We should be | 1535 get_path_info(_final_apk_path, "name") + ".jar" |
| 1539 # able to just do that calculation at build time instead. | 1536 action("${_template_name}_dist_ijar") { |
| 1540 action(create_dist_target) { | |
| 1541 script = "//build/android/gyp/create_dist_jar.py" | 1537 script = "//build/android/gyp/create_dist_jar.py" |
| 1542 depfile = "$target_gen_dir/$target_name.d" | 1538 depfile = "$target_gen_dir/$target_name.d" |
| 1543 inputs = [ | 1539 inputs = [ |
| 1544 _build_config, | 1540 _build_config, |
| 1545 ] | 1541 ] |
| 1546 outputs = [ | 1542 outputs = [ |
| 1547 depfile, | 1543 depfile, |
| 1548 _dist_jar_path, | 1544 "${_dist_ijar_path}", |
| 1549 ] | 1545 ] |
| 1550 args = [ | 1546 args = [ |
| 1551 "--depfile", | 1547 "--depfile", |
| 1552 rebase_path(depfile, root_build_dir), | 1548 rebase_path(depfile, root_build_dir), |
| 1553 "--output", | 1549 "--output", |
| 1554 rebase_path(_dist_jar_path, root_build_dir), | 1550 rebase_path("${_dist_ijar_path}", root_build_dir), |
| 1551 "--use-ijars", | |
|
jbudorick
2016/02/08 16:24:12
also, why is this GN-only?
agrieve
2016/02/08 16:42:01
When I first added ijars, I was too lazy to port t
jbudorick
2016/02/08 16:59:11
assuming you mean dist jars here instead of ijars
| |
| 1555 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", | 1552 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", |
| 1556 ] | 1553 ] |
| 1557 inputs += [ _jar_path ] | 1554 inputs += [ _jar_path ] |
| 1558 _rebased_jar_path = rebase_path([ _jar_path ], root_build_dir) | 1555 _rebased_jar_path = rebase_path([ _jar_path ], root_build_dir) |
| 1559 args += [ "--inputs=$_rebased_jar_path" ] | 1556 args += [ "--inputs=$_rebased_jar_path" ] |
| 1560 deps = [ | 1557 deps = [ |
| 1561 ":$build_config_target", # Generates the build config file. | 1558 ":$build_config_target", # Generates the build config file. |
| 1562 ":$java_target", # Generates the jar file. | 1559 ":$java_target", # Generates the jar file. |
| 1563 ] | 1560 ] |
| 1564 } | 1561 } |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1955 deps += [ "//testing/android/broker:broker_java" ] | 1952 deps += [ "//testing/android/broker:broker_java" ] |
| 1956 data_deps += [ | 1953 data_deps += [ |
| 1957 "//testing/android/driver:driver_apk", | 1954 "//testing/android/driver:driver_apk", |
| 1958 "//tools/android/forwarder2", | 1955 "//tools/android/forwarder2", |
| 1959 "//tools/android/md5sum", | 1956 "//tools/android/md5sum", |
| 1960 ] | 1957 ] |
| 1961 if (defined(invoker.additional_apks)) { | 1958 if (defined(invoker.additional_apks)) { |
| 1962 data_deps += invoker.additional_apks | 1959 data_deps += invoker.additional_apks |
| 1963 } | 1960 } |
| 1964 | 1961 |
| 1962 create_dist_ijar = true | |
| 1965 run_findbugs = | 1963 run_findbugs = |
| 1966 defined(invoker.run_findbugs) && invoker.run_findbugs && | 1964 defined(invoker.run_findbugs) && invoker.run_findbugs && |
| 1967 (defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)) | 1965 (defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)) |
| 1968 } | 1966 } |
| 1969 | 1967 |
| 1970 group(target_name) { | 1968 group(target_name) { |
| 1971 public_deps = [ | 1969 public_deps = [ |
| 1972 ":$_apk_target_name", | 1970 ":$_apk_target_name", |
| 1973 ":$_test_runner_target_name", | 1971 ":$_test_runner_target_name", |
| 1972 | |
| 1973 # Required by test runner to enumerate test list. | |
| 1974 ":${_apk_target_name}_dist_ijar", | |
| 1974 ] | 1975 ] |
| 1975 } | 1976 } |
| 1976 } | 1977 } |
| 1977 | 1978 |
| 1978 # Declare an Android gtest apk | 1979 # Declare an Android gtest apk |
| 1979 # | 1980 # |
| 1980 # This target creates an Android apk for running gtest-based unittests. | 1981 # This target creates an Android apk for running gtest-based unittests. |
| 1981 # | 1982 # |
| 1982 # Variables | 1983 # Variables |
| 1983 # deps: Specifies the dependencies of this target. These will be passed to | 1984 # deps: Specifies the dependencies of this target. These will be passed to |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2283 } | 2284 } |
| 2284 | 2285 |
| 2285 android_library(target_name) { | 2286 android_library(target_name) { |
| 2286 java_files = [] | 2287 java_files = [] |
| 2287 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2288 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
| 2288 deps = [ | 2289 deps = [ |
| 2289 "//third_party/android_protobuf:protobuf_nano_javalib", | 2290 "//third_party/android_protobuf:protobuf_nano_javalib", |
| 2290 ] | 2291 ] |
| 2291 } | 2292 } |
| 2292 } | 2293 } |
| OLD | NEW |