crazy linker: convert relocation unpacking to Android style.
[chromium-blink-merge.git] / device / battery / battery.gyp
blobd55c7f9c1bee0ea481a54151e4bbceb867e44d7d
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.
6   'variables': {
7     'chromium_code': 1,
8   },
9   'targets': [
10     {
11       # GN version: //device/battery:battery_mojo
12       'target_name': 'device_battery_mojo_bindings',
13       'type': 'static_library',
14       'includes': [
15         '../../third_party/mojo/mojom_bindings_generator.gypi',
16       ],
17       'sources': [
18         'battery_monitor.mojom',
19         'battery_status.mojom',
20       ],
21     },
22     {
23       # This is needed only for a build within Android tree. TODO(ppi): remove
24       # when Android tree build is deprecated.
25       'target_name': 'device_battery_mojo_bindings_for_webview',
26       'type': 'none',
27       'dependencies': [
28         'device_battery_mojo_bindings',
29       ],
30       'actions': [
31         {
32           # Dummy action that triggers the bindings generation and explicitly
33           # declares the java outputs, so that they are discoverable to make.
34           'action_name': 'device_battery_mojo_bindings_dummy_action',
35           'inputs': [
36             '<(SHARED_INTERMEDIATE_DIR)/device/battery/battery_monitor.mojom.h',
37             '<(SHARED_INTERMEDIATE_DIR)/device/battery/battery_status.mojom.h',
38           ],
39           'outputs': [
40             '<(SHARED_INTERMEDIATE_DIR)/java_mojo/device_battery_mojo_bindings/src/org/chromium/mojom/device/BatteryMonitor.java',
41             '<(SHARED_INTERMEDIATE_DIR)/java_mojo/device_battery_mojo_bindings/src/org/chromium/mojom/device/BatteryMonitor_Internal.java',
42             '<(SHARED_INTERMEDIATE_DIR)/java_mojo/device_battery_mojo_bindings/src/org/chromium/mojom/device/BatteryStatusObserver.java',
43             '<(SHARED_INTERMEDIATE_DIR)/java_mojo/device_battery_mojo_bindings/src/org/chromium/mojom/device/BatteryStatusObserver_Internal.java',
44             '<(SHARED_INTERMEDIATE_DIR)/java_mojo/device_battery_mojo_bindings/src/org/chromium/mojom/device/BatteryStatus.java',
45           ],
46           'action': ['touch', '<@(_outputs)'],
47         },
48       ],
49       'hard_dependency': 1,
50     },
51     {
52       # GN version: //device/battery
53       'target_name': 'device_battery',
54       'type': '<(component)',
55       'dependencies': [
56         '../../base/base.gyp:base',
57         '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
58         '../../mojo/mojo_base.gyp:mojo_environment_chromium',
59         '../../third_party/mojo/mojo_edk.gyp:mojo_system_impl',
60         '../../third_party/mojo/mojo_public.gyp:mojo_cpp_bindings',
61         'device_battery_mojo_bindings',
62       ],
63       'defines': [
64         'DEVICE_BATTERY_IMPLEMENTATION',
65       ],
66       'sources': [
67         'battery_monitor_impl.cc',
68         'battery_monitor_impl.h',
69         'battery_status_manager_chromeos.cc',
70         'battery_status_manager_default.cc',
71         'battery_status_manager_linux.cc',
72         'battery_status_manager_linux.h',
73         'battery_status_manager_mac.cc',
74         'battery_status_manager_win.cc',
75         'battery_status_manager_win.h',
76         'battery_status_manager.h',
77         'battery_status_service.cc',
78         'battery_status_service.h',
79       ],
80       'conditions': [
81         ['chromeos==1', {
82           'dependencies': [
83             '../../build/linux/system.gyp:dbus',
84             '../../chromeos/chromeos.gyp:chromeos',
85             '../../chromeos/chromeos.gyp:power_manager_proto',
86           ],
87           'sources!': [
88             'battery_status_manager_default.cc',
89             'battery_status_manager_linux.cc',
90           ],
91         }],
92         ['OS == "android"', {
93           'dependencies': [
94             'device_battery_java',
95           ],
96         }],
97         ['OS == "linux" and use_dbus==1', {
98           'sources!': [
99             'battery_status_manager_default.cc',
100           ],
101           'dependencies': [
102             '../../build/linux/system.gyp:dbus',
103             '../../dbus/dbus.gyp:dbus',
104           ],
105         }, {  # OS != "linux" or use_dbus==0
106           'sources!': [
107             'battery_status_manager_linux.cc',
108           ],
109         }],
110         ['OS == "mac"', {
111           'sources!': [
112             'battery_status_manager_default.cc',
113           ],
114         }],
115         ['OS == "win"', {
116           'sources!': [
117             'battery_status_manager_default.cc',
118           ],
119         }],
120       ],
121     },
122   ],
123   'conditions': [
124     ['OS == "android"', {
125       'targets': [
126         {
127           'target_name': 'device_battery_java',
128           'type': 'none',
129           'dependencies': [
130             '../../base/base.gyp:base',
131             '../../third_party/mojo/mojo_public.gyp:mojo_bindings_java',
132             'device_battery_mojo_bindings',
133           ],
134           'variables': {
135             'java_in_dir': '../../device/battery/android/java',
136           },
137           'includes': [ '../../build/java.gypi' ],
138         },
139         {
140           'target_name': 'device_battery_javatests',
141           'type': 'none',
142           'variables': {
143             'java_in_dir': '../../device/battery/android/javatests',
144           },
145           'dependencies': [
146             '../../base/base.gyp:base',
147             '../../base/base.gyp:base_java_test_support',
148             'device_battery_java',
149           ],
150           'includes': [ '../../build/java.gypi' ],
151         },
152       ],
153     }],
154   ],