• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2015 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Common defaults
16// ========================================================
17
18// Using Chrome header files directly could cause -Wunused-parameter errors,
19// and this is workaround. Please find the document in include_generator.py
20// for details.
21// Note: gensrcs does not support exclude_srcs, so filegroup rule is
22// introduced.
23filegroup {
24    name: "libchrome-include-sources",
25    srcs: [
26        "base/**/*.h",
27        "build/**/*.h",
28        "components/**/*.h",
29        "device/**/*.h",
30        "testing/**/*.h",
31        "third_party/**/*.h",
32        "ui/**/*.h",
33    ],
34    exclude_srcs: [
35        "base/android/**/*",
36    ],
37}
38
39gensrcs {
40    name: "libchrome-include",
41    cmd: "$(location libchrome_tools/include_generator.py) $(in) $(out)",
42    tool_files: ["libchrome_tools/include_generator.py"],
43    export_include_dirs: ["."],
44    srcs: [":libchrome-include-sources"],
45    output_extension: "h",
46}
47
48cc_defaults {
49    name: "libchrome-defaults",
50    // Set clang to "true" to force clang or "false" to force gcc.
51    // clang: true,
52
53    cflags: [
54        "-Wall",
55        "-Werror",
56        "-Wno-deprecated-declarations",
57        "-Wno-implicit-fallthrough",
58        // memory_mapped_file.cc:80, json_parser.cc:264,
59        // sys_string_conversions_posix.cc:122, and
60        // icu_utf.cc:161,165 have -Wno-implicit-fallthrough.
61        "-Wno-missing-field-initializers",
62        "-Wno-unused-parameter",
63    ],
64
65    // Note: Although the generated header files are exported here, in building
66    // libchrome, "." has priority (unlike building projects using libchrome),
67    // so the raw header files are used for them.
68    generated_headers: ["libchrome-include"],
69    export_generated_headers: ["libchrome-include"],
70    target: {
71        host: {
72            cflags: [
73                "-D__ANDROID_HOST__",
74                "-DDONT_EMBED_BUILD_METADATA",
75            ],
76        },
77        darwin: {
78            enabled: false,
79        },
80    },
81}
82
83cc_defaults {
84    name: "libchrome-test-defaults",
85    defaults: ["libchrome-defaults"],
86    cflags: [
87        "-Wno-unused-function",
88        "-Wno-unused-variable",
89    ],
90}
91
92libchromeCommonSrc = [
93    "base/at_exit.cc",
94    "base/barrier_closure.cc",
95    "base/base64.cc",
96    "base/base64url.cc",
97    "base/base_paths.cc",
98    "base/base_paths_posix.cc",
99    "base/base_switches.cc",
100    "base/big_endian.cc",
101    "base/build_time.cc",
102    "base/callback_helpers.cc",
103    "base/callback_internal.cc",
104    "base/command_line.cc",
105    "base/cpu.cc",
106    "base/debug/activity_tracker.cc",
107    "base/debug/alias.cc",
108    "base/debug/crash_logging.cc",
109    "base/debug/debugger.cc",
110    "base/debug/debugger_posix.cc",
111    "base/debug/dump_without_crashing.cc",
112    "base/debug/proc_maps_linux.cc",
113    "base/debug/profiler.cc",
114    "base/debug/stack_trace.cc",
115    "base/debug/task_annotator.cc",
116    "base/environment.cc",
117    "base/feature_list.cc",
118    "base/files/file.cc",
119    "base/files/file_descriptor_watcher_posix.cc",
120    "base/files/file_enumerator.cc",
121    "base/files/file_enumerator_posix.cc",
122    "base/files/file_path.cc",
123    "base/files/file_path_constants.cc",
124    "base/files/file_path_watcher.cc",
125    "base/files/file_posix.cc",
126    "base/files/file_tracing.cc",
127    "base/files/file_util.cc",
128    "base/files/file_util_posix.cc",
129    "base/files/important_file_writer.cc",
130    "base/files/memory_mapped_file.cc",
131    "base/files/memory_mapped_file_posix.cc",
132    "base/files/scoped_file.cc",
133    "base/files/scoped_temp_dir.cc",
134    "base/guid.cc",
135    "base/hash.cc",
136    "base/json/json_file_value_serializer.cc",
137    "base/json/json_parser.cc",
138    "base/json/json_reader.cc",
139    "base/json/json_string_value_serializer.cc",
140    "base/json/json_value_converter.cc",
141    "base/json/json_writer.cc",
142    "base/json/string_escape.cc",
143    "base/lazy_instance_helpers.cc",
144    "base/location.cc",
145    "base/logging.cc",
146    "base/md5.cc",
147    "base/memory/aligned_memory.cc",
148    "base/memory/platform_shared_memory_region.cc",
149    "base/memory/platform_shared_memory_region_posix.cc",
150    "base/memory/read_only_shared_memory_region.cc",
151    "base/memory/ref_counted.cc",
152    "base/memory/ref_counted_memory.cc",
153    "base/memory/shared_memory_handle.cc",
154    "base/memory/shared_memory_handle_posix.cc",
155    "base/memory/shared_memory_helper.cc",
156    "base/memory/shared_memory_mapping.cc",
157    "base/memory/unsafe_shared_memory_region.cc",
158    "base/memory/weak_ptr.cc",
159    "base/memory/writable_shared_memory_region.cc",
160    "base/message_loop/incoming_task_queue.cc",
161    "base/message_loop/message_loop.cc",
162    "base/message_loop/message_loop_current.cc",
163    "base/message_loop/message_loop_task_runner.cc",
164    "base/message_loop/message_pump.cc",
165    "base/message_loop/message_pump_default.cc",
166    "base/message_loop/message_pump_libevent.cc",
167    "base/message_loop/watchable_io_message_pump_posix.cc",
168    "base/metrics/bucket_ranges.cc",
169    "base/metrics/dummy_histogram.cc",
170    "base/metrics/field_trial.cc",
171    "base/metrics/field_trial_param_associator.cc",
172    "base/metrics/histogram.cc",
173    "base/metrics/histogram_base.cc",
174    "base/metrics/histogram_functions.cc",
175    "base/metrics/histogram_samples.cc",
176    "base/metrics/histogram_snapshot_manager.cc",
177    "base/metrics/metrics_hashes.cc",
178    "base/metrics/persistent_histogram_allocator.cc",
179    "base/metrics/persistent_memory_allocator.cc",
180    "base/metrics/persistent_sample_map.cc",
181    "base/metrics/sample_map.cc",
182    "base/metrics/sample_vector.cc",
183    "base/metrics/sparse_histogram.cc",
184    "base/metrics/statistics_recorder.cc",
185    "base/native_library.cc",
186    "base/native_library_posix.cc",
187    "base/observer_list_threadsafe.cc",
188    "base/path_service.cc",
189    "base/pending_task.cc",
190    "base/pickle.cc",
191    "base/posix/file_descriptor_shuffle.cc",
192    "base/posix/global_descriptors.cc",
193    "base/posix/safe_strerror.cc",
194    "base/process/kill.cc",
195    "base/process/kill_posix.cc",
196    "base/process/launch.cc",
197    "base/process/launch_posix.cc",
198    "base/process/memory.cc",
199    "base/process/process_handle.cc",
200    "base/process/process_handle_posix.cc",
201    "base/process/process_iterator.cc",
202    "base/process/process_metrics.cc",
203    "base/process/process_metrics_posix.cc",
204    "base/process/process_posix.cc",
205    "base/rand_util.cc",
206    "base/rand_util_posix.cc",
207    "base/run_loop.cc",
208    "base/scoped_native_library.cc",
209    "base/sequence_checker_impl.cc",
210    "base/sequence_token.cc",
211    "base/sequenced_task_runner.cc",
212    "base/sha1.cc",
213    "base/strings/nullable_string16.cc",
214    "base/strings/pattern.cc",
215    "base/strings/safe_sprintf.cc",
216    "base/strings/string16.cc",
217    "base/strings/string_number_conversions.cc",
218    "base/strings/string_piece.cc",
219    "base/strings/string_split.cc",
220    "base/strings/string_util.cc",
221    "base/strings/string_util_constants.cc",
222    "base/strings/stringprintf.cc",
223    "base/strings/utf_string_conversion_utils.cc",
224    "base/strings/utf_string_conversions.cc",
225    "base/sync_socket_posix.cc",
226    "base/synchronization/atomic_flag.cc",
227    "base/synchronization/condition_variable_posix.cc",
228    "base/synchronization/lock.cc",
229    "base/synchronization/lock_impl_posix.cc",
230    "base/synchronization/waitable_event_posix.cc",
231    "base/sys_info.cc",
232    "base/sys_info_posix.cc",
233    "base/task/cancelable_task_tracker.cc",
234    "base/task_runner.cc",
235    "base/task_scheduler/scheduler_lock_impl.cc",
236    "base/task_scheduler/scoped_set_task_priority_for_current_thread.cc",
237    "base/task_scheduler/sequence.cc",
238    "base/task_scheduler/sequence_sort_key.cc",
239    "base/task_scheduler/task.cc",
240    "base/task_scheduler/task_traits.cc",
241    "base/third_party/dynamic_annotations/dynamic_annotations.c",
242    "base/third_party/icu/icu_utf.cc",
243    "base/third_party/nspr/prtime.cc",
244    "base/threading/platform_thread_posix.cc",
245    "base/threading/post_task_and_reply_impl.cc",
246    "base/threading/scoped_blocking_call.cc",
247    "base/threading/sequence_local_storage_map.cc",
248    "base/threading/sequence_local_storage_slot.cc",
249    "base/threading/sequenced_task_runner_handle.cc",
250    "base/threading/simple_thread.cc",
251    "base/threading/thread.cc",
252    "base/threading/thread_checker_impl.cc",
253    "base/threading/thread_collision_warner.cc",
254    "base/threading/thread_id_name_manager.cc",
255    "base/threading/thread_local_storage.cc",
256    "base/threading/thread_local_storage_posix.cc",
257    "base/threading/thread_restrictions.cc",
258    "base/threading/thread_task_runner_handle.cc",
259    "base/time/clock.cc",
260    "base/time/default_clock.cc",
261    "base/time/default_tick_clock.cc",
262    "base/time/tick_clock.cc",
263    "base/time/time.cc",
264    "base/time/time_conversion_posix.cc",
265    "base/time/time_exploded_posix.cc",
266    "base/time/time_now_posix.cc",
267    "base/time/time_override.cc",
268    "base/timer/elapsed_timer.cc",
269    "base/timer/timer.cc",
270    "base/unguessable_token.cc",
271    "base/value_iterators.cc",
272    "base/values.cc",
273    "base/version.cc",
274    "base/vlog.cc",
275    "device/bluetooth/bluetooth_advertisement.cc",
276    "device/bluetooth/bluetooth_uuid.cc",
277    "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc",
278    "ui/gfx/geometry/insets.cc",
279    "ui/gfx/geometry/insets_f.cc",
280    "ui/gfx/geometry/point.cc",
281    "ui/gfx/geometry/point_conversions.cc",
282    "ui/gfx/geometry/point_f.cc",
283    "ui/gfx/geometry/rect.cc",
284    "ui/gfx/geometry/rect_f.cc",
285    "ui/gfx/geometry/size.cc",
286    "ui/gfx/geometry/size_conversions.cc",
287    "ui/gfx/geometry/size_f.cc",
288    "ui/gfx/geometry/vector2d.cc",
289    "ui/gfx/geometry/vector2d_f.cc",
290    "ui/gfx/range/range.cc",
291    "ui/gfx/range/range_f.cc",
292]
293
294libchromeLinuxSrc = [
295    "base/files/file_path_watcher_linux.cc",
296    "base/files/file_util_linux.cc",
297    "base/memory/shared_memory_posix.cc",
298    "base/posix/unix_domain_socket.cc",
299    "base/process/internal_linux.cc",
300    "base/process/memory_linux.cc",
301    "base/process/process_handle_linux.cc",
302    "base/process/process_info_linux.cc",
303    "base/process/process_iterator_linux.cc",
304    "base/process/process_metrics_linux.cc",
305    "base/strings/sys_string_conversions_posix.cc",
306    "base/sys_info_linux.cc",
307    "base/threading/platform_thread_internal_posix.cc",
308    "base/threading/platform_thread_linux.cc",
309    "components/timers/alarm_timer_chromeos.cc",
310]
311
312libchromeLinuxGlibcSrc = [
313    "base/allocator/allocator_shim.cc",
314    "base/allocator/allocator_shim_default_dispatch_to_glibc.cc",
315    "base/debug/stack_trace_posix.cc",
316]
317
318libchromeAndroidSrc = [
319    "base/debug/stack_trace_android.cc",
320    "base/memory/shared_memory_android.cc",
321    "base/sys_info_chromeos.cc",
322]
323
324// libchrome static+shared for host and device
325// ========================================================
326cc_library {
327    name: "libchrome",
328    host_supported: true,
329    recovery_available: true,
330    vendor_available: true,
331    defaults: ["libchrome-defaults"],
332    srcs: libchromeCommonSrc,
333
334    export_shared_lib_headers: ["libbase"],
335    export_static_lib_headers: ["libgtest_prod"],
336    shared_libs: [
337        "libbase",
338        "libevent",
339    ],
340    static_libs: [
341        "libgtest_prod",
342        "libmodpb64",
343    ],
344    target: {
345        linux: {
346            srcs: libchromeLinuxSrc,
347        },
348        linux_glibc: {
349            srcs: libchromeLinuxGlibcSrc,
350        },
351        android: {
352            srcs: libchromeAndroidSrc,
353            shared_libs: [
354                "libcutils",
355                "liblog",
356            ],
357        },
358    },
359}
360
361// libchrome-crypto shared library for device
362// ========================================================
363
364// Similar to libchrome, generate wrapped header files. See comments for
365// libchrome-include for the details.
366gensrcs {
367    name: "libchrome-crypto-include",
368    cmd: "$(location libchrome_tools/include_generator.py) $(in) $(out)",
369    tool_files: ["libchrome_tools/include_generator.py"],
370    export_include_dirs: ["."],
371    srcs: ["crypto/**/*.h"],
372    output_extension: "h",
373}
374
375cc_library_shared {
376    name: "libchrome-crypto",
377    vendor_available: true,
378    defaults: ["libchrome-defaults"],
379    srcs: [
380        "crypto/openssl_util.cc",
381        "crypto/random.cc",
382        "crypto/secure_hash.cc",
383        "crypto/secure_util.cc",
384        "crypto/sha2.cc",
385    ],
386
387    generated_headers: ["libchrome-crypto-include"],
388    export_generated_headers: ["libchrome-crypto-include"],
389
390    shared_libs: [
391        "libchrome",
392        "libcrypto",
393        "libssl",
394    ],
395}
396
397// Helpers needed for unit tests.
398// ========================================================
399cc_library_static {
400    name: "libchrome_test_helpers",
401    defaults: ["libchrome-test-defaults"],
402    shared_libs: ["libchrome"],
403    host_supported: true,
404
405    srcs: [
406        "base/test/gtest_util.cc",
407        "base/test/simple_test_clock.cc",
408        "base/test/simple_test_tick_clock.cc",
409        "base/test/test_file_util.cc",
410        "base/test/test_file_util_linux.cc",
411        "base/test/test_switches.cc",
412        "base/test/test_timeouts.cc",
413    ],
414}
415
416// Helpers needed for unit tests (for host).
417// ========================================================
418cc_library_host_static {
419    name: "libchrome_test_helpers-host",
420    defaults: ["libchrome-test-defaults"],
421    shared_libs: ["libchrome"],
422
423    srcs: ["base/test/simple_test_clock.cc"],
424}
425
426// Host and target unit tests. Run (from repo root) with:
427// ./out/host/<arch>/nativetest/libchrome_test/libchrome_test
428// or
429// adb shell /data/nativetest/libchrome_test/libchrome_test
430// ========================================================
431cc_test {
432    name: "libchrome_test",
433    host_supported: true,
434    defaults: ["libchrome-test-defaults"],
435    srcs: [
436        "base/at_exit_unittest.cc",
437        "base/atomicops_unittest.cc",
438        "base/base64_unittest.cc",
439        "base/base64url_unittest.cc",
440        "base/big_endian_unittest.cc",
441        "base/bind_unittest.cc",
442        "base/bits_unittest.cc",
443        "base/build_time_unittest.cc",
444        "base/callback_helpers_unittest.cc",
445        "base/callback_list_unittest.cc",
446        "base/callback_unittest.cc",
447        "base/cancelable_callback_unittest.cc",
448        "base/command_line_unittest.cc",
449        "base/cpu_unittest.cc",
450        "base/debug/activity_tracker_unittest.cc",
451        "base/debug/debugger_unittest.cc",
452        "base/debug/leak_tracker_unittest.cc",
453        "base/environment_unittest.cc",
454        "base/files/dir_reader_posix_unittest.cc",
455        "base/files/file_descriptor_watcher_posix_unittest.cc",
456        "base/files/file_enumerator_unittest.cc",
457        "base/files/file_path_unittest.cc",
458        "base/files/file_path_watcher_unittest.cc",
459        "base/files/file_unittest.cc",
460        "base/files/important_file_writer_unittest.cc",
461        "base/files/scoped_temp_dir_unittest.cc",
462        "base/gmock_unittest.cc",
463        "base/guid_unittest.cc",
464        "base/json/json_parser_unittest.cc",
465        "base/json/json_reader_unittest.cc",
466        "base/json/json_value_converter_unittest.cc",
467        "base/json/json_value_serializer_unittest.cc",
468        "base/json/json_writer_unittest.cc",
469        "base/json/string_escape_unittest.cc",
470        "base/lazy_instance_unittest.cc",
471        "base/logging_unittest.cc",
472        "base/md5_unittest.cc",
473        "base/memory/aligned_memory_unittest.cc",
474        "base/memory/linked_ptr_unittest.cc",
475        "base/memory/ref_counted_memory_unittest.cc",
476        "base/memory/ref_counted_unittest.cc",
477        "base/memory/singleton_unittest.cc",
478        "base/memory/weak_ptr_unittest.cc",
479        "base/message_loop/message_loop_task_runner_unittest.cc",
480        "base/message_loop/message_loop_unittest.cc",
481        "base/metrics/bucket_ranges_unittest.cc",
482        "base/metrics/field_trial_unittest.cc",
483        "base/metrics/histogram_base_unittest.cc",
484        "base/metrics/histogram_macros_unittest.cc",
485        "base/metrics/histogram_snapshot_manager_unittest.cc",
486        "base/metrics/histogram_unittest.cc",
487        "base/metrics/metrics_hashes_unittest.cc",
488        "base/metrics/persistent_histogram_allocator_unittest.cc",
489        "base/metrics/persistent_memory_allocator_unittest.cc",
490        "base/metrics/persistent_sample_map_unittest.cc",
491        "base/metrics/sample_map_unittest.cc",
492        "base/metrics/sample_vector_unittest.cc",
493        "base/metrics/sparse_histogram_unittest.cc",
494        "base/metrics/statistics_recorder_unittest.cc",
495        "base/observer_list_unittest.cc",
496        "base/optional_unittest.cc",
497        "base/pickle_unittest.cc",
498        "base/posix/file_descriptor_shuffle_unittest.cc",
499        "base/posix/unix_domain_socket_unittest.cc",
500        "base/process/process_info_unittest.cc",
501        "base/process/process_metrics_unittest.cc",
502        "base/rand_util_unittest.cc",
503        "base/scoped_clear_errno_unittest.cc",
504        "base/scoped_generic_unittest.cc",
505        "base/security_unittest.cc",
506        "base/sequence_checker_unittest.cc",
507        "base/sequence_token_unittest.cc",
508        "base/sha1_unittest.cc",
509        "base/stl_util_unittest.cc",
510        "base/strings/pattern_unittest.cc",
511        "base/strings/string16_unittest.cc",
512        "base/strings/string_number_conversions_unittest.cc",
513        "base/strings/string_piece_unittest.cc",
514        "base/strings/string_split_unittest.cc",
515        "base/strings/string_util_unittest.cc",
516        "base/strings/stringprintf_unittest.cc",
517        "base/strings/sys_string_conversions_unittest.cc",
518        "base/strings/utf_string_conversions_unittest.cc",
519        "base/sync_socket_unittest.cc",
520        "base/synchronization/atomic_flag_unittest.cc",
521        "base/synchronization/condition_variable_unittest.cc",
522        "base/synchronization/lock_unittest.cc",
523        "base/synchronization/waitable_event_unittest.cc",
524        "base/sys_info_unittest.cc",
525        "base/task/cancelable_task_tracker_unittest.cc",
526        "base/task_runner_util_unittest.cc",
527        "base/task_scheduler/scheduler_lock_unittest.cc",
528        "base/task_scheduler/scoped_set_task_priority_for_current_thread_unittest.cc",
529        "base/task_scheduler/sequence_sort_key_unittest.cc",
530        "base/task_scheduler/sequence_unittest.cc",
531        "base/task_scheduler/task_traits.cc",
532        "base/template_util_unittest.cc",
533        "base/test/metrics/histogram_tester.cc",
534        "base/test/mock_entropy_provider.cc",
535        "base/test/multiprocess_test.cc",
536        "base/test/scoped_feature_list.cc",
537        "base/test/scoped_locale.cc",
538        "base/test/simple_test_tick_clock.cc",
539        "base/test/test_file_util.cc",
540        "base/test/test_file_util_linux.cc",
541        "base/test/test_file_util_posix.cc",
542        "base/test/test_io_thread.cc",
543        "base/test/test_mock_time_task_runner.cc",
544        "base/test/test_pending_task.cc",
545        "base/test/test_shared_memory_util.cc",
546        "base/test/test_simple_task_runner.cc",
547        "base/test/test_switches.cc",
548        "base/test/test_timeouts.cc",
549        "base/threading/platform_thread_unittest.cc",
550        "base/threading/simple_thread_unittest.cc",
551        "base/threading/thread_checker_unittest.cc",
552        "base/threading/thread_collision_warner_unittest.cc",
553        "base/threading/thread_id_name_manager_unittest.cc",
554        "base/threading/thread_local_storage_unittest.cc",
555        "base/threading/thread_local_unittest.cc",
556        "base/threading/thread_unittest.cc",
557        "base/time/pr_time_unittest.cc",
558        "base/time/time_unittest.cc",
559        "base/timer/hi_res_timer_manager_unittest.cc",
560        "base/timer/mock_timer.cc",
561        "base/tuple_unittest.cc",
562        "base/values_unittest.cc",
563        "base/version_unittest.cc",
564        "base/vlog_unittest.cc",
565        "testing/multiprocess_func_list.cc",
566        "testrunner.cc",
567        "ui/gfx/range/range_unittest.cc",
568    ],
569
570    cflags: ["-DUNIT_TEST"],
571    shared_libs: [
572        "libchrome",
573        "libevent",
574    ],
575    static_libs: [
576        "libgmock",
577        "libgtest",
578    ],
579    target: {
580        android: {
581            srcs: [
582                "crypto/secure_hash_unittest.cc",
583                "crypto/sha2_unittest.cc",
584            ],
585            shared_libs: [
586                "libchrome-crypto",
587            ],
588            cflags: ["-DDONT_EMBED_BUILD_METADATA"],
589        },
590    },
591}
592
593filegroup {
594    name: "libmojo_mojom_files",
595    srcs: [
596        "ipc/ipc.mojom",
597        "mojo/public/interfaces/bindings/interface_control_messages.mojom",
598        "mojo/public/interfaces/bindings/native_struct.mojom",
599        "mojo/public/interfaces/bindings/pipe_control_messages.mojom",
600        "mojo/public/mojom/base/big_buffer.mojom",
601        "mojo/public/mojom/base/big_string.mojom",
602        "mojo/public/mojom/base/file.mojom",
603        "mojo/public/mojom/base/file_error.mojom",
604        "mojo/public/mojom/base/file_info.mojom",
605        "mojo/public/mojom/base/file_path.mojom",
606        "mojo/public/mojom/base/process_id.mojom",
607        "mojo/public/mojom/base/read_only_buffer.mojom",
608        "mojo/public/mojom/base/ref_counted_memory.mojom",
609        "mojo/public/mojom/base/shared_memory.mojom",
610        "mojo/public/mojom/base/string16.mojom",
611        "mojo/public/mojom/base/text_direction.mojom",
612        "mojo/public/mojom/base/thread_priority.mojom",
613        "mojo/public/mojom/base/time.mojom",
614        "mojo/public/mojom/base/unguessable_token.mojom",
615        "mojo/public/mojom/base/values.mojom",
616        "ui/gfx/geometry/mojo/geometry.mojom",
617        "ui/gfx/range/mojo/range.mojom",
618    ],
619}
620
621filegroup {
622    name: "libmojo_mojo_sources",
623    srcs: [
624        "mojo/**/*.cc",
625    ],
626    exclude_srcs: [
627        // Unused in Chrome. Looks like mistakenly checked in.
628        // TODO(hidehiko): Remove this after the file is removed in Chrome
629        // repository. http://crrev.com/c/644531
630        "mojo/public/cpp/system/message.cc",
631
632        // No WTF support.
633        "mojo/public/cpp/bindings/lib/string_traits_wtf.cc",
634
635        // Exclude windows/mac/ios/fuchsia files.
636        "**/*_win.cc",
637        "**/*_fuchsia.cc",
638        "mojo/core/mach_port_relay.*",
639        "mojo/public/cpp/base/logfont_win*",
640        "mojo/public/mojom/base/logfont_win*",
641
642        // Exclude js binding related files.
643        "mojo/public/js/**/*",
644
645        // Exclude tests.
646        "**/*_unittest.cc",
647        "**/*_unittests.cc",
648        "**/*_perftest.cc",
649        "mojo/core/core_test_base.*",
650        "mojo/core/test/*",
651        "mojo/core/test_utils.*",
652        "mojo/public/c/system/tests/**/*",
653        "mojo/public/cpp/bindings/tests/**/*",
654        "mojo/public/cpp/system/tests/**/*",
655        "mojo/public/cpp/test_support/**/*",
656        "mojo/public/java/system/javatests/**/*",
657        "mojo/public/tests/**/*",
658
659        // Exclude memory allocator unsupported feature
660        "mojo/public/cpp/base/memory_allocator_dump_cross_process_uid*",
661
662        // Exclude fuzzers
663        "mojo/public/tools/fuzzers/**/*",
664    ],
665}
666
667// Python in Chrome repository requires still Python 2.
668python_defaults {
669    name: "libmojo_scripts",
670    version: {
671        py2: {
672            enabled: true,
673        },
674        py3: {
675            enabled: false,
676        },
677    },
678}
679
680python_binary_host {
681    name: "jni_generator",
682    main: "base/android/jni_generator/jni_generator.py",
683    srcs: [
684        "base/android/jni_generator/jni_generator.py",
685        "build/**/*.py",
686    ],
687    defaults: ["libmojo_scripts"],
688}
689
690python_binary_host {
691    name: "jni_registration_generator",
692    main: "base/android/jni_generator/jni_registration_generator.py",
693    srcs: [
694        "base/android/jni_generator/jni_generator.py",
695        "base/android/jni_generator/jni_registration_generator.py",
696        "build/**/*.py",
697    ],
698    defaults: ["libmojo_scripts"],
699}
700
701python_binary_host {
702    name: "mojom_bindings_generator",
703    main: "mojo/public/tools/bindings/mojom_bindings_generator.py",
704    srcs: [
705        "build/**/*.py",
706        "mojo/public/tools/bindings/**/*.py",
707        "third_party/jinja2/**/*.py",
708        "third_party/markupsafe/**/*.py",
709        "third_party/ply/**/*.py",
710    ],
711    data: [
712        "mojo/public/tools/bindings/generators/cpp_templates/*.tmpl",
713        "mojo/public/tools/bindings/generators/java_templates/*.tmpl",
714        "mojo/public/tools/bindings/generators/js_templates/*.tmpl",
715    ],
716    defaults: ["libmojo_scripts"],
717}
718
719genrule {
720    name: "libmojo_mojom_templates",
721    cmd: "$(location mojom_bindings_generator)" +
722        "    --use_bundled_pylibs precompile" +
723        "    -o $(genDir)",
724
725    tools: [
726        "mojom_bindings_generator",
727    ],
728
729    out: [
730        "cpp_templates.zip",
731        "java_templates.zip",
732        "js_templates.zip",
733    ],
734}
735
736python_binary_host {
737    name: "mojom_generate_type_mappings",
738    main: "libchrome_tools/mojom_generate_type_mappings.py",
739    srcs: [
740        "build/gn_helpers.py",
741        "libchrome_tools/mojom_generate_type_mappings.py",
742        "mojo/public/tools/bindings/generate_type_mappings.py",
743        "mojo/public/tools/bindings/pylib/mojom/fileutil.py",
744        "mojo/public/tools/bindings/pylib/mojom/generate/generator.py",
745        "mojo/public/tools/bindings/pylib/mojom/generate/module.py",
746        "mojo/public/tools/bindings/pylib/mojom/generate/pack.py",
747    ],
748    defaults: ["libmojo_scripts"],
749}
750
751genrule {
752    name: "libmojo_common_custom_types__type_mappings",
753    cmd: "$(location mojom_generate_type_mappings)" +
754        "    --output=$(out)" +
755        "    $(in)",
756
757    tools: ["mojom_generate_type_mappings"],
758
759    srcs: [
760        "mojo/public/cpp/base/big_buffer.typemap",
761        "mojo/public/cpp/base/big_string.typemap",
762        "mojo/public/cpp/base/file.typemap",
763        "mojo/public/cpp/base/file_error.typemap",
764        "mojo/public/cpp/base/file_info.typemap",
765        "mojo/public/cpp/base/file_path.typemap",
766        "mojo/public/cpp/base/process_id.typemap",
767        "mojo/public/cpp/base/read_only_buffer.typemap",
768        "mojo/public/cpp/base/ref_counted_memory.typemap",
769        "mojo/public/cpp/base/shared_memory.typemap",
770        "mojo/public/cpp/base/string16.typemap",
771        "mojo/public/cpp/base/text_direction.typemap",
772        "mojo/public/cpp/base/thread_priority.typemap",
773        "mojo/public/cpp/base/time.typemap",
774        "mojo/public/cpp/base/unguessable_token.typemap",
775        "mojo/public/cpp/base/values.typemap",
776        "ui/gfx/geometry/mojo/geometry.typemap",
777        "ui/gfx/range/mojo/range.typemap",
778    ],
779    out: ["common_custom_types__type_mappings"],
780}
781
782python_binary_host {
783    name: "mojom_types_downgrader",
784    main: "mojo/public/tools/bindings/mojom_types_downgrader.py",
785    srcs: [
786        "mojo/public/tools/bindings/mojom_types_downgrader.py",
787    ],
788    defaults: ["libmojo_scripts"],
789}
790
791generate_mojom_downgraded_files {
792    name: "libmojo_mojom_downgraded_files",
793    srcs: [":libmojo_mojom_files"],
794}
795
796generate_mojom_pickles {
797    name: "libmojo_mojom_pickles",
798    srcs: [":libmojo_mojom_downgraded_files"],
799}
800
801generate_mojom_headers {
802    name: "libmojo_mojom_headers",
803    srcs: [":libmojo_mojom_downgraded_files"],
804    pickles: [":libmojo_mojom_pickles"],
805    templates: ":libmojo_mojom_templates",
806    flags: "--disallow_native_types",
807    typemaps: [":libmojo_common_custom_types__type_mappings"],
808}
809
810generate_mojom_srcs {
811    name: "libmojo_mojom_srcs",
812    srcs: [":libmojo_mojom_downgraded_files"],
813    pickles: [":libmojo_mojom_pickles"],
814    templates: ":libmojo_mojom_templates",
815    flags: "--disallow_native_types",
816    typemaps: [":libmojo_common_custom_types__type_mappings"],
817}
818
819genrule {
820    name: "libmojo_jni_headers",
821    cmd: "$(location libchrome_tools/jni_generator_helper.sh)" +
822        "    --jni_generator=$(location jni_generator)" +
823        "    --output_dir=$(genDir)/jni" +
824        "    --includes=base/android/jni_generator/jni_generator_helper.h" +
825        "    --ptr_type=long" +
826        "    $(in)",
827
828    tools: [
829        "jni_generator",
830    ],
831
832    tool_files: [
833        "libchrome_tools/jni_generator_helper.sh",
834    ],
835
836    srcs: [
837        "base/android/java/src/org/chromium/base/BuildInfo.java",
838        "base/android/java/src/org/chromium/base/JavaExceptionReporter.java",
839        "base/android/java/src/org/chromium/base/ThreadUtils.java",
840        "mojo/public/java/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java",
841        "mojo/public/java/system/src/org/chromium/mojo/system/impl/CoreImpl.java",
842        "mojo/public/java/system/src/org/chromium/mojo/system/impl/WatcherImpl.java",
843    ],
844
845    out: [
846        "jni/BaseRunLoop_jni.h",
847        "jni/BuildInfo_jni.h",
848        "jni/CoreImpl_jni.h",
849        "jni/JavaExceptionReporter_jni.h",
850        "jni/WatcherImpl_jni.h",
851    ],
852}
853
854genrule {
855    name: "libmojo_jni_registration_headers",
856    cmd: "$(location libchrome_tools/jni_registration_generator_helper.sh)" +
857        "    --jni_generator=$(location jni_registration_generator)" +
858        "    --output=$(genDir)/jni/libmojo_jni_registrations.h" +
859        "    $(in)",
860
861    tools: [
862        "jni_registration_generator",
863    ],
864
865    tool_files: [
866        "libchrome_tools/jni_registration_generator_helper.sh",
867    ],
868
869    srcs: [
870        "base/android/java/src/org/chromium/base/BuildInfo.java",
871        "base/android/java/src/org/chromium/base/JavaExceptionReporter.java",
872        "base/android/java/src/org/chromium/base/ThreadUtils.java",
873        "mojo/public/java/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java",
874        "mojo/public/java/system/src/org/chromium/mojo/system/impl/CoreImpl.java",
875        "mojo/public/java/system/src/org/chromium/mojo/system/impl/WatcherImpl.java",
876    ],
877
878    out: [
879        "jni/libmojo_jni_registrations.h",
880    ],
881}
882
883cc_library_shared {
884    name: "libmojo",
885    vendor_available: true,
886
887    generated_sources: ["libmojo_mojom_srcs"],
888    generated_headers: [
889        "libmojo_jni_headers",
890        "libmojo_jni_registration_headers",
891        "libmojo_mojom_headers",
892    ],
893    export_generated_headers: [
894        "libmojo_jni_registration_headers",
895        "libmojo_mojom_headers",
896    ],
897
898    srcs: [
899        ":libmojo_mojo_sources",
900        "base/android/build_info.cc",
901        "base/android/java_exception_reporter.cc",
902        "base/android/jni_android.cc",
903        "base/android/jni_array.cc",
904        "base/android/jni_string.cc",
905        "base/android/scoped_java_ref.cc",
906        "ipc/ipc_message.cc",
907        "ipc/ipc_message_attachment.cc",
908        "ipc/ipc_message_attachment_set.cc",
909        "ipc/ipc_message_utils.cc",
910        "ipc/ipc_mojo_handle_attachment.cc",
911        "ipc/ipc_mojo_message_helper.cc",
912        "ipc/ipc_mojo_param_traits.cc",
913        "ipc/ipc_platform_file_attachment_posix.cc",
914        "ipc/native_handle_type_converters.cc",
915    ],
916
917    cflags: [
918        "-DMOJO_CORE_LEGACY_PROTOCOL",
919        "-Wall",
920        "-Werror",
921        "-Wno-missing-field-initializers",
922        "-Wno-unused-parameter",
923    ],
924
925    // We also pass NO_ASHMEM to make base::SharedMemory avoid using it and prefer
926    // the POSIX versions.
927    cppflags: [
928        "-DNO_ASHMEM",
929        "-Wno-extra",
930        "-Wno-ignored-qualifiers",
931        "-Wno-non-virtual-dtor",
932        "-Wno-sign-promo",
933    ],
934
935    shared_libs: [
936        "libchrome",
937        "libchrome-crypto",
938        "libevent",
939        "liblog",
940    ],
941
942    header_libs: ["jni_headers"],
943
944    export_include_dirs: ["."],
945}
946
947generate_mojom_srcjar {
948    name: "libmojo_mojom_java_srcs",
949    srcs: [":libmojo_mojom_downgraded_files"],
950    pickles: [":libmojo_mojom_pickles"],
951    srcjar: "libmojo_mojom.srcjar",
952    templates: ":libmojo_mojom_templates",
953    flags: "--disallow_native_types",
954    typemaps: [":libmojo_common_custom_types__type_mappings"],
955}
956
957java_library {
958    name: "android.mojo",
959
960    srcs: [
961        ":libmojo_mojom_java_srcs",
962        "base/android/java/src/**/*.java",
963        "mojo/android/system/src/**/*.java",
964        "mojo/public/java/bindings/src/**/*.java",
965        "mojo/public/java/system/src/**/*.java",
966    ],
967
968    static_libs: [
969        "android-support-annotations",
970    ],
971}
972