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

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

Issue 2082453003: 🎅 Use GN's dependency info for native libraries in write_build_config.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix osmesa on non-android Created 4 years, 6 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
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("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/android/internal_rules.gni") 6 import("//build/config/android/internal_rules.gni")
7 import("//build/toolchain/toolchain.gni") 7 import("//build/toolchain/toolchain.gni")
8 8
9 assert(is_android) 9 assert(is_android)
10 10
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 # they are depended on through android_library or android_resources target s 1382 # they are depended on through android_library or android_resources target s
1383 # (and so not through builtin targets like 'action', 'group', etc). 1383 # (and so not through builtin targets like 'action', 'group', etc).
1384 # install_script_name: Name of wrapper script (default=target_name). 1384 # install_script_name: Name of wrapper script (default=target_name).
1385 # java_files: List of .java files to include in the apk. 1385 # java_files: List of .java files to include in the apk.
1386 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars 1386 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
1387 # will be added to java_files and be included in this apk. 1387 # will be added to java_files and be included in this apk.
1388 # apk_name: Name for final apk. 1388 # apk_name: Name for final apk.
1389 # final_apk_path: Path to final built apk. Default is 1389 # final_apk_path: Path to final built apk. Default is
1390 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name. 1390 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name.
1391 # loadable_modules: List of paths to native libraries to include. Different 1391 # loadable_modules: List of paths to native libraries to include. Different
1392 # from |native_libs| in that: 1392 # from |shared_libraries| in that:
1393 # * dependencies of this .so are not automatically included 1393 # * dependencies of this .so are not automatically included
1394 # * ".cr.so" is never added 1394 # * ".cr.so" is never added
1395 # * they are not side-loaded for _incremental targets. 1395 # * they are not side-loaded for _incremental targets.
1396 # * load_library_from_apk, use_chromium_linker, 1396 # * load_library_from_apk, use_chromium_linker,
1397 # and enable_relocation_packing do not apply 1397 # and enable_relocation_packing do not apply
1398 # Use this instead of native_libs when you are going to load the library 1398 # Use this instead of shared_libraries when you are going to load the libr ary
1399 # conditionally, and only when native_libs doesn't work for you. 1399 # conditionally, and only when shared_libraries doesn't work for you.
1400 # native_libs: List paths of native libraries to include in this apk. If the se 1400 # shared_libraries: List shared_library targets to bundle. If these
1401 # libraries depend on other shared_library targets, those dependencies wil l 1401 # libraries depend on other shared_library targets, those dependencies wil l
1402 # also be included in the apk. When building with is_component_build, 1402 # also be included in the apk (e.g. for is_component_build).
1403 # The extension is automatically changed to ".cr.so".
jbudorick 2016/06/22 14:20:48 Is this no longer true?
agrieve 2016/06/22 14:33:59 We're now specifying target labels rather than fil
1404 # native_lib_placeholders: List of placeholder filenames to add to the apk 1403 # native_lib_placeholders: List of placeholder filenames to add to the apk
1405 # (optional). 1404 # (optional).
1406 # apk_under_test: For an instrumentation test apk, this is the target of the 1405 # apk_under_test: For an instrumentation test apk, this is the target of the
1407 # tested apk. 1406 # tested apk.
1408 # include_all_resources - If true include all resource IDs in all generated 1407 # include_all_resources - If true include all resource IDs in all generated
1409 # R.java files. 1408 # R.java files.
1410 # testonly: Marks this target as "test-only". 1409 # testonly: Marks this target as "test-only".
1411 # write_asset_list: Adds an extra file to the assets, which contains a list of 1410 # write_asset_list: Adds an extra file to the assets, which contains a list of
1412 # all other asset files. 1411 # all other asset files.
1413 # alternative_locale_resource_dep: The locale resource target which override s 1412 # alternative_locale_resource_dep: The locale resource target which override s
(...skipping 14 matching lines...) Expand all
1428 # "android/org/chromium/foo/FooApplication.java", 1427 # "android/org/chromium/foo/FooApplication.java",
1429 # "android/org/chromium/foo/FooActivity.java", 1428 # "android/org/chromium/foo/FooActivity.java",
1430 # ] 1429 # ]
1431 # deps = [ 1430 # deps = [
1432 # ":foo_support_java" 1431 # ":foo_support_java"
1433 # ":foo_resources" 1432 # ":foo_resources"
1434 # ] 1433 # ]
1435 # srcjar_deps = [ 1434 # srcjar_deps = [
1436 # ":foo_generated_enum" 1435 # ":foo_generated_enum"
1437 # ] 1436 # ]
1438 # native_libs = [ 1437 # shared_libraries = [
1439 # native_lib_path 1438 # ":my_shared_lib",
1440 # ] 1439 # ]
1441 # } 1440 # }
1442 template("android_apk") { 1441 template("android_apk") {
1443 set_sources_assignment_filter([]) 1442 set_sources_assignment_filter([])
1444 forward_variables_from(invoker, [ "testonly" ]) 1443 forward_variables_from(invoker, [ "testonly" ])
1445 1444
1446 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) 1445 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name))
1447 assert(defined(invoker.android_manifest)) 1446 assert(defined(invoker.android_manifest))
1448 gen_dir = "$target_gen_dir/$target_name" 1447 gen_dir = "$target_gen_dir/$target_name"
1449 base_path = "$gen_dir/$target_name" 1448 base_path = "$gen_dir/$target_name"
(...skipping 26 matching lines...) Expand all
1476 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] 1475 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0]
1477 assert(_final_apk_path_no_ext != "") # Mark as used. 1476 assert(_final_apk_path_no_ext != "") # Mark as used.
1478 1477
1479 _install_script_name = "install_$_template_name" 1478 _install_script_name = "install_$_template_name"
1480 if (defined(invoker.install_script_name)) { 1479 if (defined(invoker.install_script_name)) {
1481 _install_script_name = invoker.install_script_name 1480 _install_script_name = invoker.install_script_name
1482 } 1481 }
1483 _incremental_install_script_path = 1482 _incremental_install_script_path =
1484 "${root_out_dir}/bin/${_install_script_name}_incremental" 1483 "${root_out_dir}/bin/${_install_script_name}_incremental"
1485 1484
1486 _native_libs = []
1487
1488 _version_code = android_default_version_code 1485 _version_code = android_default_version_code
1489 if (defined(invoker.version_code)) { 1486 if (defined(invoker.version_code)) {
1490 _version_code = invoker.version_code 1487 _version_code = invoker.version_code
1491 } 1488 }
1492 1489
1493 _version_name = android_default_version_name 1490 _version_name = android_default_version_name
1494 if (defined(invoker.version_name)) { 1491 if (defined(invoker.version_name)) {
1495 _version_name = invoker.version_name 1492 _version_name = invoker.version_name
1496 } 1493 }
1497 _keystore_path = android_keystore_path 1494 _keystore_path = android_keystore_path
(...skipping 29 matching lines...) Expand all
1527 } 1524 }
1528 if (_load_library_from_apk) { 1525 if (_load_library_from_apk) {
1529 assert(_use_chromium_linker || _requires_sdk_api_level_23, 1526 assert(_use_chromium_linker || _requires_sdk_api_level_23,
1530 "load_library_from_apk requires use_chromium_linker " + 1527 "load_library_from_apk requires use_chromium_linker " +
1531 "or requires_sdk_api_level_23") 1528 "or requires_sdk_api_level_23")
1532 } 1529 }
1533 1530
1534 # The dependency that makes the chromium linker, if any is needed. 1531 # The dependency that makes the chromium linker, if any is needed.
1535 _native_libs_deps = [] 1532 _native_libs_deps = []
1536 1533
1537 if (defined(invoker.native_libs) && invoker.native_libs != []) { 1534 if (defined(invoker.shared_libraries) && invoker.shared_libraries != []) {
1535 _native_libs_deps += invoker.shared_libraries
1536
1538 if (is_component_build || is_asan) { 1537 if (is_component_build || is_asan) {
1539 _native_libs += [ "$root_shlib_dir/libc++_shared.so" ]
1540 _native_libs_deps += [ "//build/android:cpplib_stripped" ] 1538 _native_libs_deps += [ "//build/android:cpplib_stripped" ]
1541 } 1539 }
1542 1540
1543 # Allow native_libs to be in the form "foo.so" or "foo.cr.so" 1541 # To determine the filenames of all dependent shared libraries, write the
1544 _first_ext_removed = 1542 # runtime deps of |shared_libraries| to a file during "gn gen".
1545 process_file_template(invoker.native_libs, "{{source_name_part}}") 1543 # write_build_config.py will then grep this file for *.so to obtain the
1546 _native_libs += process_file_template( 1544 # complete list.
1547 _first_ext_removed, 1545 _runtime_deps_file =
1548 "$root_shlib_dir/{{source_name_part}}$shlib_extension") 1546 "$target_gen_dir/${_template_name}.native.runtimedeps"
1547 group("${_template_name}__runtime_deps") {
1548 deps = _native_libs_deps
jbudorick 2016/06/22 14:20:48 Does this need to be a build-time dependency? Coul
agrieve 2016/06/22 14:33:59 My goal is to write a script that will directly bu
jbudorick 2016/06/22 14:52:52 Ah, ok. So it wants to depend on the names but not
agrieve 2016/06/22 15:39:23 Exactly. It just needs the output paths, but they
jbudorick 2016/06/22 15:44:22 sgtm
1549 write_runtime_deps = _runtime_deps_file
1550 }
1549 1551
1550 _native_lib_version_rule = "" 1552 _native_lib_version_rule = ""
1551 if (defined(invoker.native_lib_version_rule)) { 1553 if (defined(invoker.native_lib_version_rule)) {
1552 _native_lib_version_rule = invoker.native_lib_version_rule 1554 _native_lib_version_rule = invoker.native_lib_version_rule
1553 } 1555 }
1554 _native_lib_version_arg = "\"\"" 1556 _native_lib_version_arg = "\"\""
1555 if (defined(invoker.native_lib_version_arg)) { 1557 if (defined(invoker.native_lib_version_arg)) {
1556 _native_lib_version_arg = invoker.native_lib_version_arg 1558 _native_lib_version_arg = invoker.native_lib_version_arg
1557 } 1559 }
1558 } 1560 }
(...skipping 29 matching lines...) Expand all
1588 type = "android_apk" 1590 type = "android_apk"
1589 jar_path = _jar_path 1591 jar_path = _jar_path
1590 dex_path = final_dex_path 1592 dex_path = final_dex_path
1591 apk_path = _final_apk_path 1593 apk_path = _final_apk_path
1592 incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk" 1594 incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk"
1593 incremental_install_script_path = _incremental_install_script_path 1595 incremental_install_script_path = _incremental_install_script_path
1594 resources_zip = resources_zip_path 1596 resources_zip = resources_zip_path
1595 build_config = _build_config 1597 build_config = _build_config
1596 android_manifest = _android_manifest 1598 android_manifest = _android_manifest
1597 1599
1598 deps = _native_libs_deps + _android_manifest_deps 1600 deps = _android_manifest_deps
1599 if (defined(invoker.deps)) { 1601 if (defined(invoker.deps)) {
1600 deps += invoker.deps 1602 deps += invoker.deps
1601 } 1603 }
1602 1604
1603 if (defined(invoker.alternative_locale_resource_dep)) { 1605 if (defined(invoker.alternative_locale_resource_dep)) {
1604 deps += [ invoker.alternative_locale_resource_dep ] 1606 deps += [ invoker.alternative_locale_resource_dep ]
1605 has_alternative_locale_resource = true 1607 has_alternative_locale_resource = true
1606 } 1608 }
1607 1609
1608 # Added emma to the target's classpath via its .build_config. 1610 # Added emma to the target's classpath via its .build_config.
1609 if (emma_coverage && !_emma_never_instrument) { 1611 if (emma_coverage && !_emma_never_instrument) {
1610 deps += [ "//third_party/android_tools:emma_device" ] 1612 deps += [ "//third_party/android_tools:emma_device" ]
1611 } 1613 }
1612 1614
1613 proguard_enabled = _proguard_enabled 1615 proguard_enabled = _proguard_enabled
1614 if (_proguard_enabled) { 1616 if (_proguard_enabled) {
1615 proguard_info = "$_proguard_output_jar_path.info" 1617 proguard_info = "$_proguard_output_jar_path.info"
1616 } 1618 }
1617 1619
1618 native_libs = _native_libs 1620 # Don't depend on the runtime_deps target in order to avoid having to
1621 # build the native libraries just to create the .build_config file.
1622 # The dep is unnecessary since the runtime_deps file is created by gn gen
1623 # and the runtime_deps file is added to write_build_config.py's depfile.
1624 if (_native_libs_deps != []) {
1625 shared_libraries_runtime_deps_file = _runtime_deps_file
1626 }
1619 } 1627 }
1620 1628
1621 _final_deps = [] 1629 _final_deps = []
1622 1630
1623 _generated_proguard_config = "$base_path.resources.proguard.txt" 1631 _generated_proguard_config = "$base_path.resources.proguard.txt"
1624 process_resources_target = "${_template_name}__process_resources" 1632 process_resources_target = "${_template_name}__process_resources"
1625 process_resources(process_resources_target) { 1633 process_resources(process_resources_target) {
1626 forward_variables_from(invoker, 1634 forward_variables_from(invoker,
1627 [ 1635 [
1628 "alternative_android_sdk_jar", 1636 "alternative_android_sdk_jar",
(...skipping 12 matching lines...) Expand all
1641 proguard_file = _generated_proguard_config 1649 proguard_file = _generated_proguard_config
1642 1650
1643 build_config = _build_config 1651 build_config = _build_config
1644 deps = _android_manifest_deps + [ ":$build_config_target" ] 1652 deps = _android_manifest_deps + [ ":$build_config_target" ]
1645 if (defined(invoker.deps)) { 1653 if (defined(invoker.deps)) {
1646 deps += invoker.deps 1654 deps += invoker.deps
1647 } 1655 }
1648 } 1656 }
1649 _srcjar_deps += [ ":$process_resources_target" ] 1657 _srcjar_deps += [ ":$process_resources_target" ]
1650 1658
1651 if (_native_libs != []) { 1659 if (_native_libs_deps != []) {
1652 _enable_chromium_linker_tests = false 1660 _enable_chromium_linker_tests = false
1653 if (defined(invoker.enable_chromium_linker_tests)) { 1661 if (defined(invoker.enable_chromium_linker_tests)) {
1654 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests 1662 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests
1655 } 1663 }
1656 1664
1657 java_cpp_template("${_template_name}__native_libraries_java") { 1665 java_cpp_template("${_template_name}__native_libraries_java") {
1658 package_name = "org/chromium/base/library_loader" 1666 package_name = "org/chromium/base/library_loader"
1659 sources = [ 1667 sources = [
1660 "//base/android/java/templates/NativeLibraries.template", 1668 "//base/android/java/templates/NativeLibraries.template",
1661 ] 1669 ]
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 _dex_arg_key = 1842 _dex_arg_key =
1835 "${_rebased_build_config}:final_dex:dependency_dex_files" 1843 "${_rebased_build_config}:final_dex:dependency_dex_files"
1836 } 1844 }
1837 args = [ "--inputs=@FileArg($_dex_arg_key)" ] 1845 args = [ "--inputs=@FileArg($_dex_arg_key)" ]
1838 } 1846 }
1839 } 1847 }
1840 1848
1841 _native_libs_file_arg_dep = ":$build_config_target" 1849 _native_libs_file_arg_dep = ":$build_config_target"
1842 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)" 1850 _native_libs_file_arg = "@FileArg($_rebased_build_config:native:libraries)"
1843 1851
1844 if (_native_libs != [] && _enable_relocation_packing) { 1852 if (_native_libs_deps != [] && _enable_relocation_packing) {
1845 _prepare_native_target_name = "${_template_name}__prepare_native" 1853 _prepare_native_target_name = "${_template_name}__prepare_native"
1846 _native_libs_dir = "$gen_dir/packed-libs" 1854 _native_libs_dir = "$gen_dir/packed-libs"
1847 _native_libs_json = "$gen_dir/packed-libs/filelist.json" 1855 _native_libs_json = "$gen_dir/packed-libs/filelist.json"
1848 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir) 1856 _rebased_native_libs_json = rebase_path(_native_libs_json, root_build_dir)
1849 1857
1850 _native_libs_file_arg_dep = ":$_prepare_native_target_name" 1858 _native_libs_file_arg_dep = ":$_prepare_native_target_name"
1851 _native_libs_file_arg = "@FileArg($_rebased_native_libs_json:files)" 1859 _native_libs_file_arg = "@FileArg($_rebased_native_libs_json:files)"
1852 1860
1853 action(_prepare_native_target_name) { 1861 action(_prepare_native_target_name) {
1854 forward_variables_from(invoker, 1862 forward_variables_from(invoker,
1855 [ 1863 [
1856 "deps", 1864 "deps",
1857 "public_deps", 1865 "public_deps",
1858 ]) 1866 ])
1859 script = "//build/android/gyp/pack_relocations.py" 1867 script = "//build/android/gyp/pack_relocations.py"
1860 depfile = "$target_gen_dir/$target_name.d" 1868 depfile = "$target_gen_dir/$target_name.d"
1861 outputs = [ 1869 outputs = [
1862 depfile, 1870 depfile,
1863 _native_libs_json, 1871 _native_libs_json,
1864 ] 1872 ]
1865 1873
1866 inputs = _native_libs + [ _build_config ] 1874 inputs = [
1875 _build_config,
1876 ]
1867 1877
1868 deps += _native_libs_deps 1878 deps += _native_libs_deps
1869 deps += [ 1879 deps += [
1870 ":$build_config_target", 1880 ":$build_config_target",
1871 relocation_packer_target, 1881 relocation_packer_target,
1872 ] 1882 ]
1873 1883
1874 args = [ 1884 args = [
1875 "--depfile", 1885 "--depfile",
1876 rebase_path(depfile, root_build_dir), 1886 rebase_path(depfile, root_build_dir),
1877 "--enable-packing=1", 1887 "--enable-packing=1",
1878 "--android-pack-relocations", 1888 "--android-pack-relocations",
1879 rebase_path(relocation_packer_exe, root_build_dir), 1889 rebase_path(relocation_packer_exe, root_build_dir),
1880 "--stripped-libraries-dir", 1890 "--stripped-libraries-dir",
1881 rebase_path(root_build_dir, root_build_dir), 1891 rebase_path(root_build_dir, root_build_dir),
1882 "--packed-libraries-dir", 1892 "--packed-libraries-dir",
1883 rebase_path(_native_libs_dir, root_build_dir), 1893 rebase_path(_native_libs_dir, root_build_dir),
1884 "--libraries=@FileArg(${_rebased_build_config}:native:libraries)", 1894 "--libraries=@FileArg(${_rebased_build_config}:native:libraries)",
1885 "--filelistjson=$_rebased_native_libs_json", 1895 "--filelistjson=$_rebased_native_libs_json",
1886 ] 1896 ]
1887 } 1897 }
1888 } 1898 }
1889 1899
1890 _extra_native_libs = [] 1900 _extra_native_libs = []
1891 _extra_native_libs_deps = [] 1901 _extra_native_libs_deps = []
1892 _extra_native_libs_even_when_incremental = [] 1902 _extra_native_libs_even_when_incremental = []
1893 _extra_native_libs_even_when_incremental_deps = [] 1903 _extra_native_libs_even_when_incremental_deps = []
1894 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used. 1904 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used.
1895 if (_native_libs != []) { 1905 if (_native_libs_deps != []) {
1896 if (is_debug) { 1906 if (is_debug) {
1897 _extra_native_libs_even_when_incremental = [ android_gdbserver ] 1907 _extra_native_libs_even_when_incremental = [ android_gdbserver ]
1898 } 1908 }
1899 1909
1900 if (_use_chromium_linker) { 1910 if (_use_chromium_linker) {
1901 _extra_native_libs = 1911 _extra_native_libs =
1902 [ "$root_shlib_dir/libchromium_android_linker$shlib_extension" ] 1912 [ "$root_shlib_dir/libchromium_android_linker$shlib_extension" ]
1903 _extra_native_libs_deps += 1913 _extra_native_libs_deps +=
1904 [ "//base/android/linker:chromium_android_linker" ] 1914 [ "//base/android/linker:chromium_android_linker" ]
1905 } 1915 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 ":$process_resources_target", 1967 ":$process_resources_target",
1958 ] 1968 ]
1959 1969
1960 # This target generates the input file _all_resources_zip_path. 1970 # This target generates the input file _all_resources_zip_path.
1961 deps += _android_manifest_deps + [ 1971 deps += _android_manifest_deps + [
1962 ":$build_config_target", 1972 ":$build_config_target",
1963 ":$process_resources_target", 1973 ":$process_resources_target",
1964 ":$final_dex_target_name", 1974 ":$final_dex_target_name",
1965 ] 1975 ]
1966 1976
1967 if ((_native_libs != [] || 1977 if ((_native_libs_deps != [] ||
1968 _extra_native_libs_even_when_incremental != []) && 1978 _extra_native_libs_even_when_incremental != []) &&
1969 !_create_abi_split) { 1979 !_create_abi_split) {
1970 deps += _native_libs_deps + _extra_native_libs_deps + 1980 deps += _native_libs_deps + _extra_native_libs_deps +
1971 _extra_native_libs_even_when_incremental_deps + 1981 _extra_native_libs_even_when_incremental_deps +
1972 [ _native_libs_file_arg_dep ] 1982 [ _native_libs_file_arg_dep ]
1973 native_libs_filearg = _native_libs_file_arg 1983 native_libs_filearg = _native_libs_file_arg
1974 native_libs = _extra_native_libs 1984 native_libs = _extra_native_libs
1975 native_libs_even_when_incremental = 1985 native_libs_even_when_incremental =
1976 _extra_native_libs_even_when_incremental 1986 _extra_native_libs_even_when_incremental
1977 } 1987 }
1978 1988
1979 # Placeholders necessary for some older devices. 1989 # Placeholders necessary for some older devices.
1980 # http://crbug.com/395038 1990 # http://crbug.com/395038
1981 forward_variables_from(invoker, [ "native_lib_placeholders" ]) 1991 forward_variables_from(invoker, [ "native_lib_placeholders" ])
1982 } 1992 }
1983 1993
1984 if ((_native_libs != [] || _extra_native_libs_even_when_incremental != []) & & _create_abi_split) { 1994 if ((_native_libs_deps != [] ||
1995 _extra_native_libs_even_when_incremental != []) && _create_abi_split) {
1985 _manifest_rule = 1996 _manifest_rule =
1986 "${_template_name}__split_manifest_abi_${android_app_abi}" 1997 "${_template_name}__split_manifest_abi_${android_app_abi}"
1987 generate_split_manifest(_manifest_rule) { 1998 generate_split_manifest(_manifest_rule) {
1988 main_manifest = _android_manifest 1999 main_manifest = _android_manifest
1989 out_manifest = 2000 out_manifest =
1990 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" 2001 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml"
1991 split_name = "abi_${android_app_abi}" 2002 split_name = "abi_${android_app_abi}"
1992 deps = _android_manifest_deps 2003 deps = _android_manifest_deps
1993 } 2004 }
1994 2005
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 # "transitive closure" of these dependencies will be included in the apk. 2143 # "transitive closure" of these dependencies will be included in the apk.
2133 # Note: this "transitive closure" actually only includes such targets if 2144 # Note: this "transitive closure" actually only includes such targets if
2134 # they are depended on through android_library or android_resources target s 2145 # they are depended on through android_library or android_resources target s
2135 # (and so not through builtin targets like 'action', 'group', etc). 2146 # (and so not through builtin targets like 'action', 'group', etc).
2136 # java_files: List of .java files to include in the apk. 2147 # java_files: List of .java files to include in the apk.
2137 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars 2148 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
2138 # will be added to java_files and be included in this apk. 2149 # will be added to java_files and be included in this apk.
2139 # apk_name: Name for final apk. 2150 # apk_name: Name for final apk.
2140 # final_apk_path: Path to final built apk. Default is 2151 # final_apk_path: Path to final built apk. Default is
2141 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name. 2152 # $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name.
2142 # native_libs: List paths of native libraries to include in this apk. If the se 2153 # shared_libraries: List shared_library targets to bundle. If these
2143 # libraries depend on other shared_library targets, those dependencies wil l 2154 # libraries depend on other shared_library targets, those dependencies wil l
2144 # also be included in the apk. 2155 # also be included in the apk (e.g. for is_component_build).
2145 # apk_under_test: The apk being tested. 2156 # apk_under_test: The apk being tested.
2146 # isolate_file: Isolate file containing the list of test data dependencies. 2157 # isolate_file: Isolate file containing the list of test data dependencies.
2147 # 2158 #
2148 # Example 2159 # Example
2149 # instrumentation_test_apk("foo_test_apk") { 2160 # instrumentation_test_apk("foo_test_apk") {
2150 # android_manifest = "AndroidManifest.xml" 2161 # android_manifest = "AndroidManifest.xml"
2151 # apk_name = "FooTest" 2162 # apk_name = "FooTest"
2152 # apk_under_test = "Foo" 2163 # apk_under_test = "Foo"
2153 # java_files = [ 2164 # java_files = [
2154 # "android/org/chromium/foo/FooTestCase.java", 2165 # "android/org/chromium/foo/FooTestCase.java",
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 } 2266 }
2256 2267
2257 # Declare an Android gtest apk 2268 # Declare an Android gtest apk
2258 # 2269 #
2259 # This target creates an Android apk for running gtest-based unittests. 2270 # This target creates an Android apk for running gtest-based unittests.
2260 # 2271 #
2261 # Variables 2272 # Variables
2262 # deps: Specifies the dependencies of this target. These will be passed to 2273 # deps: Specifies the dependencies of this target. These will be passed to
2263 # the underlying android_apk invocation and should include the java and 2274 # the underlying android_apk invocation and should include the java and
2264 # resource dependencies of the apk. 2275 # resource dependencies of the apk.
2265 # unittests_dep: This should be the label of the gtest native target. This 2276 # shared_library: shared_library target that contains the unit tests.
2266 # target must be defined previously in the same file.
2267 # unittests_binary: The basename of the library produced by the unittests_de p
2268 # target. If unspecified, it assumes the name of the unittests_dep target
2269 # (which will be correct unless that target specifies an "output_name".
2270 # TODO(brettw) make this automatic by allowing get_target_outputs to
2271 # support executables.
2272 # apk_name: The name of the produced apk. If unspecified, it uses the name 2277 # apk_name: The name of the produced apk. If unspecified, it uses the name
2273 # of the unittests_dep target postfixed with "_apk" 2278 # of the shared_library target suffixed with "_apk"
2274 # use_default_launcher: Whether the default activity (NativeUnitTestActivity ) 2279 # use_default_launcher: Whether the default activity (NativeUnitTestActivity )
2275 # should be used for launching tests. 2280 # should be used for launching tests.
2276 # use_native_activity: Test implements ANativeActivity_onCreate(). 2281 # use_native_activity: Test implements ANativeActivity_onCreate().
2277 # 2282 #
2278 # Example 2283 # Example
2279 # unittest_apk("foo_unittests_apk") { 2284 # unittest_apk("foo_unittests_apk") {
2280 # deps = [ ":foo_java", ":foo_resources" ] 2285 # deps = [ ":foo_java", ":foo_resources" ]
2281 # unittests_dep = ":foo_unittests" 2286 # shared_library = ":foo_unittests"
2282 # } 2287 # }
2283 template("unittest_apk") { 2288 template("unittest_apk") {
2284 assert(defined(invoker.unittests_dep),
2285 "Need unittests_dep for $target_name")
2286
2287 test_suite_name = get_label_info(invoker.unittests_dep, "name")
2288
2289 # This trivial assert is needed in case both unittests_binary and apk_name
2290 # are defined, as otherwise test_suite_name would not be used.
2291 assert(test_suite_name != "")
2292
2293 _use_native_activity = 2289 _use_native_activity =
2294 defined(invoker.use_native_activity) && invoker.use_native_activity 2290 defined(invoker.use_native_activity) && invoker.use_native_activity
2295 _android_manifest = "$target_gen_dir/$target_name/AndroidManifest.xml" 2291 _android_manifest = "$target_gen_dir/$target_name/AndroidManifest.xml"
2292 assert(invoker.shared_library != "")
2296 2293
2297 # This trivial assert is needed in case android_manifest is defined, 2294 # This trivial assert is needed in case android_manifest is defined,
2298 # as otherwise _use_native_activity and _android_manifest would not be used. 2295 # as otherwise _use_native_activity and _android_manifest would not be used.
2299 assert(_use_native_activity != "" && _android_manifest != "") 2296 assert(_use_native_activity != "" && _android_manifest != "")
2300 2297
2301 if (!defined(invoker.android_manifest)) { 2298 if (!defined(invoker.android_manifest)) {
2302 jinja_template("${target_name}_manifest") { 2299 jinja_template("${target_name}_manifest") {
2303 if (!defined(invoker.unittests_binary)) { 2300 _native_library_name = get_label_info(invoker.shared_library, "name")
2304 native_library_name = test_suite_name
2305 } else {
2306 native_library_name = invoker.unittests_binary
2307 }
2308 input = "//testing/android/native_test/java/AndroidManifest.xml.jinja2" 2301 input = "//testing/android/native_test/java/AndroidManifest.xml.jinja2"
2309 output = _android_manifest 2302 output = _android_manifest
2310 variables = [ 2303 variables = [
2311 "is_component_build=${is_component_build}", 2304 "is_component_build=${is_component_build}",
2312 "native_library_name=${native_library_name}", 2305 "native_library_name=${_native_library_name}",
2313 "use_native_activity=${_use_native_activity}", 2306 "use_native_activity=${_use_native_activity}",
2314 ] 2307 ]
2315 } 2308 }
2316 } 2309 }
2317 2310
2318 android_apk(target_name) { 2311 android_apk(target_name) {
2319 set_sources_assignment_filter([]) 2312 set_sources_assignment_filter([])
2320 data_deps = [] 2313 data_deps = []
2321 deps = [] 2314 deps = []
2322 forward_variables_from(invoker, "*") 2315 forward_variables_from(invoker, "*")
2323 testonly = true 2316 testonly = true
2324 2317
2325 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) { 2318 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
2326 assert(invoker.proguard_configs != []) 2319 assert(invoker.proguard_configs != [])
2327 proguard_enabled = true 2320 proguard_enabled = true
2328 proguard_configs = invoker.proguard_configs 2321 proguard_configs = invoker.proguard_configs
2329 } 2322 }
2330 2323
2331 if (!defined(apk_name)) { 2324 if (!defined(apk_name)) {
2332 apk_name = test_suite_name 2325 apk_name = get_label_info(invoker.shared_library, "name")
2333 } 2326 }
2334 2327
2335 if (!defined(android_manifest)) { 2328 if (!defined(android_manifest)) {
2336 deps += [ ":${target_name}_manifest" ] 2329 deps += [ ":${target_name}_manifest" ]
2337 android_manifest = _android_manifest 2330 android_manifest = _android_manifest
2338 } 2331 }
2339 2332
2340 if (!defined(unittests_binary)) {
2341 unittests_binary = "lib${test_suite_name}${shlib_extension}"
2342 }
2343
2344 final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk" 2333 final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk"
2345 2334
2346 if (!defined(use_default_launcher) || use_default_launcher) { 2335 if (!defined(use_default_launcher) || use_default_launcher) {
2347 deps += [ "//testing/android/native_test:native_test_java" ] 2336 deps += [ "//testing/android/native_test:native_test_java" ]
2348 } 2337 }
2349 native_libs = [ unittests_binary ] 2338 shared_libraries = [ invoker.shared_library ]
2350 deps += [ 2339 deps += [
2351 "//base:base_java", 2340 "//base:base_java",
2352 "//testing/android/appurify_support:appurify_support_java", 2341 "//testing/android/appurify_support:appurify_support_java",
2353 "//testing/android/reporter:reporter_java", 2342 "//testing/android/reporter:reporter_java",
2354 ] 2343 ]
2355 data_deps += [ 2344 data_deps += [
2356 "//build/android/pylib/remote/device/dummy:remote_device_dummy_apk", 2345 "//build/android/pylib/remote/device/dummy:remote_device_dummy_apk",
2357 "//tools/android/md5sum", 2346 "//tools/android/md5sum",
2358 ] 2347 ]
2359 if (host_os == "linux") { 2348 if (host_os == "linux") {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 android_library(target_name) { 2481 android_library(target_name) {
2493 chromium_code = false 2482 chromium_code = false
2494 java_files = [] 2483 java_files = []
2495 srcjar_deps = [ ":${_template_name}__protoc_java" ] 2484 srcjar_deps = [ ":${_template_name}__protoc_java" ]
2496 deps = [ 2485 deps = [
2497 "//third_party/android_protobuf:protobuf_nano_javalib", 2486 "//third_party/android_protobuf:protobuf_nano_javalib",
2498 ] 2487 ]
2499 } 2488 }
2500 } 2489 }
2501 } 2490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698