Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 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 |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import("//build/config/android/rules.gni") |
| 6 | import("//third_party/ijar/ijar.gni") |
| 7 | |
| 8 | sun_tools_jar_path = "$root_gen_dir/sun_tools_jar/tools.jar" |
| 9 | |
| 10 | # Create or update the API versions cache if necessary by running a |
| 11 | # functionally empty lint task. This prevents racy creation of the |
| 12 | # cache while linting java targets in android_lint. |
| 13 | android_lint("prepare_android_lint_cache") { |
| 14 | android_manifest = "//build/android/AndroidManifest.xml" |
| 15 | create_cache = true |
| 16 | } |
| 17 | |
| 18 | action("find_sun_tools_jar") { |
| 19 | script = "//build/android/gyp/find_sun_tools_jar.py" |
| 20 | depfile = "$target_gen_dir/$target_name.d" |
| 21 | outputs = [ |
| 22 | depfile, |
| 23 | sun_tools_jar_path, |
| 24 | ] |
| 25 | args = [ |
| 26 | "--depfile", |
| 27 | rebase_path(depfile, root_build_dir), |
| 28 | "--output", |
| 29 | rebase_path(sun_tools_jar_path, root_build_dir), |
| 30 | ] |
| 31 | } |
| 32 | |
| 33 | java_prebuilt("sun_tools_java") { |
| 34 | jar_path = sun_tools_jar_path |
| 35 | jar_dep = ":find_sun_tools_jar" |
| 36 | } |
| 37 | |
| 38 | generate_interface_jar("android_ijar") { |
| 39 | input_jar = android_sdk_jar |
| 40 | output_jar = "$root_out_dir/lib.java/android.interface.jar" |
| 41 | } |
| 42 | |
| 43 | # Copy to the lib.unstripped directory so that gdb can easily find it. |
| 44 | copy("cpplib_unstripped") { |
| 45 | _soname = "libc++_shared.so" |
| 46 | sources = [ |
| 47 | "${android_libcpp_lib_dir}/${_soname}", |
| 48 | ] |
| 49 | outputs = [ |
| 50 | "${root_out_dir}/lib.unstripped/${_soname}", |
| 51 | ] |
| 52 | } |
| 53 | |
| 54 | action("cpplib_stripped") { |
| 55 | _strip_bin = "${android_tool_prefix}strip" |
| 56 | _soname = "libc++_shared.so" |
| 57 | _input_so = "${root_out_dir}/lib.unstripped/${_soname}" |
| 58 | _output_so = "${root_shlib_dir}/${_soname}" |
| 59 | |
| 60 | deps = [ |
| 61 | ":cpplib_unstripped", |
| 62 | ] |
| 63 | |
| 64 | script = "//build/gn_run_binary.py" |
| 65 | inputs = [ |
| 66 | _strip_bin, |
| 67 | ] |
| 68 | sources = [ |
| 69 | _input_so, |
| 70 | ] |
| 71 | outputs = [ |
| 72 | _output_so, |
| 73 | ] |
| 74 | |
| 75 | _rebased_strip_bin = rebase_path(_strip_bin, root_out_dir) |
| 76 | _rebased_input_so = rebase_path(_input_so, root_out_dir) |
| 77 | _rebased_output_so = rebase_path(_output_so, root_out_dir) |
| 78 | args = [ |
| 79 | _rebased_strip_bin, |
| 80 | "--strip-unneeded", |
| 81 | "-o", |
| 82 | _rebased_output_so, |
| 83 | _rebased_input_so, |
| 84 | ] |
| 85 | } |
| 86 | |
| 87 | group("test_runner_py") { |
| 88 | _py_files = read_file("test_runner.pydeps", "list lines") |
| 89 | |
| 90 | # Filter out comments. |
| 91 | set_sources_assignment_filter([ "#*" ]) |
| 92 | sources = _py_files |
| 93 | |
| 94 | data = sources + [ |
| 95 | "devil_chromium.json", |
| 96 | "pylib/gtest/filter/", |
| 97 | "//third_party/android_tools/sdk/build-tools/23.0.1/aapt", |
| 98 | "//third_party/android_tools/sdk/build-tools/23.0.1/dexdump", |
| 99 | "//third_party/android_tools/sdk/build-tools/23.0.1/lib/libc++.so", |
| 100 | "//third_party/android_tools/sdk/build-tools/23.0.1/split-select", |
| 101 | "//third_party/android_tools/sdk/platform-tools/adb", |
| 102 | "//third_party/catapult/third_party/gsutil/", |
| 103 | "//third_party/catapult/devil/devil/devil_dependencies.json", |
| 104 | "//third_party/proguard/lib/proguard.jar", |
| 105 | ] |
| 106 | data_deps = [ |
| 107 | "//tools/swarming_client:isolate_py", |
| 108 | ] |
| 109 | } |
| 110 | |
| 111 | # Create wrapper scripts in out/bin that takes care of setting the |
| 112 | # --output-directory. |
| 113 | _scripts_to_wrap = [ |
| 114 | # TODO(agrieve): Once GYP is no more, delete the checked-in adb_gdb_* scripts |
| 115 | # and generated a script for each android_apk() that has a native library. |
| 116 | "adb_gdb_android_webview_shell", |
| 117 | "adb_gdb_blimp_client", |
| 118 | "adb_gdb_chrome_public", |
| 119 | "adb_gdb_content_shell", |
| 120 | "adb_gdb_cronet_sample", |
| 121 | "adb_gdb_mojo_shell", |
| 122 | "asan_symbolize.py", |
| 123 | "tombstones.py", |
| 124 | ] |
| 125 | |
| 126 | _wrapper_targets = [] |
| 127 | foreach(script, _scripts_to_wrap) { |
| 128 | _target_name = get_path_info(script, "name") + "_wrapper" |
| 129 | _wrapper_targets += [ ":$_target_name" ] |
| 130 | wrapper_script(_target_name) { |
| 131 | target = script |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | group("wrapper_scripts") { |
| 136 | deps = _wrapper_targets |
| 137 | } |