OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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/features.gni") | 5 import("//build/config/features.gni") |
6 | 6 |
7 assert(!is_ios) | 7 assert(!is_ios) |
8 | 8 |
| 9 if (is_android) { |
| 10 import("//build/config/android/rules.gni") # For generate_jni(). |
| 11 } |
| 12 |
9 source_ids = "//third_party/usb_ids/usb.ids" | 13 source_ids = "//third_party/usb_ids/usb.ids" |
10 generated_ids = "$target_gen_dir/usb_ids_gen.cc" | 14 generated_ids = "$target_gen_dir/usb_ids_gen.cc" |
11 | 15 |
12 source_set("usb") { | 16 source_set("usb") { |
13 sources = [ | 17 sources = [ |
| 18 "android/usb_jni_registrar.cc", |
| 19 "android/usb_jni_registrar.h", |
| 20 "usb_configuration_android.cc", |
| 21 "usb_configuration_android.h", |
14 "usb_descriptors.cc", | 22 "usb_descriptors.cc", |
15 "usb_descriptors.h", | 23 "usb_descriptors.h", |
16 "usb_device.cc", | 24 "usb_device.cc", |
17 "usb_device.h", | 25 "usb_device.h", |
| 26 "usb_device_android.cc", |
| 27 "usb_device_android.h", |
18 "usb_device_filter.cc", | 28 "usb_device_filter.cc", |
19 "usb_device_filter.h", | 29 "usb_device_filter.h", |
20 "usb_device_handle.cc", | 30 "usb_device_handle.cc", |
21 "usb_device_handle.h", | 31 "usb_device_handle.h", |
| 32 "usb_endpoint_android.cc", |
| 33 "usb_endpoint_android.h", |
22 "usb_ids.cc", | 34 "usb_ids.cc", |
23 "usb_ids.h", | 35 "usb_ids.h", |
| 36 "usb_interface_android.cc", |
| 37 "usb_interface_android.h", |
24 "usb_service.cc", | 38 "usb_service.cc", |
25 "usb_service.h", | 39 "usb_service.h", |
| 40 "usb_service_android.cc", |
| 41 "usb_service_android.h", |
26 "webusb_descriptors.cc", | 42 "webusb_descriptors.cc", |
27 "webusb_descriptors.h", | 43 "webusb_descriptors.h", |
28 generated_ids, | 44 generated_ids, |
29 ] | 45 ] |
30 | 46 |
31 deps = [ | 47 deps = [ |
32 ":usb_device_ids", | 48 ":usb_device_ids", |
33 "//base", | 49 "//base", |
34 "//base/third_party/dynamic_annotations", | 50 "//base/third_party/dynamic_annotations", |
35 "//components/device_event_log", | 51 "//components/device_event_log", |
36 "//device/core", | 52 "//device/core", |
37 "//net", | 53 "//net", |
38 ] | 54 ] |
39 | 55 |
40 if (use_udev) { | 56 if (use_udev) { |
41 deps += [ "//device/udev_linux" ] | 57 deps += [ "//device/udev_linux" ] |
42 } | 58 } |
43 | 59 |
44 if (is_android) { | 60 if (is_android) { |
45 sources += [ | 61 deps += [ ":jni_headers" ] |
46 "usb_service_android.cc", | |
47 "usb_service_android.h", | |
48 ] | |
49 } else { | 62 } else { |
50 sources += [ | 63 sources += [ |
51 "usb_context.cc", | 64 "usb_context.cc", |
52 "usb_context.h", | 65 "usb_context.h", |
53 "usb_device_handle_impl.cc", | 66 "usb_device_handle_impl.cc", |
54 "usb_device_handle_impl.h", | 67 "usb_device_handle_impl.h", |
55 "usb_device_impl.cc", | 68 "usb_device_impl.cc", |
56 "usb_device_impl.h", | 69 "usb_device_impl.h", |
57 "usb_error.cc", | 70 "usb_error.cc", |
58 "usb_error.h", | 71 "usb_error.h", |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 args = [ | 117 args = [ |
105 "-i", | 118 "-i", |
106 rebase_path(source_ids, root_build_dir), | 119 rebase_path(source_ids, root_build_dir), |
107 "-o", | 120 "-o", |
108 rebase_path(generated_ids, root_build_dir), | 121 rebase_path(generated_ids, root_build_dir), |
109 ] | 122 ] |
110 | 123 |
111 # Only the device_usb target can depend on us. | 124 # Only the device_usb target can depend on us. |
112 visibility = [ ":usb" ] | 125 visibility = [ ":usb" ] |
113 } | 126 } |
| 127 |
| 128 if (is_android) { |
| 129 java_sources_needing_jni = [ |
| 130 "android/java/src/org/chromium/device/usb/ChromeUsbConfiguration.java", |
| 131 "android/java/src/org/chromium/device/usb/ChromeUsbDevice.java", |
| 132 "android/java/src/org/chromium/device/usb/ChromeUsbEndpoint.java", |
| 133 "android/java/src/org/chromium/device/usb/ChromeUsbInterface.java", |
| 134 "android/java/src/org/chromium/device/usb/ChromeUsbService.java", |
| 135 ] |
| 136 |
| 137 generate_jni("jni_headers") { |
| 138 sources = java_sources_needing_jni |
| 139 jni_package = "device" |
| 140 } |
| 141 |
| 142 java_cpp_enum("usb_descriptors_javagen") { |
| 143 sources = [ |
| 144 "usb_descriptors.h", |
| 145 ] |
| 146 } |
| 147 |
| 148 android_library("java") { |
| 149 java_files = java_sources_needing_jni |
| 150 deps = [ |
| 151 "//base:base_java", |
| 152 ] |
| 153 srcjar_deps = [ ":usb_descriptors_javagen" ] |
| 154 } |
| 155 } |
OLD | NEW |