blob: 6fdb469c846052ea3bcb0b4fc8d446298f865b1f [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//common-mk/generate-dbus-adaptors.gni")
import("//common-mk/pkg_config.gni")
import("//common-mk/proto_library.gni")
group("all") {
deps = [
":dbus_code_generator",
":libsystemproxy",
":system_proxy",
":system_proxy_worker",
":worker-protos",
]
if (use.test) {
deps += [ ":system-proxy_test" ]
}
if (use.fuzzer) {
deps += [
":system_proxy_connect_headers_parser_fuzzer",
":system_proxy_http_util_fuzzer",
":system_proxy_worker_config_fuzzer",
]
}
}
# D-Bus code generator.
generate_dbus_adaptors("dbus_code_generator") {
dbus_service_config = "dbus_bindings/dbus-service-config.json"
dbus_adaptors_out_dir = "include/system_proxy"
sources = [ "dbus_bindings/org.chromium.SystemProxy.xml" ]
}
# Worker configs protos.
proto_library("worker-protos") {
proto_in_dir = "proto"
proto_out_dir = "include/bindings"
sources = [ "${proto_in_dir}/worker_common.proto" ]
}
pkg_config("target_defaults") {
# NOSORT
pkg_deps = [
"dbus-1",
"libbrillo",
"libchrome",
"libminijail",
"libpatchpanel-client",
"libpatchpanel-util",
# system_api depends on protobuf (or protobuf-lite). It must
# appear before protobuf or the linker flags won't be in the right
# order.
"system_api",
"protobuf-lite",
]
if (use.fuzzer) {
# Link against protobuf for fuzzers so we can use libprotobuf-mutator.
pkg_deps += [ "protobuf" ]
} else {
pkg_deps += [ "protobuf-lite" ]
}
}
# System-proxy library (shared between executables and tests).
static_library("libsystemproxy") {
sources = [
"kerberos_client.cc",
"protobuf_util.cc",
"sandboxed_worker.cc",
"system_proxy_adaptor.cc",
"system_proxy_daemon.cc",
]
configs += [ ":target_defaults" ]
deps = [
":dbus_code_generator",
":worker-protos",
]
}
# System-proxy worker library (shared between executables and tests).
static_library("libsystemproxyworker") {
sources = [
"curl_socket.cc",
"http_util.cc",
"protobuf_util.cc",
"proxy_connect_job.cc",
"server_proxy.cc",
]
configs += [ ":target_defaults" ]
deps = [ ":worker-protos" ]
}
executable("system_proxy_worker") {
sources = [ "system_proxy_worker.cc" ]
configs += [ ":target_defaults" ]
all_dependent_pkg_deps = [ "libcurl" ]
deps = [
":libsystemproxyworker",
":worker-protos",
]
}
executable("system_proxy") {
sources = [ "system_proxy.cc" ]
configs += [ ":target_defaults" ]
deps = [ ":libsystemproxy" ]
}
# Unit tests.
if (use.test) {
pkg_config("system-proxy_test_config") {
pkg_deps = [
"libchrome",
"libchrome-test",
]
}
executable("system-proxy_test") {
sources = [
"http_util_test.cc",
"kerberos_client_test.cc",
"proxy_connect_job_test.cc",
"server_proxy_test.cc",
"system_proxy_adaptor_test.cc",
"test_http_server.cc",
]
configs += [
"//common-mk:test",
":system-proxy_test_config",
":target_defaults",
]
all_dependent_pkg_deps = [ "libcurl" ]
defines = [ "UNIT_TEST" ]
deps = [
":libsystemproxy",
":libsystemproxyworker",
"//common-mk/testrunner:testrunner",
]
}
}
if (use.fuzzer) {
pkg_config("config_fuzzer_pkg_deps") {
pkg_deps = [ "libprotobuf-mutator" ]
}
executable("system_proxy_worker_config_fuzzer") {
all_dependent_pkg_deps = [ "libcurl" ]
sources = [ "worker_config_fuzzer.cc" ]
configs += [
"//common-mk/common_fuzzer",
":config_fuzzer_pkg_deps",
":target_defaults",
]
deps = [ ":libsystemproxyworker" ]
}
executable("system_proxy_connect_headers_parser_fuzzer") {
all_dependent_pkg_deps = [ "libcurl" ]
sources = [ "connect_headers_parser_fuzzer.cc" ]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
deps = [ ":libsystemproxyworker" ]
}
executable("system_proxy_http_util_fuzzer") {
all_dependent_pkg_deps = [ "libcurl" ]
sources = [ "http_util_fuzzer.cc" ]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
deps = [ ":libsystemproxyworker" ]
}
}