blob: b89574bf4c7d0cca88981ad6314f41701d90d4cc [file] [log] [blame]
// Copyright (C) 2015 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Common defaults
// ========================================================
cc_defaults {
name: "libchrome-defaults",
// Set clang to "true" to force clang or "false" to force gcc.
// clang: true,
cflags: [
"-Wall",
"-Werror",
"-Wno-deprecated-declarations",
],
include_dirs: [
"external/valgrind/include",
"external/valgrind",
],
export_include_dirs: ["."],
target: {
host: {
cflags: [
"-D__ANDROID_HOST__",
"-DDONT_EMBED_BUILD_METADATA",
],
},
darwin: {
enabled: false,
},
},
}
cc_defaults {
name: "libchrome-test-defaults",
defaults: ["libchrome-defaults"],
cflags: [
"-Wno-unused-parameter",
"-Wno-unused-function",
"-Wno-unused-variable",
"-Wno-missing-field-initializers",
],
clang_cflags: [
// Temporarily suppress the warnings http://b/38232827
"-Wno-error=unused-lambda-capture",
],
}
libchromeCommonSrc = [
"base/at_exit.cc",
"base/base64.cc",
"base/base64url.cc",
"base/base_switches.cc",
"base/bind_helpers.cc",
"base/build_time.cc",
"base/callback_helpers.cc",
"base/callback_internal.cc",
"base/command_line.cc",
"base/cpu.cc",
"base/debug/activity_tracker.cc",
"base/debug/alias.cc",
"base/debug/debugger.cc",
"base/debug/debugger_posix.cc",
"base/debug/dump_without_crashing.cc",
"base/debug/profiler.cc",
"base/debug/stack_trace.cc",
"base/debug/stack_trace_posix.cc",
"base/debug/task_annotator.cc",
"base/environment.cc",
"base/feature_list.cc",
"base/files/file.cc",
"base/files/file_descriptor_watcher_posix.cc",
"base/files/file_enumerator.cc",
"base/files/file_enumerator_posix.cc",
"base/files/file_path.cc",
"base/files/file_path_constants.cc",
"base/files/file_path_watcher.cc",
"base/files/file_posix.cc",
"base/files/file_tracing.cc",
"base/files/file_util.cc",
"base/files/file_util_posix.cc",
"base/files/important_file_writer.cc",
"base/files/memory_mapped_file.cc",
"base/files/memory_mapped_file_posix.cc",
"base/files/scoped_file.cc",
"base/files/scoped_temp_dir.cc",
"base/guid.cc",
"base/hash.cc",
"base/json/json_file_value_serializer.cc",
"base/json/json_parser.cc",
"base/json/json_reader.cc",
"base/json/json_string_value_serializer.cc",
"base/json/json_value_converter.cc",
"base/json/json_writer.cc",
"base/json/string_escape.cc",
"base/lazy_instance.cc",
"base/location.cc",
"base/logging.cc",
"base/md5.cc",
"base/memory/aligned_memory.cc",
"base/memory/ref_counted.cc",
"base/memory/ref_counted_memory.cc",
"base/memory/shared_memory_helper.cc",
"base/memory/singleton.cc",
"base/memory/weak_ptr.cc",
"base/message_loop/incoming_task_queue.cc",
"base/message_loop/message_loop.cc",
"base/message_loop/message_loop_task_runner.cc",
"base/message_loop/message_pump.cc",
"base/message_loop/message_pump_default.cc",
"base/message_loop/message_pump_libevent.cc",
"base/metrics/bucket_ranges.cc",
"base/metrics/field_trial.cc",
"base/metrics/field_trial_param_associator.cc",
"base/metrics/metrics_hashes.cc",
"base/metrics/histogram_base.cc",
"base/metrics/histogram.cc",
"base/metrics/histogram_samples.cc",
"base/metrics/histogram_snapshot_manager.cc",
"base/metrics/persistent_histogram_allocator.cc",
"base/metrics/persistent_memory_allocator.cc",
"base/metrics/persistent_sample_map.cc",
"base/metrics/sample_map.cc",
"base/metrics/sample_vector.cc",
"base/metrics/sparse_histogram.cc",
"base/metrics/statistics_recorder.cc",
"base/pending_task.cc",
"base/pickle.cc",
"base/posix/global_descriptors.cc",
"base/posix/file_descriptor_shuffle.cc",
"base/posix/safe_strerror.cc",
"base/process/kill.cc",
"base/process/kill_posix.cc",
"base/process/launch.cc",
"base/process/launch_posix.cc",
"base/process/memory.cc",
"base/process/process_handle.cc",
"base/process/process_handle_posix.cc",
"base/process/process_iterator.cc",
"base/process/process_metrics.cc",
"base/process/process_metrics_posix.cc",
"base/process/process_posix.cc",
"base/profiler/scoped_profile.cc",
"base/profiler/scoped_tracker.cc",
"base/profiler/tracked_time.cc",
"base/rand_util.cc",
"base/rand_util_posix.cc",
"base/run_loop.cc",
"base/sequence_checker_impl.cc",
"base/sequence_token.cc",
"base/sequenced_task_runner.cc",
"base/sha1.cc",
"base/strings/pattern.cc",
"base/strings/safe_sprintf.cc",
"base/strings/string16.cc",
"base/strings/string_number_conversions.cc",
"base/strings/string_piece.cc",
"base/strings/stringprintf.cc",
"base/strings/string_split.cc",
"base/strings/string_util.cc",
"base/strings/string_util_constants.cc",
"base/strings/utf_string_conversions.cc",
"base/strings/utf_string_conversion_utils.cc",
"base/synchronization/atomic_flag.cc",
"base/synchronization/condition_variable_posix.cc",
"base/synchronization/lock.cc",
"base/synchronization/lock_impl_posix.cc",
"base/synchronization/read_write_lock_posix.cc",
"base/synchronization/waitable_event_posix.cc",
"base/sync_socket_posix.cc",
"base/sys_info.cc",
"base/sys_info_posix.cc",
"base/task/cancelable_task_tracker.cc",
"base/task_runner.cc",
"base/task_scheduler/scheduler_lock_impl.cc",
"base/task_scheduler/scoped_set_task_priority_for_current_thread.cc",
"base/task_scheduler/sequence.cc",
"base/task_scheduler/sequence_sort_key.cc",
"base/task_scheduler/task.cc",
"base/task_scheduler/task_traits.cc",
"base/third_party/dynamic_annotations/dynamic_annotations.c",
"base/third_party/icu/icu_utf.cc",
"base/third_party/nspr/prtime.cc",
"base/threading/non_thread_safe_impl.cc",
"base/threading/platform_thread_posix.cc",
"base/threading/post_task_and_reply_impl.cc",
"base/threading/sequenced_task_runner_handle.cc",
"base/threading/sequenced_worker_pool.cc",
"base/threading/simple_thread.cc",
"base/threading/thread.cc",
"base/threading/thread_checker_impl.cc",
"base/threading/thread_collision_warner.cc",
"base/threading/thread_id_name_manager.cc",
"base/threading/thread_local_storage.cc",
"base/threading/thread_local_storage_posix.cc",
"base/threading/thread_restrictions.cc",
"base/threading/thread_task_runner_handle.cc",
"base/threading/worker_pool.cc",
"base/threading/worker_pool_posix.cc",
"base/time/clock.cc",
"base/time/default_clock.cc",
"base/time/default_tick_clock.cc",
"base/time/tick_clock.cc",
"base/time/time.cc",
"base/time/time_posix.cc",
"base/timer/elapsed_timer.cc",
"base/timer/timer.cc",
"base/trace_event/category_registry.cc",
"base/trace_event/event_name_filter.cc",
"base/trace_event/heap_profiler_allocation_context.cc",
"base/trace_event/heap_profiler_allocation_context_tracker.cc",
"base/trace_event/heap_profiler_allocation_register.cc",
"base/trace_event/heap_profiler_allocation_register_posix.cc",
"base/trace_event/heap_profiler_event_filter.cc",
"base/trace_event/heap_profiler_heap_dump_writer.cc",
"base/trace_event/heap_profiler_stack_frame_deduplicator.cc",
"base/trace_event/heap_profiler_type_name_deduplicator.cc",
"base/trace_event/malloc_dump_provider.cc",
"base/trace_event/memory_allocator_dump.cc",
"base/trace_event/memory_allocator_dump_guid.cc",
"base/trace_event/memory_dump_manager.cc",
"base/trace_event/memory_dump_request_args.cc",
"base/trace_event/memory_dump_scheduler.cc",
"base/trace_event/memory_dump_session_state.cc",
"base/trace_event/memory_infra_background_whitelist.cc",
"base/trace_event/memory_usage_estimator.cc",
"base/trace_event/process_memory_dump.cc",
"base/trace_event/process_memory_maps.cc",
"base/trace_event/process_memory_totals.cc",
"base/trace_event/trace_buffer.cc",
"base/trace_event/trace_config.cc",
"base/trace_event/trace_config_category_filter.cc",
"base/trace_event/trace_event_argument.cc",
"base/trace_event/trace_event_filter.cc",
"base/trace_event/trace_event_impl.cc",
"base/trace_event/trace_event_memory_overhead.cc",
"base/trace_event/trace_event_synthetic_delay.cc",
"base/trace_event/trace_log.cc",
"base/trace_event/trace_log_constants.cc",
"base/tracked_objects.cc",
"base/tracking_info.cc",
"base/values.cc",
"base/version.cc",
"base/vlog.cc",
]
libchromeLinuxSrc = [
"base/files/file_path_watcher_linux.cc",
"base/files/file_util_linux.cc",
"base/memory/shared_memory_posix.cc",
"base/memory/shared_memory_tracker.cc",
"base/posix/unix_domain_socket_linux.cc",
"base/process/internal_linux.cc",
"base/process/memory_linux.cc",
"base/process/process_handle_linux.cc",
"base/process/process_info_linux.cc",
"base/process/process_iterator_linux.cc",
"base/process/process_metrics_linux.cc",
"base/strings/sys_string_conversions_posix.cc",
"base/sys_info_linux.cc",
"base/threading/platform_thread_internal_posix.cc",
"base/threading/platform_thread_linux.cc",
"components/timers/alarm_timer_chromeos.cc",
]
libchromeMacSrc = [
"base/files/file_path_watcher_fsevents.cc",
"base/files/file_path_watcher_kqueue.cc",
"base/files/file_path_watcher_mac.cc",
"base/files/file_util_mac.mm",
"base/mac/bundle_locations.mm",
"base/mac/call_with_eh_frame.cc",
"base/mac/foundation_util.mm",
"base/mac/mach_logging.cc",
"base/mac/scoped_mach_port.cc",
"base/mac/scoped_mach_vm.cc",
"base/mac/scoped_nsautorelease_pool.mm",
"base/mac/sdk_forward_declarations.mm",
"base/memory/shared_memory_mac.cc",
"base/memory/shared_memory_handle_mac.cc",
"base/message_loop/message_pump_mac.mm",
"base/process/launch_mac.cc",
"base/process/port_provider_mac.cc",
"base/process/process_handle_mac.cc",
"base/process/process_info_mac.cc",
"base/process/process_iterator_mac.cc",
"base/process/process_metrics_mac.cc",
"base/strings/sys_string_conversions_mac.mm",
"base/sys_info_mac.mm",
"base/time/time_mac.cc",
"base/threading/platform_thread_mac.mm",
]
// libchrome static+shared for host and device
// ========================================================
cc_library {
name: "libchrome",
host_supported: true,
vendor_available: true,
defaults: ["libchrome-defaults"],
srcs: libchromeCommonSrc,
export_shared_lib_headers: ["libbase"],
export_static_lib_headers: ["libgtest_prod"],
shared_libs: [
"libbase",
"libevent",
],
static_libs: [
"libmodpb64",
"libgtest_prod",
],
target: {
linux: {
srcs: libchromeLinuxSrc,
},
android: {
srcs: [
"base/memory/shared_memory_android.cc",
"base/sys_info_chromeos.cc",
],
shared_libs: [
"liblog",
"libcutils",
],
},
linux_glibc: {
srcs: [
"base/allocator/allocator_shim.cc",
"base/allocator/allocator_shim_default_dispatch_to_glibc.cc"
],
},
darwin: {
srcs: libchromeMacSrc,
},
},
}
// libchrome-crypto shared library for device
// ========================================================
cc_library_shared {
name: "libchrome-crypto",
defaults: ["libchrome-defaults"],
srcs: [
"crypto/openssl_util.cc",
"crypto/random.cc",
"crypto/secure_hash.cc",
"crypto/secure_util.cc",
"crypto/sha2.cc",
],
cflags: ["-Wno-unused-parameter"],
shared_libs: [
"libchrome",
"libcrypto",
"libssl",
],
}
// Helpers needed for unit tests.
// ========================================================
cc_library_static {
name: "libchrome_test_helpers",
defaults: ["libchrome-test-defaults"],
shared_libs: ["libchrome"],
host_supported: true,
srcs: [
"base/test/gtest_util.cc",
"base/test/simple_test_clock.cc",
"base/test/simple_test_tick_clock.cc",
"base/test/test_file_util.cc",
"base/test/test_file_util_linux.cc",
"base/test/test_switches.cc",
"base/test/test_timeouts.cc",
],
target: {
darwin: {
enabled: false,
},
},
}
// Helpers needed for unit tests (for host).
// ========================================================
cc_library_host_static {
name: "libchrome_test_helpers-host",
defaults: ["libchrome-test-defaults"],
shared_libs: ["libchrome"],
srcs: ["base/test/simple_test_clock.cc"],
target: {
darwin: {
enabled: false,
},
},
}
// Host and target unit tests. Run (from repo root) with:
// ./out/host/<arch>/nativetest/libchrome_test/libchrome_test
// or
// adb shell /data/nativetest/libchrome_test/libchrome_test
// ========================================================
cc_test {
name: "libchrome_test",
host_supported: true,
defaults: ["libchrome-test-defaults"],
srcs: [
"base/at_exit_unittest.cc",
"base/atomicops_unittest.cc",
"base/base64_unittest.cc",
"base/base64url_unittest.cc",
"base/bind_unittest.cc",
"base/bits_unittest.cc",
"base/build_time_unittest.cc",
"base/callback_helpers_unittest.cc",
"base/callback_list_unittest.cc",
"base/callback_unittest.cc",
"base/cancelable_callback_unittest.cc",
"base/command_line_unittest.cc",
"base/cpu_unittest.cc",
"base/debug/activity_tracker_unittest.cc",
"base/debug/debugger_unittest.cc",
"base/debug/leak_tracker_unittest.cc",
"base/debug/task_annotator_unittest.cc",
"base/environment_unittest.cc",
"base/files/dir_reader_posix_unittest.cc",
"base/files/file_descriptor_watcher_posix_unittest.cc",
"base/files/file_path_watcher_unittest.cc",
"base/files/file_path_unittest.cc",
"base/files/file_unittest.cc",
"base/files/important_file_writer_unittest.cc",
"base/files/scoped_temp_dir_unittest.cc",
"base/gmock_unittest.cc",
"base/guid_unittest.cc",
"base/id_map_unittest.cc",
"base/json/json_parser_unittest.cc",
"base/json/json_reader_unittest.cc",
"base/json/json_value_converter_unittest.cc",
"base/json/json_value_serializer_unittest.cc",
"base/json/json_writer_unittest.cc",
"base/json/string_escape_unittest.cc",
"base/lazy_instance_unittest.cc",
"base/logging_unittest.cc",
"base/md5_unittest.cc",
"base/memory/aligned_memory_unittest.cc",
"base/memory/linked_ptr_unittest.cc",
"base/memory/ref_counted_memory_unittest.cc",
"base/memory/ref_counted_unittest.cc",
"base/memory/scoped_vector_unittest.cc",
"base/memory/singleton_unittest.cc",
"base/memory/weak_ptr_unittest.cc",
"base/message_loop/message_loop_test.cc",
"base/message_loop/message_loop_task_runner_unittest.cc",
"base/message_loop/message_loop_unittest.cc",
"base/metrics/bucket_ranges_unittest.cc",
"base/metrics/field_trial_unittest.cc",
"base/metrics/metrics_hashes_unittest.cc",
"base/metrics/histogram_base_unittest.cc",
"base/metrics/histogram_macros_unittest.cc",
"base/metrics/histogram_snapshot_manager_unittest.cc",
"base/metrics/histogram_unittest.cc",
"base/metrics/persistent_histogram_allocator_unittest.cc",
"base/metrics/persistent_memory_allocator_unittest.cc",
"base/metrics/persistent_sample_map_unittest.cc",
"base/metrics/sample_map_unittest.cc",
"base/metrics/sample_vector_unittest.cc",
"base/metrics/sparse_histogram_unittest.cc",
"base/metrics/statistics_recorder_unittest.cc",
"base/numerics/safe_numerics_unittest.cc",
"base/observer_list_unittest.cc",
"base/optional_unittest.cc",
"base/pickle_unittest.cc",
"base/posix/file_descriptor_shuffle_unittest.cc",
"base/posix/unix_domain_socket_linux_unittest.cc",
"base/process/process_info_unittest.cc",
"base/process/process_metrics_unittest.cc",
"base/profiler/tracked_time_unittest.cc",
"base/rand_util_unittest.cc",
"base/scoped_clear_errno_unittest.cc",
"base/scoped_generic_unittest.cc",
"base/security_unittest.cc",
"base/sequence_checker_unittest.cc",
"base/sequence_token_unittest.cc",
"base/sha1_unittest.cc",
"base/stl_util_unittest.cc",
"base/strings/pattern_unittest.cc",
"base/strings/string16_unittest.cc",
"base/strings/string_number_conversions_unittest.cc",
"base/strings/string_piece_unittest.cc",
"base/strings/stringprintf_unittest.cc",
"base/strings/string_split_unittest.cc",
"base/strings/string_util_unittest.cc",
"base/strings/sys_string_conversions_unittest.cc",
"base/strings/utf_string_conversions_unittest.cc",
"base/synchronization/atomic_flag_unittest.cc",
"base/synchronization/condition_variable_unittest.cc",
"base/synchronization/lock_unittest.cc",
"base/synchronization/waitable_event_unittest.cc",
"base/sync_socket_unittest.cc",
"base/sys_info_unittest.cc",
"base/task/cancelable_task_tracker_unittest.cc",
"base/task_runner_util_unittest.cc",
"base/task_scheduler/scheduler_lock_unittest.cc",
"base/task_scheduler/scoped_set_task_priority_for_current_thread_unittest.cc",
"base/task_scheduler/sequence_sort_key_unittest.cc",
"base/task_scheduler/sequence_unittest.cc",
"base/task_scheduler/task_traits.cc",
"base/template_util_unittest.cc",
"base/test/mock_entropy_provider.cc",
"base/test/multiprocess_test.cc",
"base/test/opaque_ref_counted.cc",
"base/test/scoped_feature_list.cc",
"base/test/scoped_locale.cc",
"base/test/sequenced_worker_pool_owner.cc",
"base/test/test_file_util.cc",
"base/test/test_file_util_linux.cc",
"base/test/test_file_util_posix.cc",
"base/test/test_io_thread.cc",
"base/test/test_mock_time_task_runner.cc",
"base/test/test_pending_task.cc",
"base/test/test_simple_task_runner.cc",
"base/test/test_switches.cc",
"base/test/test_timeouts.cc",
"base/test/trace_event_analyzer.cc",
"base/threading/non_thread_safe_unittest.cc",
"base/threading/platform_thread_unittest.cc",
"base/threading/simple_thread_unittest.cc",
"base/threading/thread_checker_unittest.cc",
"base/threading/thread_collision_warner_unittest.cc",
"base/threading/thread_id_name_manager_unittest.cc",
"base/threading/thread_local_storage_unittest.cc",
"base/threading/thread_local_unittest.cc",
"base/threading/thread_unittest.cc",
"base/threading/worker_pool_posix_unittest.cc",
"base/threading/worker_pool_unittest.cc",
"base/time/pr_time_unittest.cc",
"base/time/time_unittest.cc",
"base/timer/hi_res_timer_manager_unittest.cc",
"base/timer/timer_unittest.cc",
"base/trace_event/event_name_filter_unittest.cc",
"base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc",
"base/trace_event/heap_profiler_stack_frame_deduplicator_unittest.cc",
"base/trace_event/heap_profiler_type_name_deduplicator_unittest.cc",
"base/trace_event/memory_allocator_dump_unittest.cc",
"base/trace_event/memory_dump_manager_unittest.cc",
"base/trace_event/memory_usage_estimator_unittest.cc",
"base/trace_event/process_memory_dump_unittest.cc",
"base/trace_event/trace_config_unittest.cc",
"base/trace_event/trace_event_argument_unittest.cc",
"base/trace_event/trace_event_filter_test_utils.cc",
"base/trace_event/trace_event_synthetic_delay_unittest.cc",
"base/trace_event/trace_event_unittest.cc",
"base/tracked_objects_unittest.cc",
"base/tuple_unittest.cc",
"base/values_unittest.cc",
"base/version_unittest.cc",
"base/vlog_unittest.cc",
"testing/multiprocess_func_list.cc",
"testrunner.cc",
],
cflags: ["-DUNIT_TEST"],
shared_libs: [
"libchrome",
"libevent",
],
static_libs: [
"libgmock",
"libgtest",
],
target: {
android: {
srcs: [
"crypto/secure_hash_unittest.cc",
"crypto/sha2_unittest.cc",
],
shared_libs: [
"libchrome-crypto",
],
cflags: ["-DDONT_EMBED_BUILD_METADATA"],
},
darwin: {
enabled: false,
},
},
}