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/toolchain/toolchain.gni") |
8 import("//third_party/android_platform/config.gni") | 9 import("//third_party/android_platform/config.gni") |
9 import("//tools/grit/grit_rule.gni") | 10 import("//tools/grit/grit_rule.gni") |
10 | 11 |
11 assert(is_android) | 12 assert(is_android) |
12 | 13 |
13 # Declare a jni target | 14 # Declare a jni target |
14 # | 15 # |
15 # This target generates the native jni bindings for a set of .java files. | 16 # This target generates the native jni bindings for a set of .java files. |
16 # | 17 # |
17 # See base/android/jni_generator/jni_generator.py for more info about the | 18 # See base/android/jni_generator/jni_generator.py for more info about the |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 | 1432 |
1432 _enable_relocation_packing = false | 1433 _enable_relocation_packing = false |
1433 if (defined(invoker.enable_relocation_packing) && | 1434 if (defined(invoker.enable_relocation_packing) && |
1434 invoker.enable_relocation_packing) { | 1435 invoker.enable_relocation_packing) { |
1435 _enable_relocation_packing = relocation_packing_supported | 1436 _enable_relocation_packing = relocation_packing_supported |
1436 assert(_use_chromium_linker, | 1437 assert(_use_chromium_linker, |
1437 "Relocation packing requires use of the" + " Chromium linker.") | 1438 "Relocation packing requires use of the" + " Chromium linker.") |
1438 } | 1439 } |
1439 | 1440 |
1440 if (is_component_build) { | 1441 if (is_component_build) { |
1441 _native_libs += [ "$root_out_dir/lib.stripped/libc++_shared.so" ] | 1442 _native_libs += [ "$root_shlib_dir/libc++_shared.so" ] |
1442 _chromium_linker_dep += [ "//build/android:cpplib_stripped" ] | 1443 _chromium_linker_dep += [ "//build/android:cpplib_stripped" ] |
1443 } | 1444 } |
1444 | 1445 |
1445 # Allow native_libs to be in the form "foo.so" or "foo.cr.so" | 1446 # Allow native_libs to be in the form "foo.so" or "foo.cr.so" |
1446 _first_ext_removed = | 1447 _first_ext_removed = |
1447 process_file_template(invoker.native_libs, "{{source_name_part}}") | 1448 process_file_template(invoker.native_libs, "{{source_name_part}}") |
1448 _native_libs += process_file_template( | 1449 _native_libs += process_file_template( |
1449 _first_ext_removed, | 1450 _first_ext_removed, |
1450 "$root_build_dir/lib.stripped/{{source_name_part}}$android_product_e
xtension") | 1451 "$root_shlib_dir/{{source_name_part}}$shlib_extension") |
1451 | 1452 |
1452 _native_libs_dir = base_path + "/libs" | 1453 _native_libs_dir = base_path + "/libs" |
1453 | 1454 |
1454 if (_use_chromium_linker) { | 1455 if (_use_chromium_linker) { |
1455 _native_libs += [ "$root_build_dir/lib.stripped/libchromium_android_linker
$android_product_extension" ] | 1456 _native_libs += |
| 1457 [ "$root_shlib_dir/libchromium_android_linker$shlib_extension" ] |
1456 } | 1458 } |
1457 | 1459 |
1458 _enable_relocation_packing = false | 1460 _enable_relocation_packing = false |
1459 if (_use_chromium_linker && defined(invoker.enable_relocation_packing) && | 1461 if (_use_chromium_linker && defined(invoker.enable_relocation_packing) && |
1460 invoker.enable_relocation_packing) { | 1462 invoker.enable_relocation_packing) { |
1461 _enable_relocation_packing = true | 1463 _enable_relocation_packing = true |
1462 } | 1464 } |
1463 | 1465 |
1464 _native_lib_version_rule = "" | 1466 _native_lib_version_rule = "" |
1465 if (defined(invoker.native_lib_version_rule)) { | 1467 if (defined(invoker.native_lib_version_rule)) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 ] | 1658 ] |
1657 | 1659 |
1658 inputs = _native_libs | 1660 inputs = _native_libs |
1659 deps = _chromium_linker_dep | 1661 deps = _chromium_linker_dep |
1660 | 1662 |
1661 inputs += [ _build_config ] | 1663 inputs += [ _build_config ] |
1662 deps += [ ":$build_config_target" ] | 1664 deps += [ ":$build_config_target" ] |
1663 | 1665 |
1664 skip_packing_list = [ | 1666 skip_packing_list = [ |
1665 "gdbserver", | 1667 "gdbserver", |
1666 "libchromium_android_linker$android_product_extension", | 1668 "libchromium_android_linker$shlib_extension", |
1667 ] | 1669 ] |
1668 | 1670 |
1669 enable_packing_arg = 0 | 1671 enable_packing_arg = 0 |
1670 if (_enable_relocation_packing) { | 1672 if (_enable_relocation_packing) { |
1671 enable_packing_arg = 1 | 1673 enable_packing_arg = 1 |
1672 deps += [ relocation_packer_target ] | 1674 deps += [ relocation_packer_target ] |
1673 } | 1675 } |
1674 | 1676 |
1675 args = [ | 1677 args = [ |
1676 "--depfile", | 1678 "--depfile", |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 | 1942 |
1941 test_suite_name = get_label_info(invoker.unittests_dep, "name") | 1943 test_suite_name = get_label_info(invoker.unittests_dep, "name") |
1942 | 1944 |
1943 # This trivial assert is needed in case both unittests_binary and apk_name | 1945 # This trivial assert is needed in case both unittests_binary and apk_name |
1944 # are defined, as otherwise test_suite_name would not be used. | 1946 # are defined, as otherwise test_suite_name would not be used. |
1945 assert(test_suite_name != "") | 1947 assert(test_suite_name != "") |
1946 | 1948 |
1947 if (defined(invoker.unittests_binary)) { | 1949 if (defined(invoker.unittests_binary)) { |
1948 unittests_binary = invoker.unittests_binary | 1950 unittests_binary = invoker.unittests_binary |
1949 } else { | 1951 } else { |
1950 unittests_binary = "lib${test_suite_name}${android_product_extension}" | 1952 unittests_binary = "lib${test_suite_name}${shlib_extension}" |
1951 } | 1953 } |
1952 | 1954 |
1953 if (defined(invoker.apk_name)) { | 1955 if (defined(invoker.apk_name)) { |
1954 apk_name = invoker.apk_name | 1956 apk_name = invoker.apk_name |
1955 } else { | 1957 } else { |
1956 apk_name = test_suite_name | 1958 apk_name = test_suite_name |
1957 } | 1959 } |
1958 | 1960 |
1959 android_apk(target_name) { | 1961 android_apk(target_name) { |
1960 final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk" | 1962 final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 # executable. | 2076 # executable. |
2075 # | 2077 # |
2076 # Variables | 2078 # Variables |
2077 # dist_dir: Directory for the exe and libraries. Everything in this directory | 2079 # dist_dir: Directory for the exe and libraries. Everything in this directory |
2078 # will be deleted before copying in the exe and libraries. | 2080 # will be deleted before copying in the exe and libraries. |
2079 # binary: Path to (stripped) executable. | 2081 # binary: Path to (stripped) executable. |
2080 # | 2082 # |
2081 # Example | 2083 # Example |
2082 # create_native_executable_dist("foo_dist") { | 2084 # create_native_executable_dist("foo_dist") { |
2083 # dist_dir = "$root_build_dir/foo_dist" | 2085 # dist_dir = "$root_build_dir/foo_dist" |
2084 # binary = "$root_build_dir/exe.stripped/foo" | 2086 # binary = "$root_build_dir/foo" |
2085 # deps = [ ":the_thing_that_makes_foo" ] | 2087 # deps = [ ":the_thing_that_makes_foo" ] |
2086 # } | 2088 # } |
2087 template("create_native_executable_dist") { | 2089 template("create_native_executable_dist") { |
2088 set_sources_assignment_filter([]) | 2090 set_sources_assignment_filter([]) |
2089 if (defined(invoker.testonly)) { | 2091 if (defined(invoker.testonly)) { |
2090 testonly = invoker.testonly | 2092 testonly = invoker.testonly |
2091 } | 2093 } |
2092 | 2094 |
2093 dist_dir = invoker.dist_dir | 2095 dist_dir = invoker.dist_dir |
2094 binary = invoker.binary | 2096 binary = invoker.binary |
2095 template_name = target_name | 2097 template_name = target_name |
2096 | 2098 |
2097 libraries_list = | 2099 libraries_list = |
2098 "${target_gen_dir}/${template_name}_library_dependencies.list" | 2100 "${target_gen_dir}/${template_name}_library_dependencies.list" |
2099 | 2101 |
2100 find_deps_target_name = "${template_name}__find_library_dependencies" | 2102 find_deps_target_name = "${template_name}__find_library_dependencies" |
2101 copy_target_name = "${template_name}__copy_libraries_and_exe" | 2103 copy_target_name = "${template_name}__copy_libraries_and_exe" |
2102 | 2104 |
2103 stripped_libraries_dir = "$root_build_dir/lib.stripped" | |
2104 action(find_deps_target_name) { | 2105 action(find_deps_target_name) { |
2105 visibility = [ ":$copy_target_name" ] | 2106 visibility = [ ":$copy_target_name" ] |
2106 | 2107 |
2107 script = "//build/android/gyp/write_ordered_libraries.py" | 2108 script = "//build/android/gyp/write_ordered_libraries.py" |
2108 depfile = "$target_gen_dir/$target_name.d" | 2109 depfile = "$target_gen_dir/$target_name.d" |
2109 inputs = [ | 2110 inputs = [ |
2110 binary, | 2111 binary, |
2111 android_readelf, | 2112 android_readelf, |
2112 ] | 2113 ] |
2113 outputs = [ | 2114 outputs = [ |
2114 depfile, | 2115 depfile, |
2115 libraries_list, | 2116 libraries_list, |
2116 ] | 2117 ] |
2117 rebased_binaries = rebase_path([ binary ], root_build_dir) | 2118 rebased_binaries = rebase_path([ binary ], root_build_dir) |
2118 args = [ | 2119 args = [ |
2119 "--depfile", | 2120 "--depfile", |
2120 rebase_path(depfile, root_build_dir), | 2121 rebase_path(depfile, root_build_dir), |
2121 "--input-libraries=$rebased_binaries", | 2122 "--input-libraries=$rebased_binaries", |
2122 "--libraries-dir", | 2123 "--libraries-dir", |
2123 rebase_path(stripped_libraries_dir, root_build_dir), | 2124 rebase_path(root_shlib_dir, root_build_dir), |
2124 "--output", | 2125 "--output", |
2125 rebase_path(libraries_list, root_build_dir), | 2126 rebase_path(libraries_list, root_build_dir), |
2126 "--readelf", | 2127 "--readelf", |
2127 rebase_path(android_readelf, root_build_dir), | 2128 rebase_path(android_readelf, root_build_dir), |
2128 ] | 2129 ] |
2129 if (defined(invoker.deps)) { | 2130 if (defined(invoker.deps)) { |
2130 deps = invoker.deps | 2131 deps = invoker.deps |
2131 } | 2132 } |
2132 } | 2133 } |
2133 | 2134 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 template("uiautomator_test") { | 2226 template("uiautomator_test") { |
2226 set_sources_assignment_filter([]) | 2227 set_sources_assignment_filter([]) |
2227 if (defined(invoker.testonly)) { | 2228 if (defined(invoker.testonly)) { |
2228 testonly = invoker.testonly | 2229 testonly = invoker.testonly |
2229 } | 2230 } |
2230 assert(target_name != "") | 2231 assert(target_name != "") |
2231 assert(invoker.deps != [] || true) | 2232 assert(invoker.deps != [] || true) |
2232 group(target_name) { | 2233 group(target_name) { |
2233 } | 2234 } |
2234 } | 2235 } |
OLD | NEW |