From 9465fc72ad901ae1f28a8a3269d79d931c7024c6 Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Wed, 29 Nov 2017 11:59:18 -0800 Subject: [PATCH] gn: Move sources out to explicit blocks This avoids relying on set_sources_assignment_filter, and so gets closer to a correct set of files to build on Fuchsia. Bug: crashpad:79, crashpad:196 Change-Id: Ib7daa5137935113c6645b72eb1dedd943a9db96e Reviewed-on: https://chromium-review.googlesource.com/797672 Reviewed-by: Mark Mentovai Commit-Queue: Scott Graham --- client/BUILD.gn | 19 +++-- snapshot/BUILD.gn | 179 +++++++++++++++++++++++++--------------------- test/BUILD.gn | 65 ++++++++++------- 3 files changed, 150 insertions(+), 113 deletions(-) diff --git a/client/BUILD.gn b/client/BUILD.gn index 2fa7110b..5361dda2 100644 --- a/client/BUILD.gn +++ b/client/BUILD.gn @@ -22,11 +22,7 @@ static_library("client") { "annotation_list.h", "crash_report_database.cc", "crash_report_database.h", - "crash_report_database_mac.mm", - "crash_report_database_win.cc", "crashpad_client.h", - "crashpad_client_mac.cc", - "crashpad_client_win.cc", "crashpad_info.cc", "crashpad_info.h", "prune_crash_reports.cc", @@ -36,15 +32,24 @@ static_library("client") { "simple_address_range_bag.h", "simple_string_dictionary.h", "simulate_crash.h", - "simulate_crash_mac.cc", - "simulate_crash_mac.h", - "simulate_crash_win.h", ] if (is_mac) { sources += [ "capture_context_mac.S", "capture_context_mac.h", + "crash_report_database_mac.mm", + "crashpad_client_mac.cc", + "simulate_crash_mac.cc", + "simulate_crash_mac.h", + ] + } + + if (is_win) { + sources += [ + "crash_report_database_win.cc", + "crashpad_client_win.cc", + "simulate_crash_win.h", ] } diff --git a/snapshot/BUILD.gn b/snapshot/BUILD.gn index 2b01fc20..2c46d7be 100644 --- a/snapshot/BUILD.gn +++ b/snapshot/BUILD.gn @@ -29,43 +29,6 @@ static_library("snapshot") { "exception_snapshot.h", "handle_snapshot.cc", "handle_snapshot.h", - "mac/cpu_context_mac.cc", - "mac/cpu_context_mac.h", - "mac/exception_snapshot_mac.cc", - "mac/exception_snapshot_mac.h", - "mac/mach_o_image_annotations_reader.cc", - "mac/mach_o_image_annotations_reader.h", - "mac/mach_o_image_reader.cc", - "mac/mach_o_image_reader.h", - "mac/mach_o_image_segment_reader.cc", - "mac/mach_o_image_segment_reader.h", - "mac/mach_o_image_symbol_table_reader.cc", - "mac/mach_o_image_symbol_table_reader.h", - "mac/memory_snapshot_mac.cc", - "mac/memory_snapshot_mac.h", - "mac/module_snapshot_mac.cc", - "mac/module_snapshot_mac.h", - "mac/process_reader.cc", - "mac/process_reader.h", - "mac/process_snapshot_mac.cc", - "mac/process_snapshot_mac.h", - "mac/process_types.cc", - "mac/process_types.h", - "mac/process_types/all.proctype", - "mac/process_types/annotation.proctype", - "mac/process_types/crashpad_info.proctype", - "mac/process_types/crashreporterclient.proctype", - "mac/process_types/custom.cc", - "mac/process_types/dyld_images.proctype", - "mac/process_types/flavors.h", - "mac/process_types/internal.h", - "mac/process_types/loader.proctype", - "mac/process_types/nlist.proctype", - "mac/process_types/traits.h", - "mac/system_snapshot_mac.cc", - "mac/system_snapshot_mac.h", - "mac/thread_snapshot_mac.cc", - "mac/thread_snapshot_mac.h", "memory_snapshot.h", "minidump/minidump_annotation_reader.cc", "minidump/minidump_annotation_reader.h", @@ -88,36 +51,83 @@ static_library("snapshot") { "thread_snapshot.h", "unloaded_module_snapshot.cc", "unloaded_module_snapshot.h", - "win/capture_memory_delegate_win.cc", - "win/capture_memory_delegate_win.h", - "win/cpu_context_win.cc", - "win/cpu_context_win.h", - "win/exception_snapshot_win.cc", - "win/exception_snapshot_win.h", - "win/memory_map_region_snapshot_win.cc", - "win/memory_map_region_snapshot_win.h", - "win/memory_snapshot_win.cc", - "win/memory_snapshot_win.h", - "win/module_snapshot_win.cc", - "win/module_snapshot_win.h", - "win/pe_image_annotations_reader.cc", - "win/pe_image_annotations_reader.h", - "win/pe_image_reader.cc", - "win/pe_image_reader.h", - "win/pe_image_resource_reader.cc", - "win/pe_image_resource_reader.h", - "win/process_reader_win.cc", - "win/process_reader_win.h", - "win/process_snapshot_win.cc", - "win/process_snapshot_win.h", - "win/process_subrange_reader.cc", - "win/process_subrange_reader.h", - "win/system_snapshot_win.cc", - "win/system_snapshot_win.h", - "win/thread_snapshot_win.cc", - "win/thread_snapshot_win.h", ] + if (is_mac) { + sources += [ + "mac/cpu_context_mac.cc", + "mac/cpu_context_mac.h", + "mac/exception_snapshot_mac.cc", + "mac/exception_snapshot_mac.h", + "mac/mach_o_image_annotations_reader.cc", + "mac/mach_o_image_annotations_reader.h", + "mac/mach_o_image_reader.cc", + "mac/mach_o_image_reader.h", + "mac/mach_o_image_segment_reader.cc", + "mac/mach_o_image_segment_reader.h", + "mac/mach_o_image_symbol_table_reader.cc", + "mac/mach_o_image_symbol_table_reader.h", + "mac/memory_snapshot_mac.cc", + "mac/memory_snapshot_mac.h", + "mac/module_snapshot_mac.cc", + "mac/module_snapshot_mac.h", + "mac/process_reader.cc", + "mac/process_reader.h", + "mac/process_snapshot_mac.cc", + "mac/process_snapshot_mac.h", + "mac/process_types.cc", + "mac/process_types.h", + "mac/process_types/all.proctype", + "mac/process_types/annotation.proctype", + "mac/process_types/crashpad_info.proctype", + "mac/process_types/crashreporterclient.proctype", + "mac/process_types/custom.cc", + "mac/process_types/dyld_images.proctype", + "mac/process_types/flavors.h", + "mac/process_types/internal.h", + "mac/process_types/loader.proctype", + "mac/process_types/nlist.proctype", + "mac/process_types/traits.h", + "mac/system_snapshot_mac.cc", + "mac/system_snapshot_mac.h", + "mac/thread_snapshot_mac.cc", + "mac/thread_snapshot_mac.h", + ] + } + + if (is_win) { + sources += [ + "win/capture_memory_delegate_win.cc", + "win/capture_memory_delegate_win.h", + "win/cpu_context_win.cc", + "win/cpu_context_win.h", + "win/exception_snapshot_win.cc", + "win/exception_snapshot_win.h", + "win/memory_map_region_snapshot_win.cc", + "win/memory_map_region_snapshot_win.h", + "win/memory_snapshot_win.cc", + "win/memory_snapshot_win.h", + "win/module_snapshot_win.cc", + "win/module_snapshot_win.h", + "win/pe_image_annotations_reader.cc", + "win/pe_image_annotations_reader.h", + "win/pe_image_reader.cc", + "win/pe_image_reader.h", + "win/pe_image_resource_reader.cc", + "win/pe_image_resource_reader.h", + "win/process_reader_win.cc", + "win/process_reader_win.h", + "win/process_snapshot_win.cc", + "win/process_snapshot_win.h", + "win/process_subrange_reader.cc", + "win/process_subrange_reader.h", + "win/system_snapshot_win.cc", + "win/system_snapshot_win.h", + "win/thread_snapshot_win.cc", + "win/thread_snapshot_win.h", + ] + } + if (target_cpu == "x86" || target_cpu == "x64") { sources += [ "x86/cpuid_reader.cc", @@ -208,26 +218,33 @@ source_set("snapshot_test") { sources = [ "cpu_context_test.cc", "crashpad_info_client_options_test.cc", - "mac/cpu_context_mac_test.cc", - "mac/mach_o_image_annotations_reader_test.cc", - "mac/mach_o_image_reader_test.cc", - "mac/mach_o_image_segment_reader_test.cc", - "mac/process_reader_test.cc", - "mac/process_types_test.cc", - "mac/system_snapshot_mac_test.cc", "minidump/process_snapshot_minidump_test.cc", - "win/cpu_context_win_test.cc", - "win/exception_snapshot_win_test.cc", - "win/extra_memory_ranges_test.cc", - "win/pe_image_annotations_reader_test.cc", - "win/pe_image_reader_test.cc", - "win/process_reader_win_test.cc", - "win/process_snapshot_win_test.cc", - "win/system_snapshot_win_test.cc", ] + if (is_mac) { + sources += [ + "mac/cpu_context_mac_test.cc", + "mac/mach_o_image_annotations_reader_test.cc", + "mac/mach_o_image_reader_test.cc", + "mac/mach_o_image_segment_reader_test.cc", + "mac/process_reader_test.cc", + "mac/process_types_test.cc", + "mac/system_snapshot_mac_test.cc", + ] + } + if (is_win) { - sources += [ "api/module_annotations_win_test.cc" ] + sources += [ + "api/module_annotations_win_test.cc", + "win/cpu_context_win_test.cc", + "win/exception_snapshot_win_test.cc", + "win/extra_memory_ranges_test.cc", + "win/pe_image_annotations_reader_test.cc", + "win/pe_image_reader_test.cc", + "win/process_reader_win_test.cc", + "win/process_snapshot_win_test.cc", + "win/system_snapshot_win_test.cc", + ] } else { sources += [ "posix/timezone_test.cc" ] } diff --git a/test/BUILD.gn b/test/BUILD.gn index 50f0c81f..441393b8 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -29,14 +29,6 @@ static_library("test") { "gtest_disabled.h", "hex_string.cc", "hex_string.h", - "mac/dyld.cc", - "mac/dyld.h", - "mac/exception_swallower.cc", - "mac/exception_swallower.h", - "mac/mach_errors.cc", - "mac/mach_errors.h", - "mac/mach_multiprocess.cc", - "mac/mach_multiprocess.h", "main_arguments.cc", "main_arguments.h", "multiprocess.h", @@ -52,16 +44,36 @@ static_library("test") { "scoped_temp_dir_win.cc", "test_paths.cc", "test_paths.h", - "win/child_launcher.cc", - "win/child_launcher.h", - "win/win_child_process.cc", - "win/win_child_process.h", - "win/win_multiprocess.cc", - "win/win_multiprocess.h", - "win/win_multiprocess_with_temp_dir.cc", - "win/win_multiprocess_with_temp_dir.h", ] + if (is_mac) { + libs = [ "bsm" ] + deps += [ "//third_party/crashpad/crashpad/handler" ] + sources += [ + "mac/dyld.cc", + "mac/dyld.h", + "mac/exception_swallower.cc", + "mac/exception_swallower.h", + "mac/mach_errors.cc", + "mac/mach_errors.h", + "mac/mach_multiprocess.cc", + "mac/mach_multiprocess.h", + ] + } + + if (is_win) { + sources += [ + "win/child_launcher.cc", + "win/child_launcher.h", + "win/win_child_process.cc", + "win/win_child_process.h", + "win/win_multiprocess.cc", + "win/win_multiprocess.h", + "win/win_multiprocess_with_temp_dir.cc", + "win/win_multiprocess_with_temp_dir.h", + ] + } + public_configs = [ "..:crashpad_config" ] defines = [ "CRASHPAD_IN_CHROMIUM" ] @@ -77,11 +89,6 @@ static_library("test") { "//base", "//testing/gtest", ] - - if (is_mac) { - libs = [ "bsm" ] - deps += [ "//third_party/crashpad/crashpad/handler" ] - } } source_set("test_test") { @@ -89,16 +96,24 @@ source_set("test_test") { sources = [ "hex_string_test.cc", - "mac/mach_multiprocess_test.cc", "main_arguments_test.cc", "multiprocess_exec_test.cc", "scoped_temp_dir_test.cc", "test_paths_test.cc", - "win/win_child_process_test.cc", - "win/win_multiprocess_test.cc", ] - if (!is_win) { + if (is_mac) { + sources += [ "mac/mach_multiprocess_test.cc" ] + } + + if (is_win) { + sources += [ + "win/win_child_process_test.cc", + "win/win_multiprocess_test.cc", + ] + } + + if (is_posix) { sources += [ "multiprocess_posix_test.cc" ] }