De-duplicate BASE_IMPLEMENTATION define in the GN build.
[chromium-blink-merge.git] / base / BUILD.gn
blobf1034466a65dbb033103fd4743edf6b288509322
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
3 # found in the LICENSE file.
5 import("//build/config/ui.gni")
6 import("//testing/test.gni")
8 if (is_android) {
9   import("//build/config/android/rules.gni")
12 config("base_implementation") {
13   defines = [ "BASE_IMPLEMENTATION" ]
16 source_set("base_paths") {
17   sources = [
18     "base_paths.cc",
19     "base_paths.h",
20     "base_paths_android.cc",
21     "base_paths_android.h",
22     "base_paths_mac.h",
23     "base_paths_mac.mm",
24     "base_paths_posix.cc",
25     "base_paths_posix.h",
26     "base_paths_win.cc",
27     "base_paths_win.h",
28   ]
30   if (is_android || is_mac) {
31     sources -= [ "base_paths_posix.cc" ]
32   }
34   if (is_nacl) {
35     sources -= [
36       "base_paths.cc",
37       "base_paths_posix.cc",
38     ]
39   }
41   configs += [ ":base_implementation" ]
43   deps = [
44     "//base/memory",
45     "//base/process",
46   ]
48   visibility = [ ":base" ]
51 component("base") {
52   sources = [
53     "allocator/allocator_extension.cc",
54     "allocator/allocator_extension.h",
55     "allocator/type_profiler_control.cc",
56     "allocator/type_profiler_control.h",
57     "android/animation_frame_time_histogram.cc",
58     "android/animation_frame_time_histogram.h",
59     "android/application_status_listener.cc",
60     "android/application_status_listener.h",
61     "android/base_jni_onload.cc",
62     "android/base_jni_onload.h",
63     "android/base_jni_registrar.cc",
64     "android/base_jni_registrar.h",
65     "android/build_info.cc",
66     "android/build_info.h",
67     "android/command_line_android.cc",
68     "android/command_line_android.h",
69     "android/content_uri_utils.cc",
70     "android/content_uri_utils.h",
71     "android/cpu_features.cc",
72     "android/event_log.cc",
73     "android/event_log.h",
74     "android/field_trial_list.cc",
75     "android/field_trial_list.h",
76     "android/fifo_utils.cc",
77     "android/fifo_utils.h",
78     "android/important_file_writer_android.cc",
79     "android/important_file_writer_android.h",
80     "android/java_handler_thread.cc",
81     "android/java_handler_thread.h",
82     "android/jni_android.cc",
83     "android/jni_android.h",
84     "android/jni_array.cc",
85     "android/jni_array.h",
86     "android/jni_registrar.cc",
87     "android/jni_registrar.h",
88     "android/jni_string.cc",
89     "android/jni_string.h",
90     "android/jni_utils.cc",
91     "android/jni_utils.h",
92     "android/jni_weak_ref.cc",
93     "android/jni_weak_ref.h",
94     "android/library_loader/library_load_from_apk_status_codes.h",
95     "android/library_loader/library_loader_hooks.cc",
96     "android/library_loader/library_loader_hooks.h",
97     "android/locale_utils.cc",
98     "android/locale_utils.h",
99     "android/memory_pressure_listener_android.cc",
100     "android/memory_pressure_listener_android.h",
101     "android/path_service_android.cc",
102     "android/path_service_android.h",
103     "android/path_utils.cc",
104     "android/path_utils.h",
105     "android/record_histogram.cc",
106     "android/record_histogram.h",
107     "android/scoped_java_ref.cc",
108     "android/scoped_java_ref.h",
109     "android/sys_utils.cc",
110     "android/sys_utils.h",
111     "android/thread_utils.h",
112     "android/trace_event_binding.cc",
113     "android/trace_event_binding.h",
114     "async_socket_io_handler.h",
115     "async_socket_io_handler_posix.cc",
116     "async_socket_io_handler_win.cc",
117     "at_exit.cc",
118     "at_exit.h",
119     "atomic_ref_count.h",
120     "atomic_sequence_num.h",
121     "atomicops.h",
122     "atomicops_internals_gcc.h",
123     "atomicops_internals_mac.h",
124     "atomicops_internals_portable.h",
125     "atomicops_internals_x86_gcc.cc",
126     "atomicops_internals_x86_gcc.h",
127     "atomicops_internals_x86_msvc.h",
128     "auto_reset.h",
129     "barrier_closure.cc",
130     "barrier_closure.h",
131     "base64.cc",
132     "base64.h",
133     "base_export.h",
134     "base_switches.h",
135     "basictypes.h",
136     "big_endian.cc",
137     "big_endian.h",
138     "bind.h",
139     "bind_helpers.cc",
140     "bind_helpers.h",
141     "bind_internal.h",
142     "bind_internal_win.h",
143     "bits.h",
144     "build_time.cc",
145     "build_time.h",
146     "callback.h",
147     "callback_helpers.cc",
148     "callback_helpers.h",
149     "callback_internal.cc",
150     "callback_internal.h",
151     "cancelable_callback.h",
152     "chromeos/memory_pressure_observer_chromeos.cc",
153     "chromeos/memory_pressure_observer_chromeos.h",
154     "command_line.cc",
155     "command_line.h",
156     "compiler_specific.h",
157     "containers/adapters.h",
158     "containers/hash_tables.h",
159     "containers/linked_list.h",
160     "containers/mru_cache.h",
161     "containers/small_map.h",
162     "containers/stack_container.h",
163     "cpu.cc",
164     "cpu.h",
165     "critical_closure.h",
166     "critical_closure_internal_ios.mm",
167     "deferred_sequenced_task_runner.cc",
168     "deferred_sequenced_task_runner.h",
169     "environment.cc",
170     "environment.h",
171     "file_descriptor_posix.h",
172     "file_version_info.h",
173     "file_version_info_mac.h",
174     "file_version_info_mac.mm",
175     "file_version_info_win.cc",
176     "file_version_info_win.h",
177     "files/dir_reader_fallback.h",
178     "files/dir_reader_linux.h",
179     "files/dir_reader_posix.h",
180     "files/file.cc",
181     "files/file_enumerator.cc",
182     "files/file_enumerator.h",
183     "files/file_enumerator_posix.cc",
184     "files/file_enumerator_win.cc",
185     "files/file_path.cc",
186     "files/file_path.h",
187     "files/file_path_constants.cc",
188     "files/file_path_watcher.cc",
189     "files/file_path_watcher.h",
190     "files/file_path_watcher_fsevents.cc",
191     "files/file_path_watcher_fsevents.h",
192     "files/file_path_watcher_kqueue.cc",
193     "files/file_path_watcher_kqueue.h",
194     "files/file_path_watcher_linux.cc",
195     "files/file_path_watcher_mac.cc",
196     "files/file_path_watcher_win.cc",
197     "files/file_posix.cc",
198     "files/file_proxy.cc",
199     "files/file_proxy.h",
200     "files/file_util.cc",
201     "files/file_util.h",
202     "files/file_util_android.cc",
203     "files/file_util_linux.cc",
204     "files/file_util_mac.mm",
205     "files/file_util_posix.cc",
206     "files/file_util_proxy.cc",
207     "files/file_util_proxy.h",
208     "files/file_util_win.cc",
209     "files/file_win.cc",
210     "files/important_file_writer.cc",
211     "files/important_file_writer.h",
212     "files/memory_mapped_file.cc",
213     "files/memory_mapped_file.h",
214     "files/memory_mapped_file_posix.cc",
215     "files/memory_mapped_file_win.cc",
216     "files/scoped_file.cc",
217     "files/scoped_file.h",
218     "files/scoped_temp_dir.cc",
219     "files/scoped_temp_dir.h",
220     "float_util.h",
221     "format_macros.h",
222     "gtest_prod_util.h",
223     "guid.cc",
224     "guid.h",
225     "guid_posix.cc",
226     "guid_win.cc",
227     "hash.cc",
228     "hash.h",
229     "id_map.h",
230     "ios/device_util.h",
231     "ios/device_util.mm",
232     "ios/ios_util.h",
233     "ios/ios_util.mm",
234     "ios/scoped_critical_action.h",
235     "ios/scoped_critical_action.mm",
236     "ios/weak_nsobject.h",
237     "ios/weak_nsobject.mm",
238     "lazy_instance.cc",
239     "lazy_instance.h",
240     "linux_util.cc",
241     "linux_util.h",
242     "location.cc",
243     "location.h",
244     "logging.cc",
245     "logging.h",
246     "logging_win.cc",
247     "logging_win.h",
248     "mac/authorization_util.h",
249     "mac/authorization_util.mm",
250     "mac/bind_objc_block.h",
251     "mac/bundle_locations.h",
252     "mac/bundle_locations.mm",
253     "mac/cocoa_protocols.h",
254     "mac/foundation_util.h",
255     "mac/foundation_util.mm",
256     "mac/launch_services_util.cc",
257     "mac/launch_services_util.h",
258     "mac/launchd.cc",
259     "mac/launchd.h",
260     "mac/libdispatch_task_runner.cc",
261     "mac/libdispatch_task_runner.h",
262     "mac/mac_logging.cc",
263     "mac/mac_logging.h",
264     "mac/mac_util.h",
265     "mac/mac_util.mm",
266     "mac/mach_logging.cc",
267     "mac/mach_logging.h",
268     "mac/objc_property_releaser.h",
269     "mac/objc_property_releaser.mm",
270     "mac/os_crash_dumps.cc",
271     "mac/os_crash_dumps.h",
272     "mac/scoped_aedesc.h",
273     "mac/scoped_authorizationref.h",
274     "mac/scoped_block.h",
275     "mac/scoped_cftyperef.h",
276     "mac/scoped_ioobject.h",
277     "mac/scoped_ioplugininterface.h",
278     "mac/scoped_launch_data.h",
279     "mac/scoped_mach_port.cc",
280     "mac/scoped_mach_port.h",
281     "mac/scoped_mach_vm.cc",
282     "mac/scoped_mach_vm.h",
283     "mac/scoped_nsautorelease_pool.h",
284     "mac/scoped_nsautorelease_pool.mm",
285     "mac/scoped_nsexception_enabler.h",
286     "mac/scoped_nsexception_enabler.mm",
287     "mac/scoped_nsobject.h",
288     "mac/scoped_objc_class_swizzler.h",
289     "mac/scoped_objc_class_swizzler.mm",
290     "mac/scoped_sending_event.h",
291     "mac/scoped_sending_event.mm",
292     "mac/sdk_forward_declarations.h",
293     "mac/sdk_forward_declarations.mm",
294     "macros.h",
295     "md5.cc",
296     "md5.h",
297     "message_loop/incoming_task_queue.cc",
298     "message_loop/incoming_task_queue.h",
299     "message_loop/message_loop.cc",
300     "message_loop/message_loop.h",
301     "message_loop/message_loop_proxy.cc",
302     "message_loop/message_loop_proxy.h",
303     "message_loop/message_loop_proxy_impl.cc",
304     "message_loop/message_loop_proxy_impl.h",
305     "message_loop/message_pump.cc",
306     "message_loop/message_pump.h",
307     "message_loop/message_pump_android.cc",
308     "message_loop/message_pump_android.h",
309     "message_loop/message_pump_default.cc",
310     "message_loop/message_pump_default.h",
311     "message_loop/message_pump_glib.cc",
312     "message_loop/message_pump_glib.h",
313     "message_loop/message_pump_io_ios.cc",
314     "message_loop/message_pump_io_ios.h",
315     "message_loop/message_pump_libevent.cc",
316     "message_loop/message_pump_libevent.h",
317     "message_loop/message_pump_mac.h",
318     "message_loop/message_pump_mac.mm",
319     "message_loop/message_pump_win.cc",
320     "message_loop/message_pump_win.h",
321     "move.h",
322     "native_library.h",
323     "native_library_mac.mm",
324     "native_library_posix.cc",
325     "native_library_win.cc",
326     "nix/mime_util_xdg.cc",
327     "nix/mime_util_xdg.h",
328     "nix/xdg_util.cc",
329     "nix/xdg_util.h",
330     "numerics/safe_conversions.h",
331     "numerics/safe_conversions_impl.h",
332     "numerics/safe_math.h",
333     "numerics/safe_math_impl.h",
334     "observer_list.h",
335     "observer_list_threadsafe.h",
336     "os_compat_android.cc",
337     "os_compat_android.h",
338     "os_compat_nacl.cc",
339     "os_compat_nacl.h",
340     "path_service.cc",
341     "path_service.h",
342     "pending_task.cc",
343     "pending_task.h",
344     "pickle.cc",
345     "pickle.h",
346     "port.h",
347     "posix/eintr_wrapper.h",
348     "posix/file_descriptor_shuffle.cc",
349     "posix/global_descriptors.cc",
350     "posix/global_descriptors.h",
351     "posix/unix_domain_socket_linux.cc",
352     "posix/unix_domain_socket_linux.h",
353     "power_monitor/power_monitor.cc",
354     "power_monitor/power_monitor.h",
355     "power_monitor/power_monitor_device_source.cc",
356     "power_monitor/power_monitor_device_source.h",
357     "power_monitor/power_monitor_device_source_android.cc",
358     "power_monitor/power_monitor_device_source_android.h",
359     "power_monitor/power_monitor_device_source_chromeos.cc",
360     "power_monitor/power_monitor_device_source_ios.mm",
361     "power_monitor/power_monitor_device_source_mac.mm",
362     "power_monitor/power_monitor_device_source_posix.cc",
363     "power_monitor/power_monitor_device_source_win.cc",
364     "power_monitor/power_monitor_source.cc",
365     "power_monitor/power_monitor_source.h",
366     "power_monitor/power_observer.h",
367     "profiler/alternate_timer.cc",
368     "profiler/alternate_timer.h",
369     "profiler/scoped_profile.cc",
370     "profiler/scoped_profile.h",
371     "profiler/scoped_tracker.cc",
372     "profiler/scoped_tracker.h",
373     "profiler/tracked_time.cc",
374     "profiler/tracked_time.h",
375     "rand_util.cc",
376     "rand_util.h",
377     "rand_util_nacl.cc",
378     "rand_util_posix.cc",
379     "rand_util_win.cc",
380     "run_loop.cc",
381     "run_loop.h",
382     "safe_strerror_posix.cc",
383     "safe_strerror_posix.h",
384     "scoped_generic.h",
385     "scoped_native_library.cc",
386     "scoped_native_library.h",
387     "scoped_observer.h",
388     "sequence_checker.h",
389     "sequence_checker_impl.cc",
390     "sequence_checker_impl.h",
391     "sequenced_task_runner.cc",
392     "sequenced_task_runner.h",
393     "sequenced_task_runner_helpers.h",
394     "sha1.h",
395     "sha1_portable.cc",
396     "sha1_win.cc",
397     "single_thread_task_runner.h",
398     "stl_util.h",
399     "strings/latin1_string_conversions.cc",
400     "strings/latin1_string_conversions.h",
401     "strings/nullable_string16.cc",
402     "strings/nullable_string16.h",
403     "strings/safe_sprintf.cc",
404     "strings/safe_sprintf.h",
405     "strings/string16.cc",
406     "strings/string16.h",
407     "strings/string_number_conversions.cc",
408     "strings/string_number_conversions.h",
409     "strings/string_piece.cc",
410     "strings/string_piece.h",
411     "strings/string_split.cc",
412     "strings/string_split.h",
413     "strings/string_tokenizer.h",
414     "strings/string_util.cc",
415     "strings/string_util.h",
416     "strings/string_util_constants.cc",
417     "strings/string_util_posix.h",
418     "strings/string_util_win.h",
419     "strings/stringize_macros.h",
420     "strings/stringprintf.cc",
421     "strings/stringprintf.h",
422     "strings/sys_string_conversions.h",
423     "strings/sys_string_conversions_mac.mm",
424     "strings/sys_string_conversions_posix.cc",
425     "strings/sys_string_conversions_win.cc",
426     "strings/utf_offset_string_conversions.cc",
427     "strings/utf_offset_string_conversions.h",
428     "strings/utf_string_conversion_utils.cc",
429     "strings/utf_string_conversion_utils.h",
430     "strings/utf_string_conversions.cc",
431     "strings/utf_string_conversions.h",
432     "supports_user_data.cc",
433     "supports_user_data.h",
434     "sync_socket.h",
435     "sync_socket_posix.cc",
436     "sync_socket_win.cc",
437     "synchronization/cancellation_flag.cc",
438     "synchronization/cancellation_flag.h",
439     "synchronization/condition_variable.h",
440     "synchronization/condition_variable_posix.cc",
441     "synchronization/condition_variable_win.cc",
442     "synchronization/lock.cc",
443     "synchronization/lock.h",
444     "synchronization/lock_impl.h",
445     "synchronization/lock_impl_posix.cc",
446     "synchronization/lock_impl_win.cc",
447     "synchronization/spin_wait.h",
448     "synchronization/waitable_event.h",
449     "synchronization/waitable_event_posix.cc",
450     "synchronization/waitable_event_watcher.h",
451     "synchronization/waitable_event_watcher_posix.cc",
452     "synchronization/waitable_event_watcher_win.cc",
453     "synchronization/waitable_event_win.cc",
454     "sys_byteorder.h",
455     "sys_info.cc",
456     "sys_info.h",
457     "sys_info_android.cc",
458     "sys_info_chromeos.cc",
459     "sys_info_freebsd.cc",
460     "sys_info_ios.mm",
461     "sys_info_linux.cc",
462     "sys_info_mac.cc",
463     "sys_info_openbsd.cc",
464     "sys_info_posix.cc",
465     "sys_info_win.cc",
466     "system_monitor/system_monitor.cc",
467     "system_monitor/system_monitor.h",
468     "task/cancelable_task_tracker.cc",
469     "task/cancelable_task_tracker.h",
470     "task_runner.cc",
471     "task_runner.h",
472     "task_runner_util.h",
473     "template_util.h",
474     "third_party/dmg_fp/dmg_fp.h",
475     "third_party/dmg_fp/dtoa_wrapper.cc",
476     "third_party/dmg_fp/g_fmt.cc",
477     "third_party/icu/icu_utf.cc",
478     "third_party/icu/icu_utf.h",
479     "third_party/superfasthash/superfasthash.c",
480     "thread_task_runner_handle.cc",
481     "thread_task_runner_handle.h",
482     "threading/non_thread_safe.h",
483     "threading/non_thread_safe_impl.cc",
484     "threading/non_thread_safe_impl.h",
485     "threading/platform_thread.h",
486     "threading/platform_thread_android.cc",
487     "threading/platform_thread_linux.cc",
488     "threading/platform_thread_mac.mm",
489     "threading/platform_thread_posix.cc",
490     "threading/platform_thread_win.cc",
491     "threading/post_task_and_reply_impl.cc",
492     "threading/post_task_and_reply_impl.h",
493     "threading/sequenced_worker_pool.cc",
494     "threading/sequenced_worker_pool.h",
495     "threading/simple_thread.cc",
496     "threading/simple_thread.h",
497     "threading/thread.cc",
498     "threading/thread.h",
499     "threading/thread_checker.h",
500     "threading/thread_checker_impl.cc",
501     "threading/thread_checker_impl.h",
502     "threading/thread_collision_warner.cc",
503     "threading/thread_collision_warner.h",
504     "threading/thread_id_name_manager.cc",
505     "threading/thread_id_name_manager.h",
506     "threading/thread_local.h",
507     "threading/thread_local_android.cc",
508     "threading/thread_local_posix.cc",
509     "threading/thread_local_storage.cc",
510     "threading/thread_local_storage.h",
511     "threading/thread_local_storage_posix.cc",
512     "threading/thread_local_storage_win.cc",
513     "threading/thread_local_win.cc",
514     "threading/thread_restrictions.cc",
515     "threading/thread_restrictions.h",
516     "threading/watchdog.cc",
517     "threading/watchdog.h",
518     "threading/worker_pool.cc",
519     "threading/worker_pool.h",
520     "threading/worker_pool_posix.cc",
521     "threading/worker_pool_posix.h",
522     "threading/worker_pool_win.cc",
523     "time/clock.cc",
524     "time/clock.h",
525     "time/default_clock.cc",
526     "time/default_clock.h",
527     "time/default_tick_clock.cc",
528     "time/default_tick_clock.h",
529     "time/tick_clock.cc",
530     "time/tick_clock.h",
531     "time/time.cc",
532     "time/time.h",
533     "time/time_mac.cc",
534     "time/time_posix.cc",
535     "time/time_win.cc",
536     "timer/elapsed_timer.cc",
537     "timer/elapsed_timer.h",
538     "timer/hi_res_timer_manager.h",
539     "timer/hi_res_timer_manager_posix.cc",
540     "timer/hi_res_timer_manager_win.cc",
541     "timer/mock_timer.cc",
542     "timer/mock_timer.h",
543     "timer/timer.cc",
544     "timer/timer.h",
545     "tracked_objects.cc",
546     "tracked_objects.h",
547     "tracking_info.cc",
548     "tracking_info.h",
549     "tuple.h",
550     "value_conversions.cc",
551     "value_conversions.h",
552     "values.cc",
553     "values.h",
554     "version.cc",
555     "version.h",
556     "vlog.cc",
557     "vlog.h",
558     "win/enum_variant.cc",
559     "win/enum_variant.h",
560     "win/event_trace_consumer.h",
561     "win/event_trace_controller.cc",
562     "win/event_trace_controller.h",
563     "win/event_trace_provider.cc",
564     "win/event_trace_provider.h",
565     "win/i18n.cc",
566     "win/i18n.h",
567     "win/iat_patch_function.cc",
568     "win/iat_patch_function.h",
569     "win/iunknown_impl.cc",
570     "win/iunknown_impl.h",
571     "win/message_window.cc",
572     "win/message_window.h",
573     "win/metro.cc",
574     "win/metro.h",
575     "win/object_watcher.cc",
576     "win/object_watcher.h",
577     "win/registry.cc",
578     "win/registry.h",
579     "win/resource_util.cc",
580     "win/resource_util.h",
581     "win/scoped_bstr.cc",
582     "win/scoped_bstr.h",
583     "win/scoped_co_mem.h",
584     "win/scoped_com_initializer.h",
585     "win/scoped_comptr.h",
586     "win/scoped_gdi_object.h",
587     "win/scoped_handle.cc",
588     "win/scoped_handle.h",
589     "win/scoped_hdc.h",
590     "win/scoped_hglobal.h",
591     "win/scoped_process_information.cc",
592     "win/scoped_process_information.h",
593     "win/scoped_propvariant.h",
594     "win/scoped_select_object.h",
595     "win/scoped_variant.cc",
596     "win/scoped_variant.h",
597     "win/shortcut.cc",
598     "win/shortcut.h",
599     "win/startup_information.cc",
600     "win/startup_information.h",
601     "win/win_util.cc",
602     "win/win_util.h",
603     "win/windows_version.cc",
604     "win/windows_version.h",
605     "win/wrapped_window_proc.cc",
606     "win/wrapped_window_proc.h",
607   ]
609   sources -= [
610     "sys_info_freebsd.cc",
611     "sys_info_openbsd.cc",
612   ]
614   configs += [ ":base_implementation" ]
616   deps = [
617     ":base_static",
618     "//base/allocator:allocator_extension_thunks",
619     "//base/third_party/dynamic_annotations",
620     "//base/third_party/nspr",
621     "//third_party/modp_b64",
622   ]
624   public_deps = [
625     ":base_paths",
626     "//base/debug",
627     "//base/json",
628     "//base/memory",
629     "//base/metrics",
630     "//base/process",
631     "//base/trace_event",
632   ]
634   # Allow more direct string conversions on platforms with native utf8
635   # strings
636   if (is_mac || is_ios || is_chromeos) {
637     defines = [ "SYSTEM_NATIVE_UTF8" ]
638   }
640   if (is_android) {
641     sources -= [ "power_monitor/power_monitor_device_source_posix.cc" ]
643     # Android uses some Linux sources, put those back.
644     set_sources_assignment_filter([])
645     sources += [
646       "files/file_path_watcher_linux.cc",
647       "posix/unix_domain_socket_linux.cc",
648       "sys_info_linux.cc",
649     ]
650     set_sources_assignment_filter(sources_assignment_filter)
652     deps += [
653       ":base_jni_headers",
654       "//third_party/ashmem",
655       "//third_party/android_tools:cpu_features",
656     ]
658     # logging.cc uses the Android logging library.
659     libs = [ "log" ]
660   }
662   if (is_chromeos) {
663     sources -= [ "power_monitor/power_monitor_device_source_posix.cc" ]
664   }
666   if (is_nacl) {
667     # We reset sources_assignment_filter in order to explicitly include
668     # the linux file (which would otherwise be filtered out).
669     set_sources_assignment_filter([])
670     sources += [
671       "files/file_path_watcher_stub.cc",
672       "sync_socket_nacl.cc",
673       "threading/platform_thread_linux.cc",
674     ]
675     set_sources_assignment_filter(sources_assignment_filter)
677     sources -= [
678       "allocator/type_profiler_control.cc",
679       "allocator/type_profiler_control.h",
680       "async_socket_io_handler_posix.cc",
681       "cpu.cc",
682       "files/file_enumerator_posix.cc",
683       "files/file_proxy.cc",
684       "files/file_util.cc",
685       "files/file_util_posix.cc",
686       "files/file_util_proxy.cc",
687       "files/important_file_writer.cc",
688       "files/important_file_writer.h",
689       "files/scoped_temp_dir.cc",
690       "message_loop/message_pump_libevent.cc",
691       "native_library_posix.cc",
692       "path_service.cc",
693       "rand_util_posix.cc",
694       "scoped_native_library.cc",
695       "sync_socket_posix.cc",
696       "sys_info.cc",
697       "sys_info_posix.cc",
698     ]
699   } else {
700     # Remove NaCl stuff.
701     sources -= [
702       "os_compat_nacl.cc",
703       "os_compat_nacl.h",
704       "rand_util_nacl.cc",
705     ]
706   }
708   # Windows.
709   if (is_win) {
710     sources -= [
711       "message_loop/message_pump_libevent.cc",
712       "strings/string16.cc",
714       # Not using sha1_win.cc because it may have caused a
715       # regression to page cycler moz.
716       "sha1_win.cc",
717     ]
719     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
720     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
722     libs = [
723       "cfgmgr32.lib",
724       "netapi32.lib",
725       "powrprof.lib",
726       "setupapi.lib",
727     ]
728     ldflags = [
729       "/DELAYLOAD:cfgmgr32.dll",
730       "/DELAYLOAD:powrprof.dll",
731       "/DELAYLOAD:setupapi.dll",
732     ]
733   } else if (!is_nacl) {
734     # Non-Windows.
735     deps += [ "//third_party/libevent" ]
736   }
738   # Mac.
739   if (is_mac) {
740     sources -= [
741       "native_library_posix.cc",
742       "strings/sys_string_conversions_posix.cc",
743     ]
744   } else {
745     # Non-Mac.
746     sources -= [
747       "files/file_path_watcher_fsevents.cc",
748       "files/file_path_watcher_fsevents.h",
749       "files/file_path_watcher_kqueue.cc",
750       "files/file_path_watcher_kqueue.h",
751     ]
752   }
754   # Linux.
755   if (is_linux) {
756     # TODO(brettw) this will need to be parameterized at some point.
757     linux_configs = []
758     if (use_glib) {
759       linux_configs += [ "//build/config/linux:glib" ]
760     }
762     configs += linux_configs
763     all_dependent_configs = linux_configs
765     # These dependencies are not required on Android, and in the case
766     # of xdg_mime must be excluded due to licensing restrictions.
767     deps += [
768       "//base/third_party/xdg_mime",
769       "//base/third_party/xdg_user_dirs",
770     ]
771   } else {
772     # Non-Linux.
773     sources -= [
774       "nix/mime_util_xdg.cc",
775       "nix/mime_util_xdg.h",
776       "nix/xdg_util.cc",
777       "nix/xdg_util.h",
778     ]
780     if (!is_android) {
781       sources -= [
782         "linux_util.cc",
783         "linux_util.h",
784       ]
785     }
786   }
788   if (!use_glib) {
789     sources -= [
790       "message_loop/message_pump_glib.cc",
791       "message_loop/message_pump_glib.h",
792     ]
793   }
795   configs += [ "//build/config/compiler:wexit_time_destructors" ]
796   if (is_android && !is_debug) {
797     configs -= [ "//build/config/compiler:optimize" ]
798     configs += [ "//build/config/compiler:optimize_max" ]
799   }
801   allow_circular_includes_from = public_deps
804 # This is the subset of files from base that should not be used with a dynamic
805 # library. Note that this library cannot depend on base because base depends on
806 # base_static.
807 source_set("base_static") {
808   sources = [
809     "base_switches.cc",
810     "base_switches.h",
811     "win/pe_image.cc",
812     "win/pe_image.h",
813   ]
815   if (is_android && !is_debug) {
816     configs -= [ "//build/config/compiler:optimize" ]
817     configs += [ "//build/config/compiler:optimize_max" ]
818   }
821 component("i18n") {
822   output_name = "base_i18n"
823   sources = [
824     "i18n/base_i18n_export.h",
825     "i18n/bidi_line_iterator.cc",
826     "i18n/bidi_line_iterator.h",
827     "i18n/break_iterator.cc",
828     "i18n/break_iterator.h",
829     "i18n/case_conversion.cc",
830     "i18n/case_conversion.h",
831     "i18n/char_iterator.cc",
832     "i18n/char_iterator.h",
833     "i18n/file_util_icu.cc",
834     "i18n/file_util_icu.h",
835     "i18n/i18n_constants.cc",
836     "i18n/i18n_constants.h",
837     "i18n/icu_encoding_detection.cc",
838     "i18n/icu_encoding_detection.h",
839     "i18n/icu_string_conversions.cc",
840     "i18n/icu_string_conversions.h",
841     "i18n/icu_util.cc",
842     "i18n/icu_util.h",
843     "i18n/number_formatting.cc",
844     "i18n/number_formatting.h",
845     "i18n/rtl.cc",
846     "i18n/rtl.h",
847     "i18n/streaming_utf8_validator.cc",
848     "i18n/streaming_utf8_validator.h",
849     "i18n/string_compare.cc",
850     "i18n/string_compare.h",
851     "i18n/string_search.cc",
852     "i18n/string_search.h",
853     "i18n/time_formatting.cc",
854     "i18n/time_formatting.h",
855     "i18n/timezone.cc",
856     "i18n/timezone.h",
857     "i18n/utf8_validator_tables.cc",
858     "i18n/utf8_validator_tables.h",
859   ]
860   defines = [ "BASE_I18N_IMPLEMENTATION" ]
861   configs += [ "//build/config/compiler:wexit_time_destructors" ]
862   deps = [
863     ":base",
864     "//base/third_party/dynamic_annotations",
865     "//third_party/icu",
866   ]
868   if (is_android && !is_debug) {
869     configs -= [ "//build/config/compiler:optimize" ]
870     configs += [ "//build/config/compiler:optimize_max" ]
871   }
873   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
874   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
877 if (is_linux && !is_chromeos) {
878   # TODO(GYP): Figure out which of these work and are needed on other platforms.
879   test("base_perftests") {
880     sources = [
881       "message_loop/message_pump_perftest.cc",
883       # "test/run_all_unittests.cc",
884       "threading/thread_perftest.cc",
885     ]
886     deps = [
887       ":base",
888       "//base/test:test_support",
889       "//base/test:test_support_perf",
890       "//testing/perf",
891       "//testing/gtest",
892     ]
894     if (is_android) {
895       deps += [ "//testing/android:native_test_native_code" ]
896     }
897   }
899   test("base_i18n_perftests") {
900     sources = [
901       "i18n/streaming_utf8_validator_perftest.cc",
902     ]
903     deps = [
904       ":base",
905       ":i18n",
906       "//base/test:test_support",
907       "//base/test:test_support_perf",
908       "//testing/gtest",
909     ]
910   }
912   if (!is_ios) {
913     executable("build_utf8_validator_tables") {
914       sources = [
915         "i18n/build_utf8_validator_tables.cc",
916       ]
917       deps = [
918         ":base",
919         "//third_party/icu:icuuc",
920       ]
921     }
923     executable("check_example") {
924       sources = [
925         "check_example.cc",
926       ]
927       deps = [
928         ":base",
929       ]
930     }
931   }
934 source_set("prefs") {
935   sources = [
936     "prefs/base_prefs_export.h",
937     "prefs/default_pref_store.cc",
938     "prefs/default_pref_store.h",
939     "prefs/json_pref_store.cc",
940     "prefs/json_pref_store.h",
941     "prefs/overlay_user_pref_store.cc",
942     "prefs/overlay_user_pref_store.h",
943     "prefs/persistent_pref_store.h",
944     "prefs/pref_change_registrar.cc",
945     "prefs/pref_change_registrar.h",
946     "prefs/pref_filter.h",
947     "prefs/pref_member.cc",
948     "prefs/pref_member.h",
949     "prefs/pref_notifier.h",
950     "prefs/pref_notifier_impl.cc",
951     "prefs/pref_notifier_impl.h",
952     "prefs/pref_observer.h",
953     "prefs/pref_registry.cc",
954     "prefs/pref_registry.h",
955     "prefs/pref_registry_simple.cc",
956     "prefs/pref_registry_simple.h",
957     "prefs/pref_service.cc",
958     "prefs/pref_service.h",
959     "prefs/pref_service_factory.cc",
960     "prefs/pref_service_factory.h",
961     "prefs/pref_store.cc",
962     "prefs/pref_store.h",
963     "prefs/pref_value_map.cc",
964     "prefs/pref_value_map.h",
965     "prefs/pref_value_store.cc",
966     "prefs/pref_value_store.h",
967     "prefs/scoped_user_pref_update.cc",
968     "prefs/scoped_user_pref_update.h",
969     "prefs/value_map_pref_store.cc",
970     "prefs/value_map_pref_store.h",
971     "prefs/writeable_pref_store.h",
972   ]
974   defines = [ "BASE_PREFS_IMPLEMENTATION" ]
976   deps = [
977     ":base",
978   ]
980   if (is_android && !is_debug) {
981     configs -= [ "//build/config/compiler:optimize" ]
982     configs += [ "//build/config/compiler:optimize_max" ]
983   }
986 source_set("prefs_test_support") {
987   testonly = true
988   sources = [
989     "prefs/mock_pref_change_callback.cc",
990     "prefs/mock_pref_change_callback.h",
991     "prefs/pref_store_observer_mock.cc",
992     "prefs/pref_store_observer_mock.h",
993     "prefs/testing_pref_service.cc",
994     "prefs/testing_pref_service.h",
995     "prefs/testing_pref_store.cc",
996     "prefs/testing_pref_store.h",
997   ]
999   public_deps = [
1000     ":prefs",
1001   ]
1002   deps = [
1003     ":base",
1004     "//testing/gmock",
1005     "//testing/gtest",
1006   ]
1009 source_set("message_loop_tests") {
1010   testonly = true
1011   sources = [
1012     "message_loop/message_loop_test.cc",
1013     "message_loop/message_loop_test.h",
1014   ]
1016   deps = [
1017     ":base",
1018     "//testing/gtest",
1019   ]
1022 # TODO(pasko): Remove this target when crbug.com/424562 is fixed.
1023 source_set("protect_file_posix") {
1024   sources = [
1025     "files/protect_file_posix.cc",
1026   ]
1028   deps = [
1029     "//base",
1030   ]
1033 if (is_win) {
1034   # Target to manually rebuild pe_image_test.dll which is checked into
1035   # base/test/data/pe_image.
1036   shared_library("pe_image_test") {
1037     sources = [
1038       "win/pe_image_test.cc",
1039     ]
1040     ldflags = [
1041       "/DELAYLOAD:cfgmgr32.dll",
1042       "/DELAYLOAD:shell32.dll",
1043       "/SUBSYSTEM:WINDOWS",
1044     ]
1045     libs = [
1046       "cfgmgr32.lib",
1047       "shell32.lib",
1048     ]
1049   }
1052 test("base_unittests") {
1053   sources = [
1054     "android/application_status_listener_unittest.cc",
1055     "android/content_uri_utils_unittest.cc",
1056     "android/jni_android_unittest.cc",
1057     "android/jni_array_unittest.cc",
1058     "android/jni_string_unittest.cc",
1059     "android/path_utils_unittest.cc",
1060     "android/scoped_java_ref_unittest.cc",
1061     "android/sys_utils_unittest.cc",
1062     "async_socket_io_handler_unittest.cc",
1063     "at_exit_unittest.cc",
1064     "atomicops_unittest.cc",
1065     "barrier_closure_unittest.cc",
1066     "base64_unittest.cc",
1067     "big_endian_unittest.cc",
1068     "bind_unittest.cc",
1069     "bind_unittest.nc",
1070     "bits_unittest.cc",
1071     "build_time_unittest.cc",
1072     "callback_helpers_unittest.cc",
1073     "callback_list_unittest.cc",
1074     "callback_list_unittest.nc",
1075     "callback_unittest.cc",
1076     "callback_unittest.nc",
1077     "cancelable_callback_unittest.cc",
1078     "chromeos/memory_pressure_observer_chromeos_unittest.cc",
1079     "command_line_unittest.cc",
1080     "containers/adapters_unittest.cc",
1081     "containers/hash_tables_unittest.cc",
1082     "containers/linked_list_unittest.cc",
1083     "containers/mru_cache_unittest.cc",
1084     "containers/small_map_unittest.cc",
1085     "containers/stack_container_unittest.cc",
1086     "cpu_unittest.cc",
1087     "debug/crash_logging_unittest.cc",
1088     "debug/debugger_unittest.cc",
1089     "debug/leak_tracker_unittest.cc",
1090     "debug/proc_maps_linux_unittest.cc",
1091     "debug/stack_trace_unittest.cc",
1092     "debug/task_annotator_unittest.cc",
1093     "deferred_sequenced_task_runner_unittest.cc",
1094     "environment_unittest.cc",
1095     "file_version_info_unittest.cc",
1096     "files/dir_reader_posix_unittest.cc",
1097     "files/file_path_unittest.cc",
1098     "files/file_proxy_unittest.cc",
1099     "files/file_unittest.cc",
1100     "files/file_util_proxy_unittest.cc",
1101     "files/file_util_unittest.cc",
1102     "files/important_file_writer_unittest.cc",
1103     "files/scoped_temp_dir_unittest.cc",
1104     "gmock_unittest.cc",
1105     "guid_unittest.cc",
1106     "hash_unittest.cc",
1107     "i18n/break_iterator_unittest.cc",
1108     "i18n/case_conversion_unittest.cc",
1109     "i18n/char_iterator_unittest.cc",
1110     "i18n/file_util_icu_unittest.cc",
1111     "i18n/icu_string_conversions_unittest.cc",
1112     "i18n/number_formatting_unittest.cc",
1113     "i18n/rtl_unittest.cc",
1114     "i18n/streaming_utf8_validator_unittest.cc",
1115     "i18n/string_search_unittest.cc",
1116     "i18n/time_formatting_unittest.cc",
1117     "i18n/timezone_unittest.cc",
1118     "id_map_unittest.cc",
1119     "ios/device_util_unittest.mm",
1120     "ios/weak_nsobject_unittest.mm",
1121     "json/json_parser_unittest.cc",
1122     "json/json_reader_unittest.cc",
1123     "json/json_value_converter_unittest.cc",
1124     "json/json_value_serializer_unittest.cc",
1125     "json/json_writer_unittest.cc",
1126     "json/string_escape_unittest.cc",
1127     "lazy_instance_unittest.cc",
1128     "logging_unittest.cc",
1129     "mac/bind_objc_block_unittest.mm",
1130     "mac/foundation_util_unittest.mm",
1131     "mac/libdispatch_task_runner_unittest.cc",
1132     "mac/mac_util_unittest.mm",
1133     "mac/objc_property_releaser_unittest.mm",
1134     "mac/scoped_nsobject_unittest.mm",
1135     "mac/scoped_objc_class_swizzler_unittest.mm",
1136     "mac/scoped_sending_event_unittest.mm",
1137     "md5_unittest.cc",
1138     "memory/aligned_memory_unittest.cc",
1139     "memory/discardable_shared_memory_unittest.cc",
1140     "memory/linked_ptr_unittest.cc",
1141     "memory/ref_counted_memory_unittest.cc",
1142     "memory/ref_counted_unittest.cc",
1143     "memory/scoped_ptr_unittest.cc",
1144     "memory/scoped_ptr_unittest.nc",
1145     "memory/scoped_vector_unittest.cc",
1146     "memory/shared_memory_unittest.cc",
1147     "memory/singleton_unittest.cc",
1148     "memory/weak_ptr_unittest.cc",
1149     "memory/weak_ptr_unittest.nc",
1150     "message_loop/message_loop_proxy_impl_unittest.cc",
1151     "message_loop/message_loop_proxy_unittest.cc",
1152     "message_loop/message_loop_unittest.cc",
1153     "message_loop/message_pump_glib_unittest.cc",
1154     "message_loop/message_pump_io_ios_unittest.cc",
1155     "metrics/bucket_ranges_unittest.cc",
1156     "metrics/field_trial_unittest.cc",
1157     "metrics/histogram_base_unittest.cc",
1158     "metrics/histogram_delta_serialization_unittest.cc",
1159     "metrics/histogram_snapshot_manager_unittest.cc",
1160     "metrics/histogram_unittest.cc",
1161     "metrics/sample_map_unittest.cc",
1162     "metrics/sample_vector_unittest.cc",
1163     "metrics/sparse_histogram_unittest.cc",
1164     "metrics/statistics_recorder_unittest.cc",
1165     "numerics/safe_numerics_unittest.cc",
1166     "observer_list_unittest.cc",
1167     "os_compat_android_unittest.cc",
1168     "path_service_unittest.cc",
1169     "pickle_unittest.cc",
1170     "posix/file_descriptor_shuffle_unittest.cc",
1171     "posix/unix_domain_socket_linux_unittest.cc",
1172     "power_monitor/power_monitor_unittest.cc",
1173     "prefs/default_pref_store_unittest.cc",
1174     "prefs/json_pref_store_unittest.cc",
1175     "prefs/overlay_user_pref_store_unittest.cc",
1176     "prefs/pref_change_registrar_unittest.cc",
1177     "prefs/pref_member_unittest.cc",
1178     "prefs/pref_notifier_impl_unittest.cc",
1179     "prefs/pref_service_unittest.cc",
1180     "prefs/pref_value_map_unittest.cc",
1181     "prefs/pref_value_store_unittest.cc",
1182     "prefs/scoped_user_pref_update_unittest.cc",
1183     "process/memory_unittest.cc",
1184     "process/memory_unittest_mac.h",
1185     "process/memory_unittest_mac.mm",
1186     "process/process_metrics_unittest.cc",
1187     "process/process_metrics_unittest_ios.cc",
1188     "process/process_unittest.cc",
1189     "process/process_util_unittest.cc",
1190     "process/process_util_unittest_ios.cc",
1191     "profiler/tracked_time_unittest.cc",
1192     "rand_util_unittest.cc",
1193     "scoped_clear_errno_unittest.cc",
1194     "scoped_generic_unittest.cc",
1195     "scoped_native_library_unittest.cc",
1196     "security_unittest.cc",
1197     "sequence_checker_unittest.cc",
1198     "sha1_unittest.cc",
1199     "stl_util_unittest.cc",
1200     "strings/nullable_string16_unittest.cc",
1201     "strings/safe_sprintf_unittest.cc",
1202     "strings/string16_unittest.cc",
1203     "strings/string_number_conversions_unittest.cc",
1204     "strings/string_piece_unittest.cc",
1205     "strings/string_split_unittest.cc",
1206     "strings/string_tokenizer_unittest.cc",
1207     "strings/string_util_unittest.cc",
1208     "strings/stringize_macros_unittest.cc",
1209     "strings/stringprintf_unittest.cc",
1210     "strings/sys_string_conversions_mac_unittest.mm",
1211     "strings/sys_string_conversions_unittest.cc",
1212     "strings/utf_offset_string_conversions_unittest.cc",
1213     "strings/utf_string_conversions_unittest.cc",
1214     "supports_user_data_unittest.cc",
1215     "sync_socket_unittest.cc",
1216     "synchronization/cancellation_flag_unittest.cc",
1217     "synchronization/condition_variable_unittest.cc",
1218     "synchronization/lock_unittest.cc",
1219     "synchronization/waitable_event_unittest.cc",
1220     "synchronization/waitable_event_watcher_unittest.cc",
1221     "sys_info_unittest.cc",
1222     "system_monitor/system_monitor_unittest.cc",
1223     "task/cancelable_task_tracker_unittest.cc",
1224     "task_runner_util_unittest.cc",
1225     "template_util_unittest.cc",
1226     "test/expectations/expectation_unittest.cc",
1227     "test/expectations/parser_unittest.cc",
1228     "test/histogram_tester_unittest.cc",
1229     "test/test_reg_util_win_unittest.cc",
1230     "test/trace_event_analyzer_unittest.cc",
1231     "threading/non_thread_safe_unittest.cc",
1232     "threading/platform_thread_unittest.cc",
1233     "threading/sequenced_worker_pool_unittest.cc",
1234     "threading/simple_thread_unittest.cc",
1235     "threading/thread_checker_unittest.cc",
1236     "threading/thread_collision_warner_unittest.cc",
1237     "threading/thread_id_name_manager_unittest.cc",
1238     "threading/thread_local_storage_unittest.cc",
1239     "threading/thread_local_unittest.cc",
1240     "threading/thread_unittest.cc",
1241     "threading/watchdog_unittest.cc",
1242     "threading/worker_pool_posix_unittest.cc",
1243     "threading/worker_pool_unittest.cc",
1244     "time/pr_time_unittest.cc",
1245     "time/time_unittest.cc",
1246     "time/time_win_unittest.cc",
1247     "timer/hi_res_timer_manager_unittest.cc",
1248     "timer/mock_timer_unittest.cc",
1249     "timer/timer_unittest.cc",
1250     "tools_sanity_unittest.cc",
1251     "trace_event/memory_dump_manager_unittest.cc",
1252     "trace_event/process_memory_maps_dump_provider_unittest.cc",
1253     "trace_event/process_memory_totals_dump_provider_unittest.cc",
1254     "trace_event/trace_event_argument_unittest.cc",
1255     "trace_event/trace_event_memory_unittest.cc",
1256     "trace_event/trace_event_synthetic_delay_unittest.cc",
1257     "trace_event/trace_event_system_stats_monitor_unittest.cc",
1258     "trace_event/trace_event_unittest.cc",
1259     "trace_event/trace_event_win_unittest.cc",
1260     "tracked_objects_unittest.cc",
1261     "tuple_unittest.cc",
1262     "values_unittest.cc",
1263     "version_unittest.cc",
1264     "vlog_unittest.cc",
1265     "win/dllmain.cc",
1266     "win/enum_variant_unittest.cc",
1267     "win/event_trace_consumer_unittest.cc",
1268     "win/event_trace_controller_unittest.cc",
1269     "win/event_trace_provider_unittest.cc",
1270     "win/i18n_unittest.cc",
1271     "win/iunknown_impl_unittest.cc",
1272     "win/message_window_unittest.cc",
1273     "win/object_watcher_unittest.cc",
1274     "win/pe_image_unittest.cc",
1275     "win/registry_unittest.cc",
1276     "win/scoped_bstr_unittest.cc",
1277     "win/scoped_comptr_unittest.cc",
1278     "win/scoped_process_information_unittest.cc",
1279     "win/scoped_variant_unittest.cc",
1280     "win/shortcut_unittest.cc",
1281     "win/startup_information_unittest.cc",
1282     "win/win_util_unittest.cc",
1283     "win/wrapped_window_proc_unittest.cc",
1284   ]
1286   deps = [
1287     ":base",
1288     ":i18n",
1289     ":message_loop_tests",
1290     ":prefs",
1291     ":prefs_test_support",
1292     "//base/allocator",
1293     "//base/test:run_all_unittests",
1294     "//base/test:test_support",
1295     "//base/third_party/dynamic_annotations",
1296     "//base/third_party/nspr",
1297     "//testing/gmock",
1298     "//testing/gtest",
1299     "//third_party/icu",
1300   ]
1302   # Allow more direct string conversions on platforms with native utf8
1303   # strings
1304   if (is_mac || is_ios || is_chromeos) {
1305     defines = [ "SYSTEM_NATIVE_UTF8" ]
1306   }
1308   if (is_android) {
1309     apk_deps = [
1310       ":base_java",
1311       ":base_java_unittest_support",
1312     ]
1313   }
1315   if (is_ios) {
1316     sources -= [
1317       "process/memory_unittest.cc",
1318       "process/memory_unittest_mac.h",
1319       "process/memory_unittest_mac.mm",
1320       "process/process_unittest.cc",
1321       "process/process_util_unittest.cc",
1322     ]
1324     # Pull in specific Mac files for iOS (which have been filtered out by file
1325     # name rules).
1326     set_sources_assignment_filter([])
1327     sources += [
1328       "mac/bind_objc_block_unittest.mm",
1329       "mac/foundation_util_unittest.mm",
1330       "mac/objc_property_releaser_unittest.mm",
1331       "mac/scoped_nsobject_unittest.mm",
1332       "sys_string_conversions_mac_unittest.mm",
1333     ]
1334     set_sources_assignment_filter(sources_assignment_filter)
1336     # TODO(GYP): dep on copy_test_data_ios action.
1337   }
1339   if (is_linux) {
1340     sources -= [ "file_version_info_unittest.cc" ]
1341     sources += [ "nix/xdg_util_unittest.cc" ]
1342     if (use_glib) {
1343       configs += [ "//build/config/linux:glib" ]
1344     }
1345   }
1347   if (!is_linux || use_ozone) {
1348     sources -= [ "message_loop/message_pump_glib_unittest.cc" ]
1349   }
1351   if (is_posix || is_ios) {
1352     sources += [ "message_loop/message_pump_libevent_unittest.cc" ]
1353     deps += [ "//third_party/libevent" ]
1354   }
1356   if (is_android) {
1357     deps += [ "//testing/android:native_test_native_code" ]
1358     set_sources_assignment_filter([])
1359     sources += [ "debug/proc_maps_linux_unittest.cc" ]
1360     set_sources_assignment_filter(sources_assignment_filter)
1361   }
1363   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1364   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1367 if (is_android) {
1368   # GYP: //base.gyp:base_jni_headers
1369   generate_jni("base_jni_headers") {
1370     sources = [
1371       "android/java/src/org/chromium/base/AnimationFrameTimeHistogram.java",
1372       "android/java/src/org/chromium/base/ApplicationStatus.java",
1373       "android/java/src/org/chromium/base/BuildInfo.java",
1374       "android/java/src/org/chromium/base/CommandLine.java",
1375       "android/java/src/org/chromium/base/ContentUriUtils.java",
1376       "android/java/src/org/chromium/base/CpuFeatures.java",
1377       "android/java/src/org/chromium/base/EventLog.java",
1378       "android/java/src/org/chromium/base/FieldTrialList.java",
1379       "android/java/src/org/chromium/base/ImportantFileWriterAndroid.java",
1380       "android/java/src/org/chromium/base/JNIUtils.java",
1381       "android/java/src/org/chromium/base/JavaHandlerThread.java",
1382       "android/java/src/org/chromium/base/LocaleUtils.java",
1383       "android/java/src/org/chromium/base/MemoryPressureListener.java",
1384       "android/java/src/org/chromium/base/PathService.java",
1385       "android/java/src/org/chromium/base/PathUtils.java",
1386       "android/java/src/org/chromium/base/PowerMonitor.java",
1387       "android/java/src/org/chromium/base/SysUtils.java",
1388       "android/java/src/org/chromium/base/SystemMessageHandler.java",
1389       "android/java/src/org/chromium/base/ThreadUtils.java",
1390       "android/java/src/org/chromium/base/TraceEvent.java",
1391       "android/java/src/org/chromium/base/library_loader/LibraryLoader.java",
1392       "android/java/src/org/chromium/base/metrics/RecordHistogram.java",
1393     ]
1394     jni_package = "base"
1395   }
1397   # GYP: //base.gyp:base_java
1398   android_library("base_java") {
1399     srcjar_deps = [
1400       ":base_android_java_enums_srcjar",
1401       ":base_native_libraries_gen",
1402     ]
1404     deps = [
1405       "//third_party/jsr-305:jsr_305_javalib",
1406     ]
1408     DEPRECATED_java_in_dir = "android/java/src"
1410     # A new version of NativeLibraries.java (with the actual correct values)
1411     # will be created when creating an apk.
1412     jar_excluded_patterns = [
1413       "*/NativeLibraries.class",
1414       "*/NativeLibraries##*.class",
1415     ]
1416   }
1418   # GYP: //base.gyp:base_javatests
1419   android_library("base_javatests") {
1420     deps = [
1421       ":base_java",
1422       ":base_java_test_support",
1423     ]
1424     DEPRECATED_java_in_dir = "android/javatests/src"
1425   }
1427   # GYP: //base.gyp:base_java_test_support
1428   android_library("base_java_test_support") {
1429     deps = [
1430       ":base_java",
1431     ]
1432     DEPRECATED_java_in_dir = "test/android/javatests/src"
1433   }
1435   # GYP: //base.gyp:base_java_application_state
1436   # GYP: //base.gyp:base_java_library_load_from_apk_status_codes
1437   # GYP: //base.gyp:base_java_library_process_type
1438   # GYP: //base.gyp:base_java_memory_pressure_level
1439   java_cpp_enum("base_android_java_enums_srcjar") {
1440     sources = [
1441       "android/application_status_listener.h",
1442       "android/library_loader/library_load_from_apk_status_codes.h",
1443       "android/library_loader/library_loader_hooks.h",
1444       "memory/memory_pressure_listener.h",
1445     ]
1446     outputs = [
1447       "org/chromium/base/ApplicationState.java",
1448       "org/chromium/base/library_loader/LibraryLoadFromApkStatusCodes.java",
1449       "org/chromium/base/library_loader/LibraryProcessType.java",
1450       "org/chromium/base/MemoryPressureLevel.java",
1451     ]
1452   }
1454   # GYP: //base/base.gyp:base_native_libraries_gen
1455   java_cpp_template("base_native_libraries_gen") {
1456     sources = [
1457       "android/java/templates/NativeLibraries.template",
1458     ]
1459     package_name = "org/chromium/base/library_loader"
1460   }
1462   # GYP: //base.gyp:base_java_unittest_support
1463   android_library("base_java_unittest_support") {
1464     deps = [
1465       ":base_java",
1466     ]
1467     java_files =
1468         [ "test/android/java/src/org/chromium/base/ContentUriTestUtils.java" ]
1469   }