From 457cc6a34fde6ed6ef87edb92da5a7ae139fdf4a Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Mon, 18 Dec 2017 14:35:55 -0800 Subject: [PATCH] gn: Refactor build files to avoid build/secondary In doing standalone bringup of Crashpad targeting Fuchsia, it seemed tidy to keep the same literal paths to the dependencies that Chromium needed and add stubs/forwarding to build/secondary in the Crashpad tree as required to make those work. However, when trying to build Crashpad in the Fuchsia tree itself, that would require adding forwarding files to the Fuchsia tree to match the Chromium directory structure, which would be awkward. Instead, have explicit dependencies in the Crashpad tree that select the locations for various dependencies. Bug: crashpad:79, crashpad:196 Change-Id: Ib506839f9c97d8ef823663cdc733cbdcfa126139 Reviewed-on: https://chromium-review.googlesource.com/826025 Commit-Queue: Scott Graham Reviewed-by: Mark Mentovai --- .gn | 4 - BUILD.gn | 5 +- build/BUILD.gn | 16 +- build/BUILDCONFIG.gn | 4 - build/chromium_compatibility/README.crashpad | 5 - .../chromium_compatibility/base/test/BUILD.gn | 19 - .../build/config/compiler/BUILD.gn | 28 - .../build/config/compiler/compiler.gni | 16 - .../build/config/sysroot.gni | 22 - .../chromium_compatibility/build/win/BUILD.gn | 25 - .../testing/gmock/BUILD.gn | 23 - .../testing/gtest/BUILD.gn | 23 - build/chromium_compatibility/testing/test.gni | 24 - build/crashpad_dependencies.gni | 43 ++ build/crashpad_in_chromium.gni | 17 - client/BUILD.gn | 10 +- handler/BUILD.gn | 20 +- minidump/BUILD.gn | 12 +- snapshot/BUILD.gn | 35 +- test/BUILD.gn | 32 +- test/gtest_main.cc | 8 +- test/test_paths.cc | 10 +- third_party/gtest/BUILD.gn | 686 +++++++++--------- .../mini_chromium}/BUILD.gn | 31 +- third_party/zlib/BUILD.gn | 4 +- tools/BUILD.gn | 22 +- util/BUILD.gn | 30 +- 27 files changed, 523 insertions(+), 651 deletions(-) delete mode 100644 build/chromium_compatibility/README.crashpad delete mode 100644 build/chromium_compatibility/base/test/BUILD.gn delete mode 100644 build/chromium_compatibility/build/config/compiler/BUILD.gn delete mode 100644 build/chromium_compatibility/build/config/compiler/compiler.gni delete mode 100644 build/chromium_compatibility/build/config/sysroot.gni delete mode 100644 build/chromium_compatibility/build/win/BUILD.gn delete mode 100644 build/chromium_compatibility/testing/gmock/BUILD.gn delete mode 100644 build/chromium_compatibility/testing/gtest/BUILD.gn delete mode 100644 build/chromium_compatibility/testing/test.gni create mode 100644 build/crashpad_dependencies.gni delete mode 100644 build/crashpad_in_chromium.gni rename {build/chromium_compatibility/base => third_party/mini_chromium}/BUILD.gn (56%) diff --git a/.gn b/.gn index 304422da..d447a553 100644 --- a/.gn +++ b/.gn @@ -13,7 +13,3 @@ # 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 6ca07512..e3d23173 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,14 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//testing/test.gni") -import("build/crashpad_in_chromium.gni") +import("build/crashpad_dependencies.gni") config("crashpad_config") { include_dirs = [ "." ] } -if (crashpad_in_chromium) { +if (crashpad_is_in_chromium) { test("crashpad_tests") { deps = [ "client:client_test", diff --git a/build/BUILD.gn b/build/BUILD.gn index e60cd0c6..c55c7b78 100644 --- a/build/BUILD.gn +++ b/build/BUILD.gn @@ -16,10 +16,18 @@ # whether code is being built standalone, or in Chromium, or potentially in some # other configutation. -import("crashpad_in_chromium.gni") +import("crashpad_dependencies.gni") -config("crashpad_in_chromium") { - if (crashpad_in_chromium) { - defines = [ "CRASHPAD_IN_CHROMIUM" ] +config("crashpad_is_in_chromium") { + if (crashpad_is_in_chromium) { + defines = [ "CRASHPAD_IS_IN_CHROMIUM" ] + } +} + +group("default_exe_manifest_win") { + if (crashpad_is_in_chromium) { + deps = [ + "//build/win:default_exe_manifest", + ] } } diff --git a/build/BUILDCONFIG.gn b/build/BUILDCONFIG.gn index 5ddabfd9..a033e823 100644 --- a/build/BUILDCONFIG.gn +++ b/build/BUILDCONFIG.gn @@ -65,10 +65,6 @@ if (is_win) { default_configs = [ "//third_party/mini_chromium/mini_chromium/build:default", "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", - - # 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", ] set_defaults("source_set") { diff --git a/build/chromium_compatibility/README.crashpad b/build/chromium_compatibility/README.crashpad deleted file mode 100644 index 9a3c1296..00000000 --- a/build/chromium_compatibility/README.crashpad +++ /dev/null @@ -1,5 +0,0 @@ -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/test/BUILD.gn b/build/chromium_compatibility/base/test/BUILD.gn deleted file mode 100644 index 5bc810a0..00000000 --- a/build/chromium_compatibility/base/test/BUILD.gn +++ /dev/null @@ -1,19 +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. - -# 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 deleted file mode 100644 index 9d4d2e14..00000000 --- a/build/chromium_compatibility/build/config/compiler/BUILD.gn +++ /dev/null @@ -1,28 +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. - -# 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 deleted file mode 100644 index f615259a..00000000 --- a/build/chromium_compatibility/build/config/compiler/compiler.gni +++ /dev/null @@ -1,16 +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. - -# This is a stub to match Chromium, but is unused when building standalone in -# Crashpad. diff --git a/build/chromium_compatibility/build/config/sysroot.gni b/build/chromium_compatibility/build/config/sysroot.gni deleted file mode 100644 index 49390dde..00000000 --- a/build/chromium_compatibility/build/config/sysroot.gni +++ /dev/null @@ -1,22 +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. - -# In Crashpad, sysroot.gni is in mini_chromium, forward to that one. -import("//third_party/mini_chromium/mini_chromium/build/sysroot.gni") - -# To avoid Chromium Mac hermetic toolchain paths without explicitly checking -# whether building in Chromium mode. -if (is_mac) { - use_system_xcode = true -} diff --git a/build/chromium_compatibility/build/win/BUILD.gn b/build/chromium_compatibility/build/win/BUILD.gn deleted file mode 100644 index 3bf730e4..00000000 --- a/build/chromium_compatibility/build/win/BUILD.gn +++ /dev/null @@ -1,25 +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. - -# 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 deleted file mode 100644 index 77c7f589..00000000 --- a/build/chromium_compatibility/testing/gmock/BUILD.gn +++ /dev/null @@ -1,23 +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. - -# This is a forwarding target to match the location that Chromium uses. - -group("gmock") { - testonly = true - public_configs = [ "//third_party/gtest:gmock_public_config" ] - public_deps = [ - "//third_party/gtest:gmock", - ] -} diff --git a/build/chromium_compatibility/testing/gtest/BUILD.gn b/build/chromium_compatibility/testing/gtest/BUILD.gn deleted file mode 100644 index 3dbb6729..00000000 --- a/build/chromium_compatibility/testing/gtest/BUILD.gn +++ /dev/null @@ -1,23 +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. - -# This is a forwarding target to match the location that Chromium uses. - -group("gtest") { - testonly = true - public_configs = [ "//third_party/gtest:gtest_public_config" ] - public_deps = [ - "//third_party/gtest:gtest", - ] -} diff --git a/build/chromium_compatibility/testing/test.gni b/build/chromium_compatibility/testing/test.gni deleted file mode 100644 index 4642c9d5..00000000 --- a/build/chromium_compatibility/testing/test.gni +++ /dev/null @@ -1,24 +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. - -template("test") { - executable(target_name) { - testonly = true - forward_variables_from(invoker, "*") - } -} - -set_defaults("test") { - configs = default_configs -} diff --git a/build/crashpad_dependencies.gni b/build/crashpad_dependencies.gni new file mode 100644 index 00000000..ae6e1196 --- /dev/null +++ b/build/crashpad_dependencies.gni @@ -0,0 +1,43 @@ +# 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. + +declare_args() { + # Determines various flavors of build configuration, and which concrete + # targets to use for dependencies. Valid values are "standalone", "chromium", + # and "fuchsia". + crashpad_dependencies = "standalone" +} + +assert( + crashpad_dependencies == "chromium" || crashpad_dependencies == "fuchsia" || + crashpad_dependencies == "standalone") + +crashpad_is_in_chromium = crashpad_dependencies == "chromium" +crashpad_is_in_fuchsia = crashpad_dependencies == "fuchsia" +crashpad_is_standalone = crashpad_dependencies == "standalone" + +if (crashpad_is_in_chromium) { + import("//testing/test.gni") +} else { + template("test") { + executable(target_name) { + testonly = true + forward_variables_from(invoker, "*") + } + } + + set_defaults("test") { + configs = default_configs + } +} diff --git a/build/crashpad_in_chromium.gni b/build/crashpad_in_chromium.gni deleted file mode 100644 index 568c52e7..00000000 --- a/build/crashpad_in_chromium.gni +++ /dev/null @@ -1,17 +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. - -declare_args() { - crashpad_in_chromium = false -} diff --git a/client/BUILD.gn b/client/BUILD.gn index bdff4cf8..8d8c79f4 100644 --- a/client/BUILD.gn +++ b/client/BUILD.gn @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//testing/test.gni") - static_library("client") { sources = [ "annotation.cc", @@ -64,8 +62,8 @@ static_library("client") { deps = [ "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] if (is_win) { @@ -102,10 +100,10 @@ source_set("client_test") { ":client", "../compat", "../test", + "../third_party/gtest:gmock", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", "../util", - "//base", - "//testing/gmock", - "//testing/gtest", ] data_deps = [ diff --git a/handler/BUILD.gn b/handler/BUILD.gn index 496f256e..1223110a 100644 --- a/handler/BUILD.gn +++ b/handler/BUILD.gn @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//testing/test.gni") - static_library("handler") { sources = [ "crash_report_upload_thread.cc", @@ -62,9 +60,9 @@ static_library("handler") { "../compat", "../minidump", "../snapshot", + "../third_party/mini_chromium:base", "../tools:tool_support", "../util", - "//base", ] if (is_win) { @@ -86,9 +84,9 @@ source_set("handler_test") { "../snapshot", "../snapshot:test_support", "../test", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", "../util", - "//base", - "//testing/gtest", ] if (is_win) { @@ -107,9 +105,9 @@ executable("crashpad_handler") { deps = [ ":handler", + "../build:default_exe_manifest_win", "../compat", - "//base", - "//build/win:default_exe_manifest", + "../third_party/mini_chromium:base", ] if (is_mac && is_component_build) { @@ -143,11 +141,11 @@ executable("crashpad_handler_test_extended_handler") { deps = [ ":handler", + "../build:default_exe_manifest_win", "../compat", "../minidump:test_support", + "../third_party/mini_chromium:base", "../tools:tool_support", - "//base", - "//build/win:default_exe_manifest", ] } @@ -164,9 +162,9 @@ if (is_win) { deps = [ ":handler", + "../build:default_exe_manifest_win", "../compat", - "//base", - "//build/win:default_exe_manifest", + "../third_party/mini_chromium:base", ] } diff --git a/minidump/BUILD.gn b/minidump/BUILD.gn index a3c6a2c9..7a51a49a 100644 --- a/minidump/BUILD.gn +++ b/minidump/BUILD.gn @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//testing/test.gni") - static_library("minidump") { sources = [ "minidump_annotation_writer.cc", @@ -77,8 +75,8 @@ static_library("minidump") { deps = [ "../snapshot", + "../third_party/mini_chromium:base", "../util", - "//base", ] if (is_win) { @@ -118,8 +116,8 @@ static_library("test_support") { ] deps = [ - "//base", - "//testing/gtest", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", ] if (is_win) { @@ -158,9 +156,9 @@ source_set("minidump_test") { ":test_support", "../snapshot:test_support", "../test", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", "../util", - "//base", - "//testing/gtest", ] if (is_win) { diff --git a/snapshot/BUILD.gn b/snapshot/BUILD.gn index c5d38f16..5e9a9314 100644 --- a/snapshot/BUILD.gn +++ b/snapshot/BUILD.gn @@ -12,8 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/config/compiler/compiler.gni") -import("//testing/test.gni") +import("../build/crashpad_dependencies.gni") static_library("snapshot") { sources = [ @@ -147,8 +146,8 @@ static_library("snapshot") { deps = [ "../client", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] if (is_win) { @@ -171,8 +170,8 @@ if (is_win) { deps = [ ":snapshot", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] } } else { @@ -210,8 +209,8 @@ static_library("test_support") { deps = [ "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] if (is_win) { @@ -262,9 +261,9 @@ source_set("snapshot_test") { "../client", "../compat", "../test", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", "../util", - "//base", - "//testing/gtest", ] data_deps = [ @@ -303,7 +302,7 @@ loadable_module("crashpad_snapshot_test_module") { ] deps = [ "../client", - "//base", + "../third_party/mini_chromium:base", ] } @@ -314,7 +313,7 @@ loadable_module("crashpad_snapshot_test_module_large") { ] defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_LARGE" ] deps = [ - "//base", + "../third_party/mini_chromium:base", ] } @@ -325,7 +324,7 @@ loadable_module("crashpad_snapshot_test_module_small") { ] defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_SMALL" ] deps = [ - "//base", + "../third_party/mini_chromium:base", ] } @@ -354,7 +353,7 @@ if (is_win) { deps = [ "../client", "../compat", - "//base", + "../third_party/mini_chromium:base", ] } @@ -366,8 +365,8 @@ if (is_win) { deps = [ "../client", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] } @@ -379,8 +378,8 @@ if (is_win) { deps = [ "../client", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] } @@ -392,7 +391,7 @@ if (is_win) { deps = [ "../client", "../compat", - "//base", + "../third_party/mini_chromium:base", ] } @@ -404,10 +403,10 @@ if (is_win) { deps = [ "../client", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] - if (symbol_level == 0) { + if (crashpad_is_in_chromium && symbol_level == 0) { # The tests that use this executable rely on at least minimal debug info. configs -= [ "//build/config/compiler:default_symbols" ] configs += [ "//build/config/compiler:minimal_symbols" ] @@ -421,9 +420,9 @@ if (is_win) { ] deps = [ "../client", - "//base", + "../third_party/mini_chromium:base", ] - if (symbol_level == 0) { + if (crashpad_is_in_chromium && symbol_level == 0) { # The tests that use this module rely on at least minimal debug info. configs -= [ "//build/config/compiler:default_symbols" ] configs += [ "//build/config/compiler:minimal_symbols" ] diff --git a/test/BUILD.gn b/test/BUILD.gn index ae44fc57..21948a72 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//testing/test.gni") - static_library("test") { testonly = true @@ -82,7 +80,7 @@ static_library("test") { public_configs = [ "..:crashpad_config" ] - configs += [ "../build:crashpad_in_chromium" ] + configs += [ "../build:crashpad_is_in_chromium" ] data = [ "test_paths_test_data_root.txt", @@ -90,9 +88,9 @@ static_library("test") { deps = [ "../compat", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", "../util", - "//base", - "//testing/gtest", ] if (is_mac) { @@ -140,10 +138,10 @@ source_set("test_test") { deps = [ ":test", "../compat", + "../third_party/gtest:gmock", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", "../util", - "//base", - "//testing/gmock", - "//testing/gtest", ] data_deps = [ @@ -162,14 +160,14 @@ static_library("gmock_main") { sources = [ "gtest_main.cc", ] - configs += [ "../build:crashpad_in_chromium" ] + configs += [ "../build:crashpad_is_in_chromium" ] defines = [ "CRASHPAD_TEST_LAUNCHER_GMOCK" ] deps = [ ":test", - "//base", - "//base/test:test_support", - "//testing/gmock", - "//testing/gtest", + "../third_party/gtest:gmock", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", + "../third_party/mini_chromium:base_test_support", ] } @@ -178,12 +176,12 @@ static_library("gtest_main") { sources = [ "gtest_main.cc", ] - configs += [ "../build:crashpad_in_chromium" ] + configs += [ "../build:crashpad_is_in_chromium" ] defines = [ "CRASHPAD_TEST_LAUNCHER_GTEST" ] deps = [ ":test", - "//base", - "//base/test:test_support", - "//testing/gtest", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", + "../third_party/mini_chromium:base_test_support", ] } diff --git a/test/gtest_main.cc b/test/gtest_main.cc index d8c2a904..5a3d7996 100644 --- a/test/gtest_main.cc +++ b/test/gtest_main.cc @@ -25,18 +25,18 @@ #include "test/win/win_child_process.h" #endif // OS_WIN -#if defined(CRASHPAD_IN_CHROMIUM) +#if defined(CRASHPAD_IS_IN_CHROMIUM) #include "base/bind.h" #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" -#endif // CRASHPAD_IN_CHROMIUM +#endif // CRASHPAD_IS_IN_CHROMIUM int main(int argc, char* argv[]) { crashpad::test::InitializeMainArguments(argc, argv); testing::AddGlobalTestEnvironment( crashpad::test::DisabledTestGtestEnvironment::Get()); -#if defined(CRASHPAD_IN_CHROMIUM) +#if defined(CRASHPAD_IS_IN_CHROMIUM) #if defined(OS_WIN) // Chromium’s test launcher interferes with WinMultiprocess-based tests. Allow @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); } -#endif // CRASHPAD_IN_CHROMIUM +#endif // CRASHPAD_IS_IN_CHROMIUM #if defined(CRASHPAD_TEST_LAUNCHER_GMOCK) testing::InitGoogleMock(&argc, argv); diff --git a/test/test_paths.cc b/test/test_paths.cc index 923d22f6..b3eee3c1 100644 --- a/test/test_paths.cc +++ b/test/test_paths.cc @@ -127,12 +127,12 @@ base::FilePath TestPaths::Executable() { // static base::FilePath TestPaths::ExpectedExecutableBasename( const base::FilePath::StringType& name) { -#if defined(CRASHPAD_IN_CHROMIUM) +#if defined(CRASHPAD_IS_IN_CHROMIUM) base::FilePath::StringType executable_name( FILE_PATH_LITERAL("crashpad_tests")); -#else // CRASHPAD_IN_CHROMIUM +#else // CRASHPAD_IS_IN_CHROMIUM base::FilePath::StringType executable_name(name); -#endif // CRASHPAD_IN_CHROMIUM +#endif // CRASHPAD_IS_IN_CHROMIUM #if defined(OS_WIN) executable_name += FILE_PATH_LITERAL(".exe"); @@ -170,9 +170,9 @@ base::FilePath TestPaths::BuildArtifact( base::FilePath::StringType test_name = FILE_PATH_LITERAL("crashpad_") + module + FILE_PATH_LITERAL("_test"); -#if !defined(CRASHPAD_IN_CHROMIUM) +#if !defined(CRASHPAD_IS_IN_CHROMIUM) CHECK(Executable().BaseName().RemoveFinalExtension().value() == test_name); -#endif // !CRASHPAD_IN_CHROMIUM +#endif // !CRASHPAD_IS_IN_CHROMIUM base::FilePath::StringType extension; switch (file_type) { diff --git a/third_party/gtest/BUILD.gn b/third_party/gtest/BUILD.gn index 86b0d0fb..bbb6e4c4 100644 --- a/third_party/gtest/BUILD.gn +++ b/third_party/gtest/BUILD.gn @@ -12,349 +12,371 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//testing/test.gni") +import("../../build/crashpad_dependencies.gni") -config("gtest_private_config") { - visibility = [ ":*" ] - include_dirs = [ "gtest/googletest" ] - defines = [ "GUNIT_NO_GOOGLE3=1" ] -} +if (crashpad_is_in_chromium) { + group("gtest") { + public_deps = [ + "//testing/gtest", + ] + } + group("gmock") { + public_deps = [ + "//testing/gmock", + ] + } +} else if (crashpad_is_in_fuchsia) { + # TODO(scottmg): Fuchsia doesn't have a third_party/gmock, and has a + # pre-gmock-integration gtest. + group("gtest") { + public_deps = [ + "//third_party/gtest", + ] + } +} else if (crashpad_is_standalone) { + config("gtest_private_config") { + visibility = [ ":*" ] + include_dirs = [ "gtest/googletest" ] + defines = [ "GUNIT_NO_GOOGLE3=1" ] + } -config("gtest_public_config") { - include_dirs = [ "gtest/googletest/include" ] -} + config("gtest_public_config") { + include_dirs = [ "gtest/googletest/include" ] + } -static_library("gtest") { - testonly = true - sources = [ - "gtest/googletest/include/gtest/gtest-death-test.h", - "gtest/googletest/include/gtest/gtest-message.h", - "gtest/googletest/include/gtest/gtest-param-test.h", - "gtest/googletest/include/gtest/gtest-printers.h", - "gtest/googletest/include/gtest/gtest-spi.h", - "gtest/googletest/include/gtest/gtest-test-part.h", - "gtest/googletest/include/gtest/gtest-typed-test.h", - "gtest/googletest/include/gtest/gtest.h", - "gtest/googletest/include/gtest/gtest_pred_impl.h", - "gtest/googletest/include/gtest/gtest_prod.h", - "gtest/googletest/include/gtest/internal/custom/gtest-port.h", - "gtest/googletest/include/gtest/internal/custom/gtest-printers.h", - "gtest/googletest/include/gtest/internal/custom/gtest.h", - "gtest/googletest/include/gtest/internal/gtest-death-test-internal.h", - "gtest/googletest/include/gtest/internal/gtest-filepath.h", - "gtest/googletest/include/gtest/internal/gtest-internal.h", - "gtest/googletest/include/gtest/internal/gtest-linked_ptr.h", - "gtest/googletest/include/gtest/internal/gtest-param-util-generated.h", - "gtest/googletest/include/gtest/internal/gtest-param-util.h", - "gtest/googletest/include/gtest/internal/gtest-port-arch.h", - "gtest/googletest/include/gtest/internal/gtest-port.h", - "gtest/googletest/include/gtest/internal/gtest-string.h", - "gtest/googletest/include/gtest/internal/gtest-tuple.h", - "gtest/googletest/include/gtest/internal/gtest-type-util.h", - "gtest/googletest/src/gtest-all.cc", - "gtest/googletest/src/gtest-death-test.cc", - "gtest/googletest/src/gtest-filepath.cc", - "gtest/googletest/src/gtest-internal-inl.h", - "gtest/googletest/src/gtest-port.cc", - "gtest/googletest/src/gtest-printers.cc", - "gtest/googletest/src/gtest-test-part.cc", - "gtest/googletest/src/gtest-typed-test.cc", - "gtest/googletest/src/gtest.cc", - ] - sources -= [ "gtest/googletest/src/gtest-all.cc" ] - public_configs = [ ":gtest_public_config" ] - configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] - configs += [ ":gtest_private_config" ] -} + static_library("gtest") { + testonly = true + sources = [ + "gtest/googletest/include/gtest/gtest-death-test.h", + "gtest/googletest/include/gtest/gtest-message.h", + "gtest/googletest/include/gtest/gtest-param-test.h", + "gtest/googletest/include/gtest/gtest-printers.h", + "gtest/googletest/include/gtest/gtest-spi.h", + "gtest/googletest/include/gtest/gtest-test-part.h", + "gtest/googletest/include/gtest/gtest-typed-test.h", + "gtest/googletest/include/gtest/gtest.h", + "gtest/googletest/include/gtest/gtest_pred_impl.h", + "gtest/googletest/include/gtest/gtest_prod.h", + "gtest/googletest/include/gtest/internal/custom/gtest-port.h", + "gtest/googletest/include/gtest/internal/custom/gtest-printers.h", + "gtest/googletest/include/gtest/internal/custom/gtest.h", + "gtest/googletest/include/gtest/internal/gtest-death-test-internal.h", + "gtest/googletest/include/gtest/internal/gtest-filepath.h", + "gtest/googletest/include/gtest/internal/gtest-internal.h", + "gtest/googletest/include/gtest/internal/gtest-linked_ptr.h", + "gtest/googletest/include/gtest/internal/gtest-param-util-generated.h", + "gtest/googletest/include/gtest/internal/gtest-param-util.h", + "gtest/googletest/include/gtest/internal/gtest-port-arch.h", + "gtest/googletest/include/gtest/internal/gtest-port.h", + "gtest/googletest/include/gtest/internal/gtest-string.h", + "gtest/googletest/include/gtest/internal/gtest-tuple.h", + "gtest/googletest/include/gtest/internal/gtest-type-util.h", + "gtest/googletest/src/gtest-all.cc", + "gtest/googletest/src/gtest-death-test.cc", + "gtest/googletest/src/gtest-filepath.cc", + "gtest/googletest/src/gtest-internal-inl.h", + "gtest/googletest/src/gtest-port.cc", + "gtest/googletest/src/gtest-printers.cc", + "gtest/googletest/src/gtest-test-part.cc", + "gtest/googletest/src/gtest-typed-test.cc", + "gtest/googletest/src/gtest.cc", + ] + sources -= [ "gtest/googletest/src/gtest-all.cc" ] + public_configs = [ ":gtest_public_config" ] + configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] + configs += [ ":gtest_private_config" ] + } -static_library("gtest_main") { - # Tests outside of this file should use ../../test:gtest_main instead. - visibility = [ ":*" ] + static_library("gtest_main") { + # Tests outside of this file should use ../../test:gtest_main instead. + visibility = [ ":*" ] - testonly = true - sources = [ - "gtest/googletest/src/gtest_main.cc", - ] - deps = [ - ":gtest", - ] -} + testonly = true + sources = [ + "gtest/googletest/src/gtest_main.cc", + ] + deps = [ + ":gtest", + ] + } -test("gtest_all_test") { - sources = [ - "gtest/googletest/test/gtest-death-test_test.cc", - "gtest/googletest/test/gtest-filepath_test.cc", - "gtest/googletest/test/gtest-linked_ptr_test.cc", - "gtest/googletest/test/gtest-message_test.cc", - "gtest/googletest/test/gtest-options_test.cc", - "gtest/googletest/test/gtest-port_test.cc", - "gtest/googletest/test/gtest-printers_test.cc", - "gtest/googletest/test/gtest-test-part_test.cc", - "gtest/googletest/test/gtest-typed-test2_test.cc", - "gtest/googletest/test/gtest-typed-test_test.cc", - "gtest/googletest/test/gtest-typed-test_test.h", - "gtest/googletest/test/gtest_main_unittest.cc", - "gtest/googletest/test/gtest_pred_impl_unittest.cc", - "gtest/googletest/test/gtest_prod_test.cc", - "gtest/googletest/test/gtest_unittest.cc", - "gtest/googletest/test/production.cc", - "gtest/googletest/test/production.h", - ] - configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] - configs += [ ":gtest_private_config" ] - deps = [ - ":gtest", - ":gtest_main", - ] -} + test("gtest_all_test") { + sources = [ + "gtest/googletest/test/gtest-death-test_test.cc", + "gtest/googletest/test/gtest-filepath_test.cc", + "gtest/googletest/test/gtest-linked_ptr_test.cc", + "gtest/googletest/test/gtest-message_test.cc", + "gtest/googletest/test/gtest-options_test.cc", + "gtest/googletest/test/gtest-port_test.cc", + "gtest/googletest/test/gtest-printers_test.cc", + "gtest/googletest/test/gtest-test-part_test.cc", + "gtest/googletest/test/gtest-typed-test2_test.cc", + "gtest/googletest/test/gtest-typed-test_test.cc", + "gtest/googletest/test/gtest-typed-test_test.h", + "gtest/googletest/test/gtest_main_unittest.cc", + "gtest/googletest/test/gtest_pred_impl_unittest.cc", + "gtest/googletest/test/gtest_prod_test.cc", + "gtest/googletest/test/gtest_unittest.cc", + "gtest/googletest/test/production.cc", + "gtest/googletest/test/production.h", + ] + configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] + configs += [ ":gtest_private_config" ] + deps = [ + ":gtest", + ":gtest_main", + ] + } -test("gtest_environment_test") { - sources = [ - "gtest/googletest/test/gtest_environment_test.cc", - ] - configs += [ ":gtest_private_config" ] - deps = [ - ":gtest", - ] -} + test("gtest_environment_test") { + sources = [ + "gtest/googletest/test/gtest_environment_test.cc", + ] + configs += [ ":gtest_private_config" ] + deps = [ + ":gtest", + ] + } -test("gtest_listener_test") { - sources = [ - "gtest/googletest/test/gtest-listener_test.cc", - ] - deps = [ - ":gtest", - ] -} + test("gtest_listener_test") { + sources = [ + "gtest/googletest/test/gtest-listener_test.cc", + ] + deps = [ + ":gtest", + ] + } -test("gtest_no_test") { - sources = [ - "gtest/googletest/test/gtest_no_test_unittest.cc", - ] - deps = [ - ":gtest", - ] -} + test("gtest_no_test") { + sources = [ + "gtest/googletest/test/gtest_no_test_unittest.cc", + ] + deps = [ + ":gtest", + ] + } -test("gtest_param_test") { - sources = [ - "gtest/googletest/test/gtest-param-test2_test.cc", - "gtest/googletest/test/gtest-param-test_test.cc", - "gtest/googletest/test/gtest-param-test_test.h", - ] - configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] - configs += [ ":gtest_private_config" ] - deps = [ - ":gtest", - ] + test("gtest_param_test") { + sources = [ + "gtest/googletest/test/gtest-param-test2_test.cc", + "gtest/googletest/test/gtest-param-test_test.cc", + "gtest/googletest/test/gtest-param-test_test.h", + ] + configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] + configs += [ ":gtest_private_config" ] + deps = [ + ":gtest", + ] - if (is_clang) { - cflags_cc = [ - # For gtest/googlemock/test/gmock-matchers_test.cc’s Unstreamable::value_. - "-Wno-unused-private-field", + if (is_clang) { + cflags_cc = [ + # For gtest/googlemock/test/gmock-matchers_test.cc’s + # Unstreamable::value_. + "-Wno-unused-private-field", + ] + } + } + + test("gtest_premature_exit_test") { + sources = [ + "gtest/googletest/test/gtest_premature_exit_test.cc", + ] + deps = [ + ":gtest", + ] + } + + test("gtest_repeat_test") { + sources = [ + "gtest/googletest/test/gtest_repeat_test.cc", + ] + configs += [ ":gtest_private_config" ] + deps = [ + ":gtest", + ] + } + + test("gtest_sole_header_test") { + sources = [ + "gtest/googletest/test/gtest_sole_header_test.cc", + ] + deps = [ + ":gtest", + ":gtest_main", + ] + } + + test("gtest_stress_test") { + sources = [ + "gtest/googletest/test/gtest_stress_test.cc", + ] + configs += [ ":gtest_private_config" ] + deps = [ + ":gtest", + ] + } + + test("gtest_unittest_api_test") { + sources = [ + "gtest/googletest/test/gtest-unittest-api_test.cc", + ] + deps = [ + ":gtest", + ] + } + + group("gtest_all_tests") { + testonly = true + deps = [ + ":gtest_all_test", + ":gtest_environment_test", + ":gtest_listener_test", + ":gtest_no_test", + ":gtest_param_test", + ":gtest_premature_exit_test", + ":gtest_repeat_test", + ":gtest_sole_header_test", + ":gtest_stress_test", + ":gtest_unittest_api_test", + ] + } + + config("gmock_private_config") { + visibility = [ ":*" ] + include_dirs = [ "gtest/googlemock" ] + } + + config("gmock_public_config") { + include_dirs = [ "gtest/googlemock/include" ] + + if (is_clang) { + cflags_cc = [ + # The MOCK_METHODn() macros do not specify “override”, which triggers + # this warning in users: “error: 'Method' overrides a member function + # but is not marked 'override' + # [-Werror,-Winconsistent-missing-override]”. Suppress these warnings + # until https://github.com/google/googletest/issues/533 is fixed. + "-Wno-inconsistent-missing-override", + ] + } + } + + static_library("gmock") { + testonly = true + sources = [ + "gtest/googlemock/include/gmock/gmock-actions.h", + "gtest/googlemock/include/gmock/gmock-cardinalities.h", + "gtest/googlemock/include/gmock/gmock-generated-actions.h", + "gtest/googlemock/include/gmock/gmock-generated-function-mockers.h", + "gtest/googlemock/include/gmock/gmock-generated-matchers.h", + "gtest/googlemock/include/gmock/gmock-generated-nice-strict.h", + "gtest/googlemock/include/gmock/gmock-matchers.h", + "gtest/googlemock/include/gmock/gmock-more-actions.h", + "gtest/googlemock/include/gmock/gmock-more-matchers.h", + "gtest/googlemock/include/gmock/gmock-spec-builders.h", + "gtest/googlemock/include/gmock/gmock.h", + "gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h", + "gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h", + "gtest/googlemock/include/gmock/internal/custom/gmock-port.h", + "gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h", + "gtest/googlemock/include/gmock/internal/gmock-internal-utils.h", + "gtest/googlemock/include/gmock/internal/gmock-port.h", + "gtest/googlemock/src/gmock-all.cc", + "gtest/googlemock/src/gmock-cardinalities.cc", + "gtest/googlemock/src/gmock-internal-utils.cc", + "gtest/googlemock/src/gmock-matchers.cc", + "gtest/googlemock/src/gmock-spec-builders.cc", + "gtest/googlemock/src/gmock.cc", + ] + sources -= [ "gtest/googlemock/src/gmock-all.cc" ] + public_configs = [ ":gmock_public_config" ] + configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] + configs += [ ":gmock_private_config" ] + deps = [ + ":gtest", + ] + } + + static_library("gmock_main") { + # Tests outside of this file should use ../../test:gmock_main instead. + visibility = [ ":*" ] + testonly = true + sources = [ + "gtest/googlemock/src/gmock_main.cc", + ] + deps = [ + ":gmock", + ":gtest", + ] + } + + test("gmock_all_test") { + sources = [ + "gtest/googlemock/test/gmock-actions_test.cc", + "gtest/googlemock/test/gmock-cardinalities_test.cc", + "gtest/googlemock/test/gmock-generated-actions_test.cc", + "gtest/googlemock/test/gmock-generated-function-mockers_test.cc", + "gtest/googlemock/test/gmock-generated-internal-utils_test.cc", + "gtest/googlemock/test/gmock-generated-matchers_test.cc", + "gtest/googlemock/test/gmock-internal-utils_test.cc", + "gtest/googlemock/test/gmock-matchers_test.cc", + "gtest/googlemock/test/gmock-more-actions_test.cc", + "gtest/googlemock/test/gmock-nice-strict_test.cc", + "gtest/googlemock/test/gmock-port_test.cc", + "gtest/googlemock/test/gmock-spec-builders_test.cc", + "gtest/googlemock/test/gmock_test.cc", + ] + configs += [ + ":gmock_private_config", + ":gtest_private_config", + ] + deps = [ + ":gmock", + ":gmock_main", + ":gtest", + ] + + if (is_clang) { + cflags_cc = [ + # For gtest/googlemock/test/gmock-matchers_test.cc’s + # testing::gmock_matchers_test::Unprintable::c_. + "-Wno-unused-private-field", + ] + } + } + + test("gmock_link_test") { + sources = [ + "gtest/googlemock/test/gmock_link2_test.cc", + "gtest/googlemock/test/gmock_link_test.cc", + "gtest/googlemock/test/gmock_link_test.h", + ] + configs += [ ":gmock_private_config" ] + deps = [ + ":gmock", + ":gmock_main", + ":gtest", + ] + } + + test("gmock_stress_test") { + sources = [ + "gtest/googlemock/test/gmock_stress_test.cc", + ] + configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] + configs += [ ":gmock_private_config" ] + deps = [ + ":gmock", + ":gtest", + ] + } + + group("gmock_all_tests") { + testonly = true + deps = [ + ":gmock_all_test", + ":gmock_link_test", + ":gmock_stress_test", ] } } - -test("gtest_premature_exit_test") { - sources = [ - "gtest/googletest/test/gtest_premature_exit_test.cc", - ] - deps = [ - ":gtest", - ] -} - -test("gtest_repeat_test") { - sources = [ - "gtest/googletest/test/gtest_repeat_test.cc", - ] - configs += [ ":gtest_private_config" ] - deps = [ - ":gtest", - ] -} - -test("gtest_sole_header_test") { - sources = [ - "gtest/googletest/test/gtest_sole_header_test.cc", - ] - deps = [ - ":gtest", - ":gtest_main", - ] -} - -test("gtest_stress_test") { - sources = [ - "gtest/googletest/test/gtest_stress_test.cc", - ] - configs += [ ":gtest_private_config" ] - deps = [ - ":gtest", - ] -} - -test("gtest_unittest_api_test") { - sources = [ - "gtest/googletest/test/gtest-unittest-api_test.cc", - ] - deps = [ - ":gtest", - ] -} - -group("gtest_all_tests") { - testonly = true - deps = [ - ":gtest_all_test", - ":gtest_environment_test", - ":gtest_listener_test", - ":gtest_no_test", - ":gtest_param_test", - ":gtest_premature_exit_test", - ":gtest_repeat_test", - ":gtest_sole_header_test", - ":gtest_stress_test", - ":gtest_unittest_api_test", - ] -} - -config("gmock_private_config") { - visibility = [ ":*" ] - include_dirs = [ "gtest/googlemock" ] -} - -config("gmock_public_config") { - include_dirs = [ "gtest/googlemock/include" ] - - if (is_clang) { - cflags_cc = [ - # The MOCK_METHODn() macros do not specify “override”, which triggers this - # warning in users: “error: 'Method' overrides a member function but is - # not marked 'override' [-Werror,-Winconsistent-missing-override]”. - # Suppress these warnings until - # https://github.com/google/googletest/issues/533 is fixed. - "-Wno-inconsistent-missing-override", - ] - } -} - -static_library("gmock") { - testonly = true - sources = [ - "gtest/googlemock/include/gmock/gmock-actions.h", - "gtest/googlemock/include/gmock/gmock-cardinalities.h", - "gtest/googlemock/include/gmock/gmock-generated-actions.h", - "gtest/googlemock/include/gmock/gmock-generated-function-mockers.h", - "gtest/googlemock/include/gmock/gmock-generated-matchers.h", - "gtest/googlemock/include/gmock/gmock-generated-nice-strict.h", - "gtest/googlemock/include/gmock/gmock-matchers.h", - "gtest/googlemock/include/gmock/gmock-more-actions.h", - "gtest/googlemock/include/gmock/gmock-more-matchers.h", - "gtest/googlemock/include/gmock/gmock-spec-builders.h", - "gtest/googlemock/include/gmock/gmock.h", - "gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h", - "gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h", - "gtest/googlemock/include/gmock/internal/custom/gmock-port.h", - "gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h", - "gtest/googlemock/include/gmock/internal/gmock-internal-utils.h", - "gtest/googlemock/include/gmock/internal/gmock-port.h", - "gtest/googlemock/src/gmock-all.cc", - "gtest/googlemock/src/gmock-cardinalities.cc", - "gtest/googlemock/src/gmock-internal-utils.cc", - "gtest/googlemock/src/gmock-matchers.cc", - "gtest/googlemock/src/gmock-spec-builders.cc", - "gtest/googlemock/src/gmock.cc", - ] - sources -= [ "gtest/googlemock/src/gmock-all.cc" ] - public_configs = [ ":gmock_public_config" ] - configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] - configs += [ ":gmock_private_config" ] - deps = [ - ":gtest", - ] -} - -static_library("gmock_main") { - # Tests outside of this file should use ../../test:gmock_main instead. - visibility = [ ":*" ] - testonly = true - sources = [ - "gtest/googlemock/src/gmock_main.cc", - ] - deps = [ - ":gmock", - ":gtest", - ] -} - -test("gmock_all_test") { - sources = [ - "gtest/googlemock/test/gmock-actions_test.cc", - "gtest/googlemock/test/gmock-cardinalities_test.cc", - "gtest/googlemock/test/gmock-generated-actions_test.cc", - "gtest/googlemock/test/gmock-generated-function-mockers_test.cc", - "gtest/googlemock/test/gmock-generated-internal-utils_test.cc", - "gtest/googlemock/test/gmock-generated-matchers_test.cc", - "gtest/googlemock/test/gmock-internal-utils_test.cc", - "gtest/googlemock/test/gmock-matchers_test.cc", - "gtest/googlemock/test/gmock-more-actions_test.cc", - "gtest/googlemock/test/gmock-nice-strict_test.cc", - "gtest/googlemock/test/gmock-port_test.cc", - "gtest/googlemock/test/gmock-spec-builders_test.cc", - "gtest/googlemock/test/gmock_test.cc", - ] - configs += [ - ":gmock_private_config", - ":gtest_private_config", - ] - deps = [ - ":gmock", - ":gmock_main", - ":gtest", - ] - - if (is_clang) { - cflags_cc = [ - # For gtest/googlemock/test/gmock-matchers_test.cc’s - # testing::gmock_matchers_test::Unprintable::c_. - "-Wno-unused-private-field", - ] - } -} - -test("gmock_link_test") { - sources = [ - "gtest/googlemock/test/gmock_link2_test.cc", - "gtest/googlemock/test/gmock_link_test.cc", - "gtest/googlemock/test/gmock_link_test.h", - ] - configs += [ ":gmock_private_config" ] - deps = [ - ":gmock", - ":gmock_main", - ":gtest", - ] -} - -test("gmock_stress_test") { - sources = [ - "gtest/googlemock/test/gmock_stress_test.cc", - ] - configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] - configs += [ ":gmock_private_config" ] - deps = [ - ":gmock", - ":gtest", - ] -} - -group("gmock_all_tests") { - testonly = true - deps = [ - ":gmock_all_test", - ":gmock_link_test", - ":gmock_stress_test", - ] -} diff --git a/build/chromium_compatibility/base/BUILD.gn b/third_party/mini_chromium/BUILD.gn similarity index 56% rename from build/chromium_compatibility/base/BUILD.gn rename to third_party/mini_chromium/BUILD.gn index f00a51c2..acd4a588 100644 --- a/build/chromium_compatibility/base/BUILD.gn +++ b/third_party/mini_chromium/BUILD.gn @@ -12,15 +12,28 @@ # 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. +import("../../build/crashpad_dependencies.gni") group("base") { - public_configs = - [ "//third_party/mini_chromium/mini_chromium/base:base_public_config" ] - public_deps = [ - "//third_party/mini_chromium/mini_chromium/base", - ] + if (crashpad_is_in_chromium) { + public_deps = [ + "//base", + ] + } else if (crashpad_is_in_fuchsia) { + public_deps = [ + "//third_party/mini_chromium/base", + ] + } else if (crashpad_is_standalone) { + public_deps = [ + "//third_party/mini_chromium/mini_chromium/base", + ] + } +} + +group("base_test_support") { + if (crashpad_is_in_chromium) { + public_deps = [ + "//base:test_support", + ] + } } diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn index 706f52cb..d93ac5e6 100644 --- a/third_party/zlib/BUILD.gn +++ b/third_party/zlib/BUILD.gn @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("../../build/crashpad_in_chromium.gni") +import("../../build/crashpad_dependencies.gni") -if (crashpad_in_chromium) { +if (crashpad_is_in_chromium) { zlib_source = "chromium" } else if (!is_win && !is_fuchsia) { zlib_source = "system" diff --git a/tools/BUILD.gn b/tools/BUILD.gn index af02e66c..e81b4493 100644 --- a/tools/BUILD.gn +++ b/tools/BUILD.gn @@ -21,7 +21,7 @@ source_set("tool_support") { public_configs = [ "..:crashpad_config" ] deps = [ - "//base", + "../third_party/mini_chromium:base", ] } @@ -32,11 +32,11 @@ executable("crashpad_database_util") { deps = [ ":tool_support", + "../build:default_exe_manifest_win", "../client", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", - "//build/win:default_exe_manifest", ] } @@ -47,10 +47,10 @@ executable("crashpad_http_upload") { deps = [ ":tool_support", + "../build:default_exe_manifest_win", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", - "//build/win:default_exe_manifest", ] } @@ -61,12 +61,12 @@ executable("generate_dump") { deps = [ ":tool_support", + "../build:default_exe_manifest_win", "../compat", "../minidump", "../snapshot", + "../third_party/mini_chromium:base", "../util", - "//base", - "//build/win:default_exe_manifest", ] if (is_mac) { @@ -97,8 +97,8 @@ if (is_mac) { deps = [ ":tool_support", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] } @@ -122,8 +122,8 @@ if (is_mac) { deps = [ ":tool_support", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] } @@ -140,8 +140,8 @@ if (is_mac) { deps = [ ":tool_support", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] } @@ -154,8 +154,8 @@ if (is_mac) { ":tool_support", "../client", "../compat", + "../third_party/mini_chromium:base", "../util", - "//base", ] } } diff --git a/util/BUILD.gn b/util/BUILD.gn index e296b29e..43d64b38 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -12,10 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//testing/test.gni") - if (is_mac) { - import("//build/config/sysroot.gni") + import("../build/crashpad_dependencies.gni") + + if (crashpad_is_in_chromium) { + import("//build/config/sysroot.gni") + } else { + import("//third_party/mini_chromium/mini_chromium/build/sysroot.gni") + } action_foreach("mig") { script = "mach/mig.py" @@ -36,11 +40,13 @@ if (is_mac) { args = [ "{{source}}" ] args += rebase_path(outputs, root_build_dir) - if (!use_system_xcode) { - args += [ - "--developer-dir", - hermetic_xcode_path, - ] + if (crashpad_is_in_chromium) { + if (!use_system_xcode) { + args += [ + "--developer-dir", + hermetic_xcode_path, + ] + } } if (sysroot != "") { args += [ @@ -328,8 +334,8 @@ static_library("util") { ] deps = [ + "../third_party/mini_chromium:base", "../third_party/zlib", - "//base", ] if (is_mac) { @@ -470,10 +476,10 @@ source_set("util_test") { "../client", "../compat", "../test", + "../third_party/gtest:gmock", + "../third_party/gtest:gtest", + "../third_party/mini_chromium:base", "../third_party/zlib", - "//base", - "//testing/gmock", - "//testing/gtest", ] if (is_mac) {