From 2bb56fafe3bd0c7a381ff4a1f54a82f772407a62 Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Tue, 28 Nov 2017 10:31:13 -0800 Subject: [PATCH] Rework GN files to start to support building standalone, and also in Chromium - Adds a .gn and a build/BUILDCONFIG.gn that uses mini_chromium's build/BUILD.gn. - Adds some stub BUILD.gn files in locations where Chromium expects them (in //build, //testing, //third_party) containing empty targets/configs. These are no-ops in standalone builds, but add functionality when building in Chromium. This is in preference to having a global bool that conditionally does Chromium-y things in the Crashpad build files. These stub files are all contained in a secondary source root in build/chromium_compatibility, referred to by //.gn. - Adds //base/BUILD.gn which forwards to mini_chromium/base. This is only used when building standalone so that both Chromium and Crashpad can refer to it as "//base". - Changes references to other Crashpad targets to be relatively specified so that they work when the root of the project is //, and also when it's //third_party/crashpad/crashpad as it is in Chromium. - Moves any error-causing Mac/Win-specific files into explicit if (is_mac) or if (is_win) blocks as part of removing the dependency on set_sources_assignment_filter(). As yet unresolved: - CRASHPAD_IN_CHROMIUM needs to be removed when standalone; to be tackled in a follow up. - Not sure what to do with zlib yet, the build file currently assumes "in Chromium" too, and similarly having Crashpad //third_party/zlib:zlib pointing at itself doesn't work. Bug: crashpad:79 Change-Id: I6a7dda214e4b3b14a60c1ed285267ab97432a1a8 Reviewed-on: https://chromium-review.googlesource.com/777410 Reviewed-by: Mark Mentovai Reviewed-by: Robert Sesek Commit-Queue: Scott Graham --- .gn | 19 ++ BUILD.gn | 2 +- build/BUILDCONFIG.gn | 66 ++++++ build/chromium_compatibility/README.crashpad | 5 + build/chromium_compatibility/base/BUILD.gn | 26 +++ .../chromium_compatibility/base/test/BUILD.gn | 19 ++ .../build/config/compiler/BUILD.gn | 28 +++ .../build/config/compiler/compiler.gni | 16 ++ .../chromium_compatibility/build/win/BUILD.gn | 25 +++ .../testing/gmock/BUILD.gn | 19 ++ .../testing/gtest/BUILD.gn | 19 ++ build/chromium_compatibility/testing/test.gni | 22 ++ client/BUILD.gn | 17 +- compat/BUILD.gn | 2 +- handler/BUILD.gn | 60 +++--- minidump/BUILD.gn | 16 +- snapshot/BUILD.gn | 58 +++--- snapshot/test/BUILD.gn | 155 -------------- test/BUILD.gn | 12 +- tools/BUILD.gn | 38 ++-- util/BUILD.gn | 191 +++++++++--------- 21 files changed, 468 insertions(+), 347 deletions(-) create mode 100644 .gn create mode 100644 build/BUILDCONFIG.gn create mode 100644 build/chromium_compatibility/README.crashpad create mode 100644 build/chromium_compatibility/base/BUILD.gn create mode 100644 build/chromium_compatibility/base/test/BUILD.gn create mode 100644 build/chromium_compatibility/build/config/compiler/BUILD.gn create mode 100644 build/chromium_compatibility/build/config/compiler/compiler.gni create mode 100644 build/chromium_compatibility/build/win/BUILD.gn create mode 100644 build/chromium_compatibility/testing/gmock/BUILD.gn create mode 100644 build/chromium_compatibility/testing/gtest/BUILD.gn create mode 100644 build/chromium_compatibility/testing/test.gni delete mode 100644 snapshot/test/BUILD.gn diff --git a/.gn b/.gn new file mode 100644 index 00000000..304422da --- /dev/null +++ b/.gn @@ -0,0 +1,19 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +buildconfig = "//build/BUILDCONFIG.gn" + +# This secondary source root is used to put various forwarding/stub files that +# serve to make the core build files compatible with Chromium. +secondary_source = "//build/chromium_compatibility/" diff --git a/BUILD.gn b/BUILD.gn index 5c3918ef..88559c42 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -15,7 +15,7 @@ import("//testing/test.gni") config("crashpad_config") { - include_dirs = [ "//third_party/crashpad/crashpad" ] + include_dirs = [ "." ] } test("crashpad_tests") { diff --git a/build/BUILDCONFIG.gn b/build/BUILDCONFIG.gn new file mode 100644 index 00000000..d85494ba --- /dev/null +++ b/build/BUILDCONFIG.gn @@ -0,0 +1,66 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +if (target_os == "") { + target_os = host_os +} + +if (current_os == "") { + current_os = target_os +} + +declare_args() { + is_debug = false + is_clang = current_os == "mac" || current_os == "fuchsia" + clang_root = "" +} + +is_mac = false +is_win = false +is_linux = false +is_android = false +is_fuchsia = false +is_ios = false # This is necessary for third_party/zlib/zlib/BUILD.gn. + +if (current_os == "mac") { + is_mac = true +} else if (current_os == "win") { + is_win = true +} else if (current_os == "android") { + is_android = true +} else if (current_os == "linux") { + is_linux = true +} else if (current_os == "fuchsia") { + is_fuchsia = true +} + +is_posix = is_mac || is_linux || is_android || is_fuchsia + +if (is_win) { + set_default_toolchain( + "//third_party/mini_chromium/mini_chromium/build:msvc_toolchain") +} else { + set_default_toolchain( + "//third_party/mini_chromium/mini_chromium/build:gcc_like_toolchain") +} + +set_defaults("static_library") { + configs = [ + "//third_party/mini_chromium/mini_chromium/build:default", + + # This (no-op) is added here so that build files that expect to be able to + # remove it can do so without causing an error. + "//build/config/compiler:chromium_code", + ] +} diff --git a/build/chromium_compatibility/README.crashpad b/build/chromium_compatibility/README.crashpad new file mode 100644 index 00000000..9a3c1296 --- /dev/null +++ b/build/chromium_compatibility/README.crashpad @@ -0,0 +1,5 @@ +This directory is used as a secondary GN source root for compatibility with +Chromium. Files in this subtree should match file paths that the Crashpad build +files need to refer to when building in Chromium. In the Crashpad tree, they +should either be empty/no-ops, or forward to the real Crashpad implementation +in the real tree. No actual configuration should be done in this secondary tree. diff --git a/build/chromium_compatibility/base/BUILD.gn b/build/chromium_compatibility/base/BUILD.gn new file mode 100644 index 00000000..f00a51c2 --- /dev/null +++ b/build/chromium_compatibility/base/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +# This target is a stub so that both Crashpad and Chromium can refer to "//base" +# in their build files. When building in the Chromium tree, "//base" will refer +# the "real" base, but when building standalone in Crashpad, we forward those +# references on to mini_chromium. + +group("base") { + public_configs = + [ "//third_party/mini_chromium/mini_chromium/base:base_public_config" ] + public_deps = [ + "//third_party/mini_chromium/mini_chromium/base", + ] +} diff --git a/build/chromium_compatibility/base/test/BUILD.gn b/build/chromium_compatibility/base/test/BUILD.gn new file mode 100644 index 00000000..5bc810a0 --- /dev/null +++ b/build/chromium_compatibility/base/test/BUILD.gn @@ -0,0 +1,19 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +# This is a stub to match Chromium. This target is unused and has no effect when +# building standalone in Crashpad. + +group("test_support") { +} diff --git a/build/chromium_compatibility/build/config/compiler/BUILD.gn b/build/chromium_compatibility/build/config/compiler/BUILD.gn new file mode 100644 index 00000000..9d4d2e14 --- /dev/null +++ b/build/chromium_compatibility/build/config/compiler/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +# This is a stub to match Chromium. The configs in this file do not have any +# effect on the build when building standalone in Crashpad. + +config("default_symbols") { +} + +config("minimal_symbols") { +} + +config("chromium_code") { +} + +config("no_chromium_code") { +} diff --git a/build/chromium_compatibility/build/config/compiler/compiler.gni b/build/chromium_compatibility/build/config/compiler/compiler.gni new file mode 100644 index 00000000..f615259a --- /dev/null +++ b/build/chromium_compatibility/build/config/compiler/compiler.gni @@ -0,0 +1,16 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +# This is a stub to match Chromium, but is unused when building standalone in +# Crashpad. diff --git a/build/chromium_compatibility/build/win/BUILD.gn b/build/chromium_compatibility/build/win/BUILD.gn new file mode 100644 index 00000000..3bf730e4 --- /dev/null +++ b/build/chromium_compatibility/build/win/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +# This is a stub to match Chromium. The configs in this file do not have any +# effect on the build when building standalone in Crashpad. + +group("default_exe_manifest") { +} + +config("console") { +} + +config("windowed") { +} diff --git a/build/chromium_compatibility/testing/gmock/BUILD.gn b/build/chromium_compatibility/testing/gmock/BUILD.gn new file mode 100644 index 00000000..81001042 --- /dev/null +++ b/build/chromium_compatibility/testing/gmock/BUILD.gn @@ -0,0 +1,19 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +# TODO(GN): This is a placeholder that matches the name of Chromium's location +# for this file. It will need to be filled out to cause a gmock dependency. + +group("gmock") { +} diff --git a/build/chromium_compatibility/testing/gtest/BUILD.gn b/build/chromium_compatibility/testing/gtest/BUILD.gn new file mode 100644 index 00000000..03d30464 --- /dev/null +++ b/build/chromium_compatibility/testing/gtest/BUILD.gn @@ -0,0 +1,19 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +# TODO(GN): This is a placeholder that matches the name of Chromium's location +# for this file. It will need to be filled out to cause a gtest dependency. + +group("gtest") { +} diff --git a/build/chromium_compatibility/testing/test.gni b/build/chromium_compatibility/testing/test.gni new file mode 100644 index 00000000..b94470dc --- /dev/null +++ b/build/chromium_compatibility/testing/test.gni @@ -0,0 +1,22 @@ +# Copyright 2017 The Crashpad Authors. All rights reserved. +# +# 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. + +template("test") { + executable(target_name) { + deps = [] + forward_variables_from(invoker, "*") + + testonly = true + } +} diff --git a/client/BUILD.gn b/client/BUILD.gn index 3e24d6dd..2fa7110b 100644 --- a/client/BUILD.gn +++ b/client/BUILD.gn @@ -48,12 +48,12 @@ static_library("client") { ] } - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] deps = [ + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] if (is_win) { @@ -88,20 +88,19 @@ source_set("client_test") { deps = [ ":client", + "../compat", + "../test", + "../util", "//base", "//testing/gmock", "//testing/gtest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/test", - "//third_party/crashpad/crashpad/util", ] data_deps = [ - "//third_party/crashpad/crashpad/handler:crashpad_handler", + "../handler:crashpad_handler", ] if (is_win) { - data_deps += - [ "//third_party/crashpad/crashpad/handler:crashpad_handler_console" ] + data_deps += [ "../handler:crashpad_handler_console" ] } } diff --git a/compat/BUILD.gn b/compat/BUILD.gn index ddeb53d7..0903e795 100644 --- a/compat/BUILD.gn +++ b/compat/BUILD.gn @@ -68,7 +68,7 @@ static_library("compat") { public_configs = [ ":compat_config", - "//third_party/crashpad/crashpad:crashpad_config", + "..:crashpad_config", ] deps = [] diff --git a/handler/BUILD.gn b/handler/BUILD.gn index 2c17f3d9..05f554b7 100644 --- a/handler/BUILD.gn +++ b/handler/BUILD.gn @@ -20,32 +20,42 @@ static_library("handler") { "crash_report_upload_thread.h", "handler_main.cc", "handler_main.h", - "mac/crash_report_exception_handler.cc", - "mac/crash_report_exception_handler.h", - "mac/exception_handler_server.cc", - "mac/exception_handler_server.h", - "mac/file_limit_annotation.cc", - "mac/file_limit_annotation.h", "minidump_to_upload_parameters.cc", "minidump_to_upload_parameters.h", "prune_crash_reports_thread.cc", "prune_crash_reports_thread.h", "user_stream_data_source.cc", "user_stream_data_source.h", - "win/crash_report_exception_handler.cc", - "win/crash_report_exception_handler.h", ] - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + if (is_mac) { + sources += [ + "mac/crash_report_exception_handler.cc", + "mac/crash_report_exception_handler.h", + "mac/exception_handler_server.cc", + "mac/exception_handler_server.h", + "mac/file_limit_annotation.cc", + "mac/file_limit_annotation.h", + ] + } + + if (is_win) { + sources += [ + "win/crash_report_exception_handler.cc", + "win/crash_report_exception_handler.h", + ] + } + + public_configs = [ "..:crashpad_config" ] deps = [ + "../client", + "../compat", + "../minidump", + "../snapshot", + "../tools:tool_support", + "../util", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/minidump", - "//third_party/crashpad/crashpad/snapshot", - "//third_party/crashpad/crashpad/tools:tool_support", - "//third_party/crashpad/crashpad/util", ] if (is_win) { @@ -62,13 +72,13 @@ source_set("handler_test") { deps = [ ":handler", + "../client", + "../compat", + "../snapshot", + "../test", + "../util", "//base", "//testing/gtest", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/snapshot", - "//third_party/crashpad/crashpad/test", - "//third_party/crashpad/crashpad/util", ] if (is_win) { @@ -87,9 +97,9 @@ executable("crashpad_handler") { deps = [ ":handler", + "../compat", "//base", "//build/win:default_exe_manifest", - "//third_party/crashpad/crashpad/compat", ] if (is_mac && is_component_build) { @@ -123,11 +133,11 @@ executable("crashpad_handler_test_extended_handler") { deps = [ ":handler", + "../compat", + "../minidump:test_support", + "../tools:tool_support", "//base", "//build/win:default_exe_manifest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/minidump:test_support", - "//third_party/crashpad/crashpad/tools:tool_support", ] } @@ -144,9 +154,9 @@ if (is_win) { deps = [ ":handler", + "../compat", "//base", "//build/win:default_exe_manifest", - "//third_party/crashpad/crashpad/compat", ] } diff --git a/minidump/BUILD.gn b/minidump/BUILD.gn index 42f8c3e1..a3c6a2c9 100644 --- a/minidump/BUILD.gn +++ b/minidump/BUILD.gn @@ -69,16 +69,16 @@ static_library("minidump") { "minidump_writer_util.h", ] - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] public_deps = [ - "//third_party/crashpad/crashpad/compat", + "../compat", ] deps = [ + "../snapshot", + "../util", "//base", - "//third_party/crashpad/crashpad/snapshot", - "//third_party/crashpad/crashpad/util", ] if (is_win) { @@ -111,7 +111,7 @@ static_library("test_support") { "test/minidump_writable_test_util.h", ] - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] public_deps = [ ":minidump", @@ -156,11 +156,11 @@ source_set("minidump_test") { deps = [ ":test_support", + "../snapshot:test_support", + "../test", + "../util", "//base", "//testing/gtest", - "//third_party/crashpad/crashpad/snapshot:test_support", - "//third_party/crashpad/crashpad/test", - "//third_party/crashpad/crashpad/util", ] if (is_win) { diff --git a/snapshot/BUILD.gn b/snapshot/BUILD.gn index 49402fe9..2b01fc20 100644 --- a/snapshot/BUILD.gn +++ b/snapshot/BUILD.gn @@ -125,13 +125,13 @@ static_library("snapshot") { ] } - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] deps = [ + "../client", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] if (is_win) { @@ -147,15 +147,15 @@ if (is_win) { "api/module_annotations_win.h", ] - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] cflags = [ "/wd4201" ] deps = [ ":snapshot", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } } else { @@ -185,16 +185,16 @@ static_library("test_support") { "test/test_thread_snapshot.h", ] - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] public_deps = [ ":snapshot", ] deps = [ + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] if (is_win) { @@ -235,12 +235,12 @@ source_set("snapshot_test") { deps = [ ":snapshot_api", ":test_support", + "../client", + "../compat", + "../test", + "../util", "//base", "//testing/gtest", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/test", - "//third_party/crashpad/crashpad/util", ] data_deps = [ @@ -278,8 +278,8 @@ loadable_module("crashpad_snapshot_test_module") { "crashpad_info_client_options_test_module.cc", ] deps = [ + "../client", "//base", - "//third_party/crashpad/crashpad/client", ] } @@ -328,9 +328,9 @@ if (is_win) { "win/crashpad_snapshot_test_annotations.cc", ] deps = [ + "../client", + "../compat", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", ] } @@ -340,10 +340,10 @@ if (is_win) { "win/crashpad_snapshot_test_crashing_child.cc", ] deps = [ + "../client", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } @@ -353,10 +353,10 @@ if (is_win) { "win/crashpad_snapshot_test_dump_without_crashing.cc", ] deps = [ + "../client", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } @@ -366,9 +366,9 @@ if (is_win) { "win/crashpad_snapshot_test_extra_memory_ranges.cc", ] deps = [ + "../client", + "../compat", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", ] } @@ -378,10 +378,10 @@ if (is_win) { "win/crashpad_snapshot_test_image_reader.cc", ] deps = [ + "../client", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] if (symbol_level == 0) { # The tests that use this executable rely on at least minimal debug info. @@ -396,8 +396,8 @@ if (is_win) { "win/crashpad_snapshot_test_image_reader_module.cc", ] deps = [ + "../client", "//base", - "//third_party/crashpad/crashpad/client", ] if (symbol_level == 0) { # The tests that use this module rely on at least minimal debug info. diff --git a/snapshot/test/BUILD.gn b/snapshot/test/BUILD.gn deleted file mode 100644 index 5b9b745f..00000000 --- a/snapshot/test/BUILD.gn +++ /dev/null @@ -1,155 +0,0 @@ -# Copyright 2017 The Crashpad Authors. All rights reserved. -# -# 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. - -import("//testing/test.gni") - -static_library("test") { - testonly = true - - sources = [ - "errors.cc", - "errors.h", - "file.cc", - "file.h", - "filesystem.cc", - "filesystem.h", - "gtest_death_check.h", - "gtest_disabled.cc", - "gtest_disabled.h", - "hex_string.cc", - "hex_string.h", - "mac/dyld.cc", - "mac/dyld.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", - "multiprocess_exec.h", - "multiprocess_exec_posix.cc", - "multiprocess_exec_win.cc", - "multiprocess_posix.cc", - "scoped_module_handle.cc", - "scoped_module_handle.h", - "scoped_temp_dir.cc", - "scoped_temp_dir.h", - "scoped_temp_dir_posix.cc", - "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", - ] - - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] - - defines = [ "CRASHPAD_IN_CHROMIUM" ] - - data = [ - "test_paths_test_data_root.txt", - ] - - deps = [ - "//base", - "//testing/gtest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/snapshot", - "//third_party/crashpad/crashpad/util", - ] - - if (is_mac) { - libs = [ "bsm" ] - } -} - -source_set("test_test") { - testonly = true - - 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) { - sources += [ "multiprocess_posix_test.cc" ] - } - - deps = [ - ":test", - "//base", - "//testing/gmock", - "//testing/gtest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", - ] - - data_deps = [ - ":crashpad_test_test_multiprocess_exec_test_child", - ] -} - -executable("crashpad_test_test_multiprocess_exec_test_child") { - sources = [ - "multiprocess_exec_test_child.cc", - ] -} - -static_library("gmock_main") { - testonly = true - sources = [ - "gtest_main.cc", - ] - defines = [ - "CRASHPAD_IN_CHROMIUM", - "CRASHPAD_TEST_LAUNCHER_GMOCK", - ] - deps = [ - ":test", - "//base", - "//base/test:test_support", - "//testing/gmock", - "//testing/gtest", - ] -} - -static_library("gtest_main") { - testonly = true - sources = [ - "gtest_main.cc", - ] - defines = [ - "CRASHPAD_IN_CHROMIUM", - "CRASHPAD_TEST_LAUNCHER_GTEST", - ] - deps = [ - ":test", - "//base", - "//base/test:test_support", - "//testing/gtest", - ] -} diff --git a/test/BUILD.gn b/test/BUILD.gn index c3208ad6..50f0c81f 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -62,7 +62,7 @@ static_library("test") { "win/win_multiprocess_with_temp_dir.h", ] - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] defines = [ "CRASHPAD_IN_CHROMIUM" ] @@ -71,11 +71,11 @@ static_library("test") { ] deps = [ + "../compat", + "../snapshot", + "../util", "//base", "//testing/gtest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/snapshot", - "//third_party/crashpad/crashpad/util", ] if (is_mac) { @@ -104,11 +104,11 @@ source_set("test_test") { deps = [ ":test", + "../compat", + "../util", "//base", "//testing/gmock", "//testing/gtest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] data_deps = [ diff --git a/tools/BUILD.gn b/tools/BUILD.gn index e2a82d39..af02e66c 100644 --- a/tools/BUILD.gn +++ b/tools/BUILD.gn @@ -18,7 +18,7 @@ source_set("tool_support") { "tool_support.h", ] - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] deps = [ "//base", @@ -32,11 +32,11 @@ executable("crashpad_database_util") { deps = [ ":tool_support", + "../client", + "../compat", + "../util", "//base", "//build/win:default_exe_manifest", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } @@ -47,10 +47,10 @@ executable("crashpad_http_upload") { deps = [ ":tool_support", + "../compat", + "../util", "//base", "//build/win:default_exe_manifest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } @@ -61,12 +61,12 @@ executable("generate_dump") { deps = [ ":tool_support", + "../compat", + "../minidump", + "../snapshot", + "../util", "//base", "//build/win:default_exe_manifest", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/minidump", - "//third_party/crashpad/crashpad/snapshot", - "//third_party/crashpad/crashpad/util", ] if (is_mac) { @@ -96,9 +96,9 @@ if (is_mac) { deps = [ ":tool_support", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } @@ -121,9 +121,9 @@ if (is_mac) { deps = [ ":tool_support", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } @@ -139,9 +139,9 @@ if (is_mac) { deps = [ ":tool_support", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } @@ -152,10 +152,10 @@ if (is_mac) { deps = [ ":tool_support", + "../client", + "../compat", + "../util", "//base", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/util", ] } } diff --git a/util/BUILD.gn b/util/BUILD.gn index 34b30361..7f8e7ecc 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/config/sanitizers/sanitizers.gni") -import("//build/toolchain/toolchain.gni") import("//testing/test.gni") if (is_mac) { @@ -61,11 +59,9 @@ static_library("util") { "file/delimited_file_reader.h", "file/directory_reader.h", "file/directory_reader_posix.cc", - "file/directory_reader_win.cc", "file/file_io.cc", "file/file_io.h", "file/file_io_posix.cc", - "file/file_io_win.cc", "file/file_reader.cc", "file/file_reader.h", "file/file_seeker.cc", @@ -74,28 +70,16 @@ static_library("util") { "file/file_writer.h", "file/filesystem.h", "file/filesystem_posix.cc", - "file/filesystem_win.cc", "file/scoped_remove_file.cc", "file/scoped_remove_file.h", "file/string_file.cc", "file/string_file.h", - "mac/checked_mach_address_range.h", - "mac/launchd.h", - "mac/launchd.mm", - "mac/mac_util.cc", - "mac/mac_util.h", - "mac/service_management.cc", - "mac/service_management.h", - "mac/xattr.cc", - "mac/xattr.h", "misc/address_sanitizer.h", "misc/address_types.h", "misc/arraysize_unsafe.h", "misc/as_underlying_type.h", "misc/clock.h", - "misc/clock_mac.cc", "misc/clock_posix.cc", - "misc/clock_win.cc", "misc/from_pointer_cast.h", "misc/implicit_cast.h", "misc/initialization_state.h", @@ -106,8 +90,6 @@ static_library("util") { "misc/metrics.cc", "misc/metrics.h", "misc/paths.h", - "misc/paths_mac.cc", - "misc/paths_win.cc", "misc/pdb_structures.cc", "misc/pdb_structures.h", "misc/random_string.cc", @@ -119,7 +101,6 @@ static_library("util") { "misc/symbolic_constants_common.h", "misc/time.cc", "misc/time.h", - "misc/time_win.cc", "misc/tri_state.h", "misc/uuid.cc", "misc/uuid.h", @@ -134,8 +115,6 @@ static_library("util") { "net/http_multipart_builder.h", "net/http_transport.cc", "net/http_transport.h", - "net/http_transport_mac.mm", - "net/http_transport_win.cc", "net/url.cc", "net/url.h", "numeric/checked_address_range.cc", @@ -154,7 +133,6 @@ static_library("util") { "posix/drop_privileges.cc", "posix/drop_privileges.h", "posix/process_info.h", - "posix/process_info_mac.cc", "posix/scoped_dir.cc", "posix/scoped_dir.h", "posix/scoped_mmap.cc", @@ -177,63 +155,27 @@ static_library("util") { "string/split_string.cc", "string/split_string.h", "synchronization/semaphore.h", - "synchronization/semaphore_mac.cc", "synchronization/semaphore_posix.cc", - "synchronization/semaphore_win.cc", "thread/thread.cc", "thread/thread.h", "thread/thread_log_messages.cc", "thread/thread_log_messages.h", "thread/thread_posix.cc", - "thread/thread_win.cc", "thread/worker_thread.cc", "thread/worker_thread.h", - "win/address_types.h", - "win/capture_context.h", - "win/checked_win_address_range.h", - "win/command_line.cc", - "win/command_line.h", - "win/critical_section_with_debug_info.cc", - "win/critical_section_with_debug_info.h", - "win/exception_handler_server.cc", - "win/exception_handler_server.h", - "win/get_function.cc", - "win/get_function.h", - "win/get_module_information.cc", - "win/get_module_information.h", - "win/handle.cc", - "win/handle.h", - "win/initial_client_data.cc", - "win/initial_client_data.h", - "win/module_version.cc", - "win/module_version.h", - "win/nt_internals.cc", - "win/nt_internals.h", - "win/ntstatus_logging.cc", - "win/ntstatus_logging.h", - "win/process_info.cc", - "win/process_info.h", - "win/process_structs.h", - "win/registration_protocol_win.cc", - "win/registration_protocol_win.h", - "win/safe_terminate_process.h", - "win/scoped_handle.cc", - "win/scoped_handle.h", - "win/scoped_local_alloc.cc", - "win/scoped_local_alloc.h", - "win/scoped_process_suspend.cc", - "win/scoped_process_suspend.h", - "win/scoped_set_event.cc", - "win/scoped_set_event.h", - "win/session_end_watcher.cc", - "win/session_end_watcher.h", - "win/termination_codes.h", - "win/xp_compat.h", ] if (is_mac) { - # mach/ are not globally filtered. sources += [ + "mac/checked_mach_address_range.h", + "mac/launchd.h", + "mac/launchd.mm", + "mac/mac_util.cc", + "mac/mac_util.h", + "mac/service_management.cc", + "mac/service_management.h", + "mac/xattr.cc", + "mac/xattr.h", "mach/child_port_handshake.cc", "mach/child_port_handshake.h", "mach/child_port_server.cc", @@ -267,14 +209,69 @@ static_library("util") { "mach/task_for_pid.h", "mach/task_memory.cc", "mach/task_memory.h", + "misc/clock_mac.cc", + "misc/paths_mac.cc", + "net/http_transport_mac.mm", + "posix/process_info_mac.cc", + "synchronization/semaphore_mac.cc", ] - } - - if (is_mac) { sources += get_target_outputs(":mig") } if (is_win) { + sources += [ + "file/directory_reader_win.cc", + "file/file_io_win.cc", + "file/filesystem_win.cc", + "misc/clock_win.cc", + "misc/paths_win.cc", + "misc/time_win.cc", + "net/http_transport_win.cc", + "synchronization/semaphore_win.cc", + "thread/thread_win.cc", + "win/address_types.h", + "win/capture_context.h", + "win/checked_win_address_range.h", + "win/command_line.cc", + "win/command_line.h", + "win/critical_section_with_debug_info.cc", + "win/critical_section_with_debug_info.h", + "win/exception_handler_server.cc", + "win/exception_handler_server.h", + "win/get_function.cc", + "win/get_function.h", + "win/get_module_information.cc", + "win/get_module_information.h", + "win/handle.cc", + "win/handle.h", + "win/initial_client_data.cc", + "win/initial_client_data.h", + "win/module_version.cc", + "win/module_version.h", + "win/nt_internals.cc", + "win/nt_internals.h", + "win/ntstatus_logging.cc", + "win/ntstatus_logging.h", + "win/process_info.cc", + "win/process_info.h", + "win/process_structs.h", + "win/registration_protocol_win.cc", + "win/registration_protocol_win.h", + "win/safe_terminate_process.h", + "win/scoped_handle.cc", + "win/scoped_handle.h", + "win/scoped_local_alloc.cc", + "win/scoped_local_alloc.h", + "win/scoped_process_suspend.cc", + "win/scoped_process_suspend.h", + "win/scoped_set_event.cc", + "win/scoped_set_event.h", + "win/session_end_watcher.cc", + "win/session_end_watcher.h", + "win/termination_codes.h", + "win/xp_compat.h", + ] + # There's no ml.exe yet in cross builds, so provide broken-but-not-asm # versions of the functions defined in .asm files. # @@ -298,18 +295,20 @@ static_library("util") { } } - public_configs = [ "//third_party/crashpad/crashpad:crashpad_config" ] + public_configs = [ "..:crashpad_config" ] # Include files from here and generated files starting with "util". include_dirs = [ "$root_gen_dir/third_party/crashpad/crashpad" ] public_deps = [ - "//third_party/crashpad/crashpad/compat", + "../compat", ] deps = [ "//base", - "//third_party/crashpad/crashpad/third_party/zlib", + + # TODO(GN): Should this point at Chromium's zlib when in Chromium? + "../third_party/zlib", ] if (is_mac) { @@ -345,10 +344,6 @@ source_set("util_test") { "file/file_reader_test.cc", "file/filesystem_test.cc", "file/string_file_test.cc", - "mac/launchd_test.mm", - "mac/mac_util_test.mm", - "mac/service_management_test.mm", - "mac/xattr_test.cc", "misc/arraysize_unsafe_test.cc", "misc/clock_test.cc", "misc/from_pointer_cast_test.cc", @@ -386,23 +381,14 @@ source_set("util_test") { "thread/thread_log_messages_test.cc", "thread/thread_test.cc", "thread/worker_thread_test.cc", - "win/capture_context_test.cc", - "win/command_line_test.cc", - "win/critical_section_with_debug_info_test.cc", - "win/exception_handler_server_test.cc", - "win/get_function_test.cc", - "win/handle_test.cc", - "win/initial_client_data_test.cc", - "win/process_info_test.cc", - "win/registration_protocol_win_test.cc", - "win/safe_terminate_process_test.cc", - "win/scoped_process_suspend_test.cc", - "win/session_end_watcher_test.cc", ] if (is_mac) { - # mach/ are not globally filtered. sources += [ + "mac/launchd_test.mm", + "mac/mac_util_test.mm", + "mac/service_management_test.mm", + "mac/xattr_test.cc", "mach/child_port_handshake_test.cc", "mach/child_port_server_test.cc", "mach/composite_mach_message_server_test.cc", @@ -421,6 +407,23 @@ source_set("util_test") { ] } + if (is_win) { + sources += [ + "win/capture_context_test.cc", + "win/command_line_test.cc", + "win/critical_section_with_debug_info_test.cc", + "win/exception_handler_server_test.cc", + "win/get_function_test.cc", + "win/handle_test.cc", + "win/initial_client_data_test.cc", + "win/process_info_test.cc", + "win/registration_protocol_win_test.cc", + "win/safe_terminate_process_test.cc", + "win/scoped_process_suspend_test.cc", + "win/session_end_watcher_test.cc", + ] + } + data = [ "net/http_transport_test_server.py", "net/testdata/", @@ -428,13 +431,13 @@ source_set("util_test") { deps = [ ":util", + "../client", + "../compat", + "../test", + "../third_party/zlib", "//base", "//testing/gmock", "//testing/gtest", - "//third_party/crashpad/crashpad/client", - "//third_party/crashpad/crashpad/compat", - "//third_party/crashpad/crashpad/test", - "//third_party/crashpad/crashpad/third_party/zlib", ] if (is_mac) {