crashpad/BUILD.gn

228 lines
5.6 KiB
Plaintext
Raw Normal View History

# 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("build/crashpad_buildconfig.gni")
import("build/test.gni")
import("util/net/tls.gni")
config("crashpad_config") {
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 <mark@chromium.org> Reviewed-by: Robert Sesek <rsesek@chromium.org> Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-11-28 10:31:13 -08:00
include_dirs = [ "." ]
}
# TODO(fuchsia:46805): Remove this once instances of UB have been cleaned up.
config("disable_ubsan") {
if (crashpad_is_in_fuchsia) {
cflags = [ "-fno-sanitize=undefined" ]
}
visibility = [
"snapshot:snapshot",
"minidump:minidump_test",
"third_party/gtest:gtest",
"util:util",
]
}
if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) {
test("crashpad_tests") {
deps = [
"client:client_test",
"minidump:minidump_test",
"test:gmock_main",
"test:test_test",
]
if (!crashpad_is_ios) {
deps += [ "snapshot:snapshot_test" ]
}
if (!crashpad_is_ios && !crashpad_is_fuchsia) {
deps += [ "handler:handler_test" ]
}
if (crashpad_is_in_fuchsia) {
# TODO(fuchsia:46559): Fix the leaks and remove this.
deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
}
if (crashpad_is_android) {
use_raw_android_executable = true
copy("crashpad_test_data") {
testonly = true
sources = [
"test/test_paths_test_data_root.txt",
"util/net/testdata/ascii_http_body.txt",
"util/net/testdata/binary_http_body.dat",
]
outputs = [ "$root_out_dir/crashpad_test_data/{{source}}" ]
}
deps += [ ":crashpad_test_data" ]
extra_dist_files = [
"$root_out_dir/crashpad_handler",
"$root_out_dir/crashpad_test_test_multiprocess_exec_test_child",
"$root_out_dir/crashpad_test_data",
]
}
}
if (crashpad_is_in_fuchsia) {
import("//build/package.gni")
package("crashpad_test") {
testonly = true
deps = [
":crashpad_tests",
"snapshot:crashpad_snapshot_test_both_dt_hash_styles",
"snapshot:crashpad_snapshot_test_module",
"snapshot:crashpad_snapshot_test_module_large",
"snapshot:crashpad_snapshot_test_module_small",
"test:crashpad_test_test_multiprocess_exec_test_child",
"util:http_transport_test_server",
]
tests = [
{
name = "crashpad_tests"
},
]
meta = [
{
path = "test/fuchsia_crashpad_tests.cmx"
dest = "crashpad_tests.cmx"
compat: Provide <elf.h> and <mach-o/loader.h> for everyone I’m working on something that I’m not ready to share, but maintaining these compat headers in my local branch is becoming annoying because “git cl format” keeps reformatting them since they were added since my local branch point. Because these headers are non-trivial, they’re brought nearly unmodified from upstream into third_party, with forwarding from the appropriate locations in compat. <elf.h> comes from glibc 2.29 (2019-01-31) and was modified to remove the #include of <features.h> and to replace the use of __BEGIN_DECLS and __END_DECLS with the proper conditional extern "C" construct. <mach-o/loader.h> comes from xnu 4903.221.2 (macOS 10.14.1, 2018-10-30) and was modified to remove the unused #includes of <mach/machine/thread_status.h> and <architecture/byte_order.h>. Rather than taking <mach/machine.h> and <mach/vm_prot.h> with a spider web of other dependencies from xnu, compat has cut-back versions of these headers that provide only the required typedefs. This also includes an update of apple_cf to 1153.18 (OS X 10.10.3, 2015-04-08), the last public release of CF-Lite. The change doesn’t do much for our purposes, but it restores the file to an Apple-shipped state, trailing whitespace and all. This also canonically formats BUILD.gn. 48ee086ca4c4c didn’t format it. Change-Id: Ib4f28ad53d9757bd0eed838e148c51172bfe30b1 Reviewed-on: https://chromium-review.googlesource.com/c/1489795 Reviewed-by: Robert Sesek <rsesek@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-02-26 16:59:46 -05:00
},
]
binaries = [
{
name = "crashpad_test_test_multiprocess_exec_test_child"
dest = "crashpad_test_test_multiprocess_exec_test_child"
},
{
name = "http_transport_test_server"
dest = "http_transport_test_server"
},
]
loadable_modules = [
{
name = "crashpad_snapshot_test_both_dt_hash_styles.so"
},
{
name = "crashpad_snapshot_test_module.so"
},
{
name = "crashpad_snapshot_test_module_large.so"
},
{
name = "crashpad_snapshot_test_module_small.so"
},
]
resources = [
{
path = "util/net/testdata/ascii_http_body.txt"
dest = "util/net/testdata/ascii_http_body.txt"
},
{
path = "util/net/testdata/binary_http_body.dat"
dest = "util/net/testdata/binary_http_body.dat"
},
{
path = "test/test_paths_test_data_root.txt"
dest = "test/test_paths_test_data_root.txt"
},
]
if (crashpad_use_boringssl_for_http_transport_socket) {
resources += [
{
path = "util/net/testdata/crashpad_util_test_cert.pem"
dest = "util/net/testdata/crashpad_util_test_cert.pem"
},
{
path = "util/net/testdata/crashpad_util_test_key.pem"
dest = "util/net/testdata/crashpad_util_test_key.pem"
},
]
}
}
package("crashpad_database_util") {
deps = [ "tools:crashpad_database_util" ]
binaries = [
{
name = "crashpad_database_util"
shell = true
},
]
}
}
} else if (crashpad_is_standalone) {
test("crashpad_client_test") {
deps = [
"client:client_test",
"test:gmock_main",
]
}
test("crashpad_handler_test") {
deps = [
"handler:handler_test",
"test:gtest_main",
]
if (crashpad_is_ios || crashpad_is_fuchsia) {
deps -= [ "handler:handler_test" ]
}
}
test("crashpad_minidump_test") {
deps = [
"minidump:minidump_test",
"test:gtest_main",
]
}
test("crashpad_snapshot_test") {
deps = [
"snapshot:snapshot_test",
"test:gtest_main",
]
if (crashpad_is_ios) {
deps -= [ "snapshot:snapshot_test" ]
}
}
test("crashpad_test_test") {
deps = [
"test:gmock_main",
"test:test_test",
]
}
test("crashpad_util_test") {
deps = [
"test:gmock_main",
"util:util_test",
]
}
}
if (crashpad_is_ios) {
group("ios_xcuitests") {
testonly = true
deps = [ "test/ios:all_tests" ]
}
}