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 <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Scott Graham 2017-12-18 14:35:55 -08:00 committed by Commit Bot
parent b51adda8d2
commit 457cc6a34f
27 changed files with 523 additions and 651 deletions

4
.gn
View File

@ -13,7 +13,3 @@
# limitations under the License. # limitations under the License.
buildconfig = "//build/BUILDCONFIG.gn" 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/"

View File

@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//testing/test.gni") import("build/crashpad_dependencies.gni")
import("build/crashpad_in_chromium.gni")
config("crashpad_config") { config("crashpad_config") {
include_dirs = [ "." ] include_dirs = [ "." ]
} }
if (crashpad_in_chromium) { if (crashpad_is_in_chromium) {
test("crashpad_tests") { test("crashpad_tests") {
deps = [ deps = [
"client:client_test", "client:client_test",

View File

@ -16,10 +16,18 @@
# whether code is being built standalone, or in Chromium, or potentially in some # whether code is being built standalone, or in Chromium, or potentially in some
# other configutation. # other configutation.
import("crashpad_in_chromium.gni") import("crashpad_dependencies.gni")
config("crashpad_in_chromium") { config("crashpad_is_in_chromium") {
if (crashpad_in_chromium) { if (crashpad_is_in_chromium) {
defines = [ "CRASHPAD_IN_CHROMIUM" ] defines = [ "CRASHPAD_IS_IN_CHROMIUM" ]
}
}
group("default_exe_manifest_win") {
if (crashpad_is_in_chromium) {
deps = [
"//build/win:default_exe_manifest",
]
} }
} }

View File

@ -65,10 +65,6 @@ if (is_win) {
default_configs = [ default_configs = [
"//third_party/mini_chromium/mini_chromium/build:default", "//third_party/mini_chromium/mini_chromium/build:default",
"//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", "//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") { set_defaults("source_set") {

View File

@ -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.

View File

@ -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") {
}

View File

@ -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") {
}

View File

@ -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.

View File

@ -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
}

View File

@ -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") {
}

View File

@ -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",
]
}

View File

@ -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",
]
}

View File

@ -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
}

View File

@ -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
}
}

View File

@ -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
}

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//testing/test.gni")
static_library("client") { static_library("client") {
sources = [ sources = [
"annotation.cc", "annotation.cc",
@ -64,8 +62,8 @@ static_library("client") {
deps = [ deps = [
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
if (is_win) { if (is_win) {
@ -102,10 +100,10 @@ source_set("client_test") {
":client", ":client",
"../compat", "../compat",
"../test", "../test",
"../third_party/gtest:gmock",
"../third_party/gtest:gtest",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//testing/gmock",
"//testing/gtest",
] ]
data_deps = [ data_deps = [

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//testing/test.gni")
static_library("handler") { static_library("handler") {
sources = [ sources = [
"crash_report_upload_thread.cc", "crash_report_upload_thread.cc",
@ -62,9 +60,9 @@ static_library("handler") {
"../compat", "../compat",
"../minidump", "../minidump",
"../snapshot", "../snapshot",
"../third_party/mini_chromium:base",
"../tools:tool_support", "../tools:tool_support",
"../util", "../util",
"//base",
] ]
if (is_win) { if (is_win) {
@ -86,9 +84,9 @@ source_set("handler_test") {
"../snapshot", "../snapshot",
"../snapshot:test_support", "../snapshot:test_support",
"../test", "../test",
"../third_party/gtest:gtest",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//testing/gtest",
] ]
if (is_win) { if (is_win) {
@ -107,9 +105,9 @@ executable("crashpad_handler") {
deps = [ deps = [
":handler", ":handler",
"../build:default_exe_manifest_win",
"../compat", "../compat",
"//base", "../third_party/mini_chromium:base",
"//build/win:default_exe_manifest",
] ]
if (is_mac && is_component_build) { if (is_mac && is_component_build) {
@ -143,11 +141,11 @@ executable("crashpad_handler_test_extended_handler") {
deps = [ deps = [
":handler", ":handler",
"../build:default_exe_manifest_win",
"../compat", "../compat",
"../minidump:test_support", "../minidump:test_support",
"../third_party/mini_chromium:base",
"../tools:tool_support", "../tools:tool_support",
"//base",
"//build/win:default_exe_manifest",
] ]
} }
@ -164,9 +162,9 @@ if (is_win) {
deps = [ deps = [
":handler", ":handler",
"../build:default_exe_manifest_win",
"../compat", "../compat",
"//base", "../third_party/mini_chromium:base",
"//build/win:default_exe_manifest",
] ]
} }

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//testing/test.gni")
static_library("minidump") { static_library("minidump") {
sources = [ sources = [
"minidump_annotation_writer.cc", "minidump_annotation_writer.cc",
@ -77,8 +75,8 @@ static_library("minidump") {
deps = [ deps = [
"../snapshot", "../snapshot",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
if (is_win) { if (is_win) {
@ -118,8 +116,8 @@ static_library("test_support") {
] ]
deps = [ deps = [
"//base", "../third_party/gtest:gtest",
"//testing/gtest", "../third_party/mini_chromium:base",
] ]
if (is_win) { if (is_win) {
@ -158,9 +156,9 @@ source_set("minidump_test") {
":test_support", ":test_support",
"../snapshot:test_support", "../snapshot:test_support",
"../test", "../test",
"../third_party/gtest:gtest",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//testing/gtest",
] ]
if (is_win) { if (is_win) {

View File

@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//build/config/compiler/compiler.gni") import("../build/crashpad_dependencies.gni")
import("//testing/test.gni")
static_library("snapshot") { static_library("snapshot") {
sources = [ sources = [
@ -147,8 +146,8 @@ static_library("snapshot") {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
if (is_win) { if (is_win) {
@ -171,8 +170,8 @@ if (is_win) {
deps = [ deps = [
":snapshot", ":snapshot",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
} }
} else { } else {
@ -210,8 +209,8 @@ static_library("test_support") {
deps = [ deps = [
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
if (is_win) { if (is_win) {
@ -262,9 +261,9 @@ source_set("snapshot_test") {
"../client", "../client",
"../compat", "../compat",
"../test", "../test",
"../third_party/gtest:gtest",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//testing/gtest",
] ]
data_deps = [ data_deps = [
@ -303,7 +302,7 @@ loadable_module("crashpad_snapshot_test_module") {
] ]
deps = [ deps = [
"../client", "../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" ] defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_LARGE" ]
deps = [ 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" ] defines = [ "CRASHPAD_INFO_SIZE_TEST_MODULE_SMALL" ]
deps = [ deps = [
"//base", "../third_party/mini_chromium:base",
] ]
} }
@ -354,7 +353,7 @@ if (is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"//base", "../third_party/mini_chromium:base",
] ]
} }
@ -366,8 +365,8 @@ if (is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
} }
@ -379,8 +378,8 @@ if (is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
} }
@ -392,7 +391,7 @@ if (is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"//base", "../third_party/mini_chromium:base",
] ]
} }
@ -404,10 +403,10 @@ if (is_win) {
deps = [ deps = [
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../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. # The tests that use this executable rely on at least minimal debug info.
configs -= [ "//build/config/compiler:default_symbols" ] configs -= [ "//build/config/compiler:default_symbols" ]
configs += [ "//build/config/compiler:minimal_symbols" ] configs += [ "//build/config/compiler:minimal_symbols" ]
@ -421,9 +420,9 @@ if (is_win) {
] ]
deps = [ deps = [
"../client", "../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. # The tests that use this module rely on at least minimal debug info.
configs -= [ "//build/config/compiler:default_symbols" ] configs -= [ "//build/config/compiler:default_symbols" ]
configs += [ "//build/config/compiler:minimal_symbols" ] configs += [ "//build/config/compiler:minimal_symbols" ]

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//testing/test.gni")
static_library("test") { static_library("test") {
testonly = true testonly = true
@ -82,7 +80,7 @@ static_library("test") {
public_configs = [ "..:crashpad_config" ] public_configs = [ "..:crashpad_config" ]
configs += [ "../build:crashpad_in_chromium" ] configs += [ "../build:crashpad_is_in_chromium" ]
data = [ data = [
"test_paths_test_data_root.txt", "test_paths_test_data_root.txt",
@ -90,9 +88,9 @@ static_library("test") {
deps = [ deps = [
"../compat", "../compat",
"../third_party/gtest:gtest",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//testing/gtest",
] ]
if (is_mac) { if (is_mac) {
@ -140,10 +138,10 @@ source_set("test_test") {
deps = [ deps = [
":test", ":test",
"../compat", "../compat",
"../third_party/gtest:gmock",
"../third_party/gtest:gtest",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//testing/gmock",
"//testing/gtest",
] ]
data_deps = [ data_deps = [
@ -162,14 +160,14 @@ static_library("gmock_main") {
sources = [ sources = [
"gtest_main.cc", "gtest_main.cc",
] ]
configs += [ "../build:crashpad_in_chromium" ] configs += [ "../build:crashpad_is_in_chromium" ]
defines = [ "CRASHPAD_TEST_LAUNCHER_GMOCK" ] defines = [ "CRASHPAD_TEST_LAUNCHER_GMOCK" ]
deps = [ deps = [
":test", ":test",
"//base", "../third_party/gtest:gmock",
"//base/test:test_support", "../third_party/gtest:gtest",
"//testing/gmock", "../third_party/mini_chromium:base",
"//testing/gtest", "../third_party/mini_chromium:base_test_support",
] ]
} }
@ -178,12 +176,12 @@ static_library("gtest_main") {
sources = [ sources = [
"gtest_main.cc", "gtest_main.cc",
] ]
configs += [ "../build:crashpad_in_chromium" ] configs += [ "../build:crashpad_is_in_chromium" ]
defines = [ "CRASHPAD_TEST_LAUNCHER_GTEST" ] defines = [ "CRASHPAD_TEST_LAUNCHER_GTEST" ]
deps = [ deps = [
":test", ":test",
"//base", "../third_party/gtest:gtest",
"//base/test:test_support", "../third_party/mini_chromium:base",
"//testing/gtest", "../third_party/mini_chromium:base_test_support",
] ]
} }

View File

@ -25,18 +25,18 @@
#include "test/win/win_child_process.h" #include "test/win/win_child_process.h"
#endif // OS_WIN #endif // OS_WIN
#if defined(CRASHPAD_IN_CHROMIUM) #if defined(CRASHPAD_IS_IN_CHROMIUM)
#include "base/bind.h" #include "base/bind.h"
#include "base/test/launcher/unit_test_launcher.h" #include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h" #include "base/test/test_suite.h"
#endif // CRASHPAD_IN_CHROMIUM #endif // CRASHPAD_IS_IN_CHROMIUM
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
crashpad::test::InitializeMainArguments(argc, argv); crashpad::test::InitializeMainArguments(argc, argv);
testing::AddGlobalTestEnvironment( testing::AddGlobalTestEnvironment(
crashpad::test::DisabledTestGtestEnvironment::Get()); crashpad::test::DisabledTestGtestEnvironment::Get());
#if defined(CRASHPAD_IN_CHROMIUM) #if defined(CRASHPAD_IS_IN_CHROMIUM)
#if defined(OS_WIN) #if defined(OS_WIN)
// Chromiums test launcher interferes with WinMultiprocess-based tests. Allow // Chromiums 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))); base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
} }
#endif // CRASHPAD_IN_CHROMIUM #endif // CRASHPAD_IS_IN_CHROMIUM
#if defined(CRASHPAD_TEST_LAUNCHER_GMOCK) #if defined(CRASHPAD_TEST_LAUNCHER_GMOCK)
testing::InitGoogleMock(&argc, argv); testing::InitGoogleMock(&argc, argv);

View File

@ -127,12 +127,12 @@ base::FilePath TestPaths::Executable() {
// static // static
base::FilePath TestPaths::ExpectedExecutableBasename( base::FilePath TestPaths::ExpectedExecutableBasename(
const base::FilePath::StringType& name) { const base::FilePath::StringType& name) {
#if defined(CRASHPAD_IN_CHROMIUM) #if defined(CRASHPAD_IS_IN_CHROMIUM)
base::FilePath::StringType executable_name( base::FilePath::StringType executable_name(
FILE_PATH_LITERAL("crashpad_tests")); FILE_PATH_LITERAL("crashpad_tests"));
#else // CRASHPAD_IN_CHROMIUM #else // CRASHPAD_IS_IN_CHROMIUM
base::FilePath::StringType executable_name(name); base::FilePath::StringType executable_name(name);
#endif // CRASHPAD_IN_CHROMIUM #endif // CRASHPAD_IS_IN_CHROMIUM
#if defined(OS_WIN) #if defined(OS_WIN)
executable_name += FILE_PATH_LITERAL(".exe"); executable_name += FILE_PATH_LITERAL(".exe");
@ -170,9 +170,9 @@ base::FilePath TestPaths::BuildArtifact(
base::FilePath::StringType test_name = base::FilePath::StringType test_name =
FILE_PATH_LITERAL("crashpad_") + module + FILE_PATH_LITERAL("_test"); 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); CHECK(Executable().BaseName().RemoveFinalExtension().value() == test_name);
#endif // !CRASHPAD_IN_CHROMIUM #endif // !CRASHPAD_IS_IN_CHROMIUM
base::FilePath::StringType extension; base::FilePath::StringType extension;
switch (file_type) { switch (file_type) {

View File

@ -12,19 +12,39 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//testing/test.gni") import("../../build/crashpad_dependencies.gni")
config("gtest_private_config") { 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 = [ ":*" ] visibility = [ ":*" ]
include_dirs = [ "gtest/googletest" ] include_dirs = [ "gtest/googletest" ]
defines = [ "GUNIT_NO_GOOGLE3=1" ] defines = [ "GUNIT_NO_GOOGLE3=1" ]
} }
config("gtest_public_config") { config("gtest_public_config") {
include_dirs = [ "gtest/googletest/include" ] include_dirs = [ "gtest/googletest/include" ]
} }
static_library("gtest") { static_library("gtest") {
testonly = true testonly = true
sources = [ sources = [
"gtest/googletest/include/gtest/gtest-death-test.h", "gtest/googletest/include/gtest/gtest-death-test.h",
@ -65,9 +85,9 @@ static_library("gtest") {
public_configs = [ ":gtest_public_config" ] public_configs = [ ":gtest_public_config" ]
configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ] configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ]
configs += [ ":gtest_private_config" ] configs += [ ":gtest_private_config" ]
} }
static_library("gtest_main") { static_library("gtest_main") {
# Tests outside of this file should use ../../test:gtest_main instead. # Tests outside of this file should use ../../test:gtest_main instead.
visibility = [ ":*" ] visibility = [ ":*" ]
@ -78,9 +98,9 @@ static_library("gtest_main") {
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
test("gtest_all_test") { test("gtest_all_test") {
sources = [ sources = [
"gtest/googletest/test/gtest-death-test_test.cc", "gtest/googletest/test/gtest-death-test_test.cc",
"gtest/googletest/test/gtest-filepath_test.cc", "gtest/googletest/test/gtest-filepath_test.cc",
@ -106,9 +126,9 @@ test("gtest_all_test") {
":gtest", ":gtest",
":gtest_main", ":gtest_main",
] ]
} }
test("gtest_environment_test") { test("gtest_environment_test") {
sources = [ sources = [
"gtest/googletest/test/gtest_environment_test.cc", "gtest/googletest/test/gtest_environment_test.cc",
] ]
@ -116,27 +136,27 @@ test("gtest_environment_test") {
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
test("gtest_listener_test") { test("gtest_listener_test") {
sources = [ sources = [
"gtest/googletest/test/gtest-listener_test.cc", "gtest/googletest/test/gtest-listener_test.cc",
] ]
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
test("gtest_no_test") { test("gtest_no_test") {
sources = [ sources = [
"gtest/googletest/test/gtest_no_test_unittest.cc", "gtest/googletest/test/gtest_no_test_unittest.cc",
] ]
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
test("gtest_param_test") { test("gtest_param_test") {
sources = [ sources = [
"gtest/googletest/test/gtest-param-test2_test.cc", "gtest/googletest/test/gtest-param-test2_test.cc",
"gtest/googletest/test/gtest-param-test_test.cc", "gtest/googletest/test/gtest-param-test_test.cc",
@ -150,22 +170,23 @@ test("gtest_param_test") {
if (is_clang) { if (is_clang) {
cflags_cc = [ cflags_cc = [
# For gtest/googlemock/test/gmock-matchers_test.ccs Unstreamable::value_. # For gtest/googlemock/test/gmock-matchers_test.ccs
# Unstreamable::value_.
"-Wno-unused-private-field", "-Wno-unused-private-field",
] ]
} }
} }
test("gtest_premature_exit_test") { test("gtest_premature_exit_test") {
sources = [ sources = [
"gtest/googletest/test/gtest_premature_exit_test.cc", "gtest/googletest/test/gtest_premature_exit_test.cc",
] ]
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
test("gtest_repeat_test") { test("gtest_repeat_test") {
sources = [ sources = [
"gtest/googletest/test/gtest_repeat_test.cc", "gtest/googletest/test/gtest_repeat_test.cc",
] ]
@ -173,9 +194,9 @@ test("gtest_repeat_test") {
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
test("gtest_sole_header_test") { test("gtest_sole_header_test") {
sources = [ sources = [
"gtest/googletest/test/gtest_sole_header_test.cc", "gtest/googletest/test/gtest_sole_header_test.cc",
] ]
@ -183,9 +204,9 @@ test("gtest_sole_header_test") {
":gtest", ":gtest",
":gtest_main", ":gtest_main",
] ]
} }
test("gtest_stress_test") { test("gtest_stress_test") {
sources = [ sources = [
"gtest/googletest/test/gtest_stress_test.cc", "gtest/googletest/test/gtest_stress_test.cc",
] ]
@ -193,18 +214,18 @@ test("gtest_stress_test") {
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
test("gtest_unittest_api_test") { test("gtest_unittest_api_test") {
sources = [ sources = [
"gtest/googletest/test/gtest-unittest-api_test.cc", "gtest/googletest/test/gtest-unittest-api_test.cc",
] ]
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
group("gtest_all_tests") { group("gtest_all_tests") {
testonly = true testonly = true
deps = [ deps = [
":gtest_all_test", ":gtest_all_test",
@ -218,29 +239,29 @@ group("gtest_all_tests") {
":gtest_stress_test", ":gtest_stress_test",
":gtest_unittest_api_test", ":gtest_unittest_api_test",
] ]
} }
config("gmock_private_config") { config("gmock_private_config") {
visibility = [ ":*" ] visibility = [ ":*" ]
include_dirs = [ "gtest/googlemock" ] include_dirs = [ "gtest/googlemock" ]
} }
config("gmock_public_config") { config("gmock_public_config") {
include_dirs = [ "gtest/googlemock/include" ] include_dirs = [ "gtest/googlemock/include" ]
if (is_clang) { if (is_clang) {
cflags_cc = [ cflags_cc = [
# The MOCK_METHODn() macros do not specify “override”, which triggers this # The MOCK_METHODn() macros do not specify “override”, which triggers
# warning in users: “error: 'Method' overrides a member function but is # this warning in users: “error: 'Method' overrides a member function
# not marked 'override' [-Werror,-Winconsistent-missing-override]”. # but is not marked 'override'
# Suppress these warnings until # [-Werror,-Winconsistent-missing-override]”. Suppress these warnings
# https://github.com/google/googletest/issues/533 is fixed. # until https://github.com/google/googletest/issues/533 is fixed.
"-Wno-inconsistent-missing-override", "-Wno-inconsistent-missing-override",
] ]
} }
} }
static_library("gmock") { static_library("gmock") {
testonly = true testonly = true
sources = [ sources = [
"gtest/googlemock/include/gmock/gmock-actions.h", "gtest/googlemock/include/gmock/gmock-actions.h",
@ -274,9 +295,9 @@ static_library("gmock") {
deps = [ deps = [
":gtest", ":gtest",
] ]
} }
static_library("gmock_main") { static_library("gmock_main") {
# Tests outside of this file should use ../../test:gmock_main instead. # Tests outside of this file should use ../../test:gmock_main instead.
visibility = [ ":*" ] visibility = [ ":*" ]
testonly = true testonly = true
@ -287,9 +308,9 @@ static_library("gmock_main") {
":gmock", ":gmock",
":gtest", ":gtest",
] ]
} }
test("gmock_all_test") { test("gmock_all_test") {
sources = [ sources = [
"gtest/googlemock/test/gmock-actions_test.cc", "gtest/googlemock/test/gmock-actions_test.cc",
"gtest/googlemock/test/gmock-cardinalities_test.cc", "gtest/googlemock/test/gmock-cardinalities_test.cc",
@ -322,9 +343,9 @@ test("gmock_all_test") {
"-Wno-unused-private-field", "-Wno-unused-private-field",
] ]
} }
} }
test("gmock_link_test") { test("gmock_link_test") {
sources = [ sources = [
"gtest/googlemock/test/gmock_link2_test.cc", "gtest/googlemock/test/gmock_link2_test.cc",
"gtest/googlemock/test/gmock_link_test.cc", "gtest/googlemock/test/gmock_link_test.cc",
@ -336,9 +357,9 @@ test("gmock_link_test") {
":gmock_main", ":gmock_main",
":gtest", ":gtest",
] ]
} }
test("gmock_stress_test") { test("gmock_stress_test") {
sources = [ sources = [
"gtest/googlemock/test/gmock_stress_test.cc", "gtest/googlemock/test/gmock_stress_test.cc",
] ]
@ -348,13 +369,14 @@ test("gmock_stress_test") {
":gmock", ":gmock",
":gtest", ":gtest",
] ]
} }
group("gmock_all_tests") { group("gmock_all_tests") {
testonly = true testonly = true
deps = [ deps = [
":gmock_all_test", ":gmock_all_test",
":gmock_link_test", ":gmock_link_test",
":gmock_stress_test", ":gmock_stress_test",
] ]
}
} }

View File

@ -12,15 +12,28 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# This target is a stub so that both Crashpad and Chromium can refer to "//base" import("../../build/crashpad_dependencies.gni")
# 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") { group("base") {
public_configs = if (crashpad_is_in_chromium) {
[ "//third_party/mini_chromium/mini_chromium/base:base_public_config" ] public_deps = [
"//base",
]
} else if (crashpad_is_in_fuchsia) {
public_deps = [
"//third_party/mini_chromium/base",
]
} else if (crashpad_is_standalone) {
public_deps = [ public_deps = [
"//third_party/mini_chromium/mini_chromium/base", "//third_party/mini_chromium/mini_chromium/base",
] ]
}
}
group("base_test_support") {
if (crashpad_is_in_chromium) {
public_deps = [
"//base:test_support",
]
}
} }

View File

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # 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" zlib_source = "chromium"
} else if (!is_win && !is_fuchsia) { } else if (!is_win && !is_fuchsia) {
zlib_source = "system" zlib_source = "system"

View File

@ -21,7 +21,7 @@ source_set("tool_support") {
public_configs = [ "..:crashpad_config" ] public_configs = [ "..:crashpad_config" ]
deps = [ deps = [
"//base", "../third_party/mini_chromium:base",
] ]
} }
@ -32,11 +32,11 @@ executable("crashpad_database_util") {
deps = [ deps = [
":tool_support", ":tool_support",
"../build:default_exe_manifest_win",
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//build/win:default_exe_manifest",
] ]
} }
@ -47,10 +47,10 @@ executable("crashpad_http_upload") {
deps = [ deps = [
":tool_support", ":tool_support",
"../build:default_exe_manifest_win",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//build/win:default_exe_manifest",
] ]
} }
@ -61,12 +61,12 @@ executable("generate_dump") {
deps = [ deps = [
":tool_support", ":tool_support",
"../build:default_exe_manifest_win",
"../compat", "../compat",
"../minidump", "../minidump",
"../snapshot", "../snapshot",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
"//build/win:default_exe_manifest",
] ]
if (is_mac) { if (is_mac) {
@ -97,8 +97,8 @@ if (is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
} }
@ -122,8 +122,8 @@ if (is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
} }
@ -140,8 +140,8 @@ if (is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
} }
@ -154,8 +154,8 @@ if (is_mac) {
":tool_support", ":tool_support",
"../client", "../client",
"../compat", "../compat",
"../third_party/mini_chromium:base",
"../util", "../util",
"//base",
] ]
} }
} }

View File

@ -12,10 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//testing/test.gni")
if (is_mac) { if (is_mac) {
import("../build/crashpad_dependencies.gni")
if (crashpad_is_in_chromium) {
import("//build/config/sysroot.gni") import("//build/config/sysroot.gni")
} else {
import("//third_party/mini_chromium/mini_chromium/build/sysroot.gni")
}
action_foreach("mig") { action_foreach("mig") {
script = "mach/mig.py" script = "mach/mig.py"
@ -36,12 +40,14 @@ if (is_mac) {
args = [ "{{source}}" ] args = [ "{{source}}" ]
args += rebase_path(outputs, root_build_dir) args += rebase_path(outputs, root_build_dir)
if (crashpad_is_in_chromium) {
if (!use_system_xcode) { if (!use_system_xcode) {
args += [ args += [
"--developer-dir", "--developer-dir",
hermetic_xcode_path, hermetic_xcode_path,
] ]
} }
}
if (sysroot != "") { if (sysroot != "") {
args += [ args += [
"--sdk", "--sdk",
@ -328,8 +334,8 @@ static_library("util") {
] ]
deps = [ deps = [
"../third_party/mini_chromium:base",
"../third_party/zlib", "../third_party/zlib",
"//base",
] ]
if (is_mac) { if (is_mac) {
@ -470,10 +476,10 @@ source_set("util_test") {
"../client", "../client",
"../compat", "../compat",
"../test", "../test",
"../third_party/gtest:gmock",
"../third_party/gtest:gtest",
"../third_party/mini_chromium:base",
"../third_party/zlib", "../third_party/zlib",
"//base",
"//testing/gmock",
"//testing/gtest",
] ]
if (is_mac) { if (is_mac) {