blob: 13793d6bca78cf813de0e6a24441846f69e957c3 [file] [log] [blame]
# Copyright 2019 The Chromium 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("//build/config/chrome_build.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/util/process_version.gni")
import("//chrome/updater/branding.gni")
import("//testing/test.gni")
# Run 'gn check out\Default --check-generated //chrome/updater/*' every time
# dependencies are modified until a presubmit is written to automatically
# check that the C++ includes match the build dependency graph.
# TODO(sorin): make the code build on Linux. https://crbug.com/1014320
group("updater") {
if (is_win) {
deps = [ "//chrome/updater/win" ]
}
if (is_mac) {
deps = [ "//chrome/updater/mac" ]
}
if (is_win || is_mac) {
deps += [ "//chrome/updater/tools:tools" ]
}
}
group("all") {
testonly = true
if (is_win || is_mac) {
deps = [
":updater",
":updater_tests",
":updater_tests_system",
"//chrome/updater/test/test_app",
]
}
}
# Conditional build is needed, otherwise the analyze script on Linux
# requires all targets and it is going to include the targets below.
if (is_win || is_mac) {
# This target must only have platform-neutral sources. Generally speaking,
# these sources are related to common, cross-platfrom aspects of the code,
# such as crash handling, or interfaces to cross platform dependencies from
# Chromium. If the sources are in platform-specific directories or their
# names contain platform-specific suffixes, they must go into the :lib
# target, or to targets in their platform directories.
source_set("base") {
sources = [
"action_handler.h",
"constants.cc",
"constants.h",
"crash_client.cc",
"crash_client.h",
"crash_reporter.cc",
"crash_reporter.h",
"enum_traits.h",
"persisted_data.cc",
"persisted_data.h",
"policy_manager.cc",
"policy_manager.h",
"registration_data.cc",
"registration_data.h",
"splash_screen.h",
"update_service.cc",
"update_service.h",
"update_service_internal.h",
"updater_scope.h",
"util.cc",
"util.h",
]
deps = [
":branding_header",
":version_header",
"//base",
"//components/crash/core/common:crash_key_lib",
"//components/prefs",
"//components/update_client",
"//third_party/crashpad/crashpad/client",
"//third_party/crashpad/crashpad/handler",
"//url",
]
if (is_mac) {
sources += [
"mac/mac_util.h",
"mac/mac_util.mm",
]
deps += [ "//chrome/common/mac:launchd" ]
frameworks = [ "Foundation.framework" ]
}
}
# Use this source set for code which has platform-specific modules.
source_set("lib") {
sources = [
"activity.cc",
"activity.h",
"activity_impl.h",
"app/app.cc",
"app/app.h",
"app/app_install.cc",
"app/app_install.h",
"app/app_server.cc",
"app/app_server.h",
"app/app_uninstall.cc",
"app/app_uninstall.h",
"app/app_update.cc",
"app/app_update.h",
"app/app_wake.cc",
"app/app_wake.h",
"check_for_updates_task.cc",
"check_for_updates_task.h",
"configurator.cc",
"configurator.h",
"crx_downloader_factory.h",
"external_constants.cc",
"external_constants.h",
"external_constants_builder.cc",
"external_constants_builder.h",
"external_constants_override.cc",
"external_constants_override.h",
"installer.cc",
"installer.h",
"lib_util.h",
"policy_service.cc",
"policy_service.h",
"prefs.cc",
"prefs.h",
"prefs_impl.h",
"setup.h",
"tag.cc",
"tag.h",
"update_service_impl.cc",
"update_service_impl.h",
"update_service_impl_inactive.cc",
"update_service_impl_inactive.h",
"update_service_internal_impl.cc",
"update_service_internal_impl.h",
"update_service_internal_impl_inactive.cc",
"update_service_internal_impl_inactive.h",
"updater.cc",
"updater.h",
]
if (is_mac) {
sources += [
"activity_impl_mac.cc",
"app/app_install_mac.mm",
"app/server/mac/app_server.h",
"app/server/mac/server.h",
"app/server/mac/server.mm",
"app/server/mac/service_delegate.h",
"app/server/mac/service_delegate.mm",
"app/server/mac/service_protocol.mm",
"app/server/mac/update_service_wrappers.h",
"app/server/mac/update_service_wrappers.mm",
"installer_mac.cc",
"launchd_util.cc",
"launchd_util.h",
"lib_util_mac.mm",
"mac/update_service_internal_proxy.h",
"mac/update_service_internal_proxy.mm",
"mac/update_service_proxy.h",
"mac/update_service_proxy.mm",
"prefs_mac.mm",
"service_factory_mac.mm",
"setup_mac.mm",
]
}
if (is_win) {
sources += [
"activity_impl_win.cc",
"app/app_install_win.cc",
"app/server/win/com_classes.cc",
"app/server/win/com_classes.h",
"app/server/win/com_classes_legacy.cc",
"app/server/win/com_classes_legacy.h",
"app/server/win/server.cc",
"app/server/win/server.h",
"app/server/win/service_main.cc",
"app/server/win/service_main.h",
"lib_util_win.cc",
"prefs_win.cc",
"service_factory_win.cc",
"setup_win.cc",
"win/wrl_module.h",
]
}
deps = [
":base",
":branding_header",
":version_header",
"//base",
"//base:i18n",
"//components/crash/core/common:crash_key",
"//components/crx_file:crx_file",
"//components/prefs",
"//components/update_client",
"//components/update_client:in_process_patcher",
"//components/update_client:in_process_unzipper",
"//components/version_info",
"//third_party/boringssl",
"//url",
]
if (is_win) {
# //chrome/updater:lib and //chrome/updater/win:lib behave as one unit
# for linking purposes. Targets depending on the latter must use
# the former as a dependency.
allow_circular_includes_from = [ "//chrome/updater/win:lib" ]
deps += [
"//chrome/installer/util:with_no_strings",
"//chrome/updater/app/server/win:updater_idl_idl",
"//chrome/updater/app/server/win:updater_internal_idl_idl",
"//chrome/updater/app/server/win:updater_legacy_idl_idl",
"//chrome/updater/win:constants",
]
public_deps = [ "//chrome/updater/win:lib" ]
}
if (is_mac) {
deps += [
"//chrome/updater/app/server/mac:protocol",
"//chrome/updater/mac:enterprise",
"//chrome/updater/mac:installer_sources",
"//chrome/updater/mac:network_fetcher_sources",
"//chrome/updater/mac:updater_setup_sources",
"//chrome/updater/mac:xpc_names",
]
}
if (is_mac) {
frameworks = [ "Foundation.framework" ]
}
if (is_win) {
configs -= [ "//build/config/win:winver" ]
configs += [
"//chrome/updater/app/server/win:winver",
"//chrome/updater/win:wrl_strict",
]
}
}
source_set("version_header") {
sources = [ "updater_version.h" ]
}
process_version("updater_version_cc") {
sources = [ "//chrome/VERSION" ]
template_file = "updater_version.cc.in"
output = "$target_gen_dir/updater_version.cc"
}
process_version("updater_version_cc_offset") {
sources = [ "//chrome/VERSION" ]
template_file = "updater_version_offset.cc.in"
output = "$target_gen_dir/updater_version_offset.cc"
}
process_version("branding_header") {
extra_args = [
"-e",
"COMPANY_FULLNAME=\"$updater_company_full_name\"",
"-e",
"COMPANY_SHORTNAME=\"$updater_company_short_name\"",
"-e",
"PRODUCT_FULLNAME=\"$updater_product_full_name\"",
"-e",
"COPYRIGHT=\"updater_copyright\"",
"-e",
"MAC_BUNDLE_IDENTIFIER=\"$mac_updater_bundle_identifier\"",
"-e",
"BROWSER_NAME=\"$browser_name\"",
"-e",
"MAC_BROWSER_BUNDLE_IDENTIFIER=\"$mac_browser_bundle_identifier\"",
"-e",
"UPDATE_CHECK_URL=\"$update_check_url\"",
"-e",
"CRASH_UPLOAD_URL=\"$crash_upload_url\"",
"-e",
"CRASH_STAGING_UPLOAD_URL=\"$crash_staging_upload_url\"",
"-e",
"DEVICE_MANAGEMENT_SERVER_URL=\"$device_management_server_url\"",
]
template_file = "updater_branding.h.in"
output = "$target_gen_dir/updater_branding.h"
}
source_set("updater_tests_support") {
testonly = true
sources = [
"unittest_util.cc",
"unittest_util.h",
]
deps = [
":base",
":lib",
"//base",
]
}
source_set("browser_sources") {
sources = [
"//chrome/updater/constants.cc",
"//chrome/updater/constants.h",
"//chrome/updater/enum_traits.h",
"//chrome/updater/registration_data.cc",
"//chrome/updater/registration_data.h",
"//chrome/updater/update_service.cc",
"//chrome/updater/update_service.h",
]
deps = [
":branding_header",
"//base",
"//components/update_client",
]
if (is_mac) {
sources += [
"//chrome/updater/app/server/mac/service_protocol.h",
"//chrome/updater/app/server/mac/service_protocol.mm",
"//chrome/updater/app/server/mac/update_service_wrappers.h",
"//chrome/updater/app/server/mac/update_service_wrappers.mm",
]
}
visibility = [
"//chrome/browser/ui:ui",
"//chrome/browser/updater:*",
]
}
source_set("updater_test_sources") {
testonly = true
sources = [
"app/app_server_unittest.cc",
"enum_traits_unittest.cc",
"external_constants_builder_unittest.cc",
"external_constants_override_unittest.cc",
"lib_util_unittest.cc",
"persisted_data_unittest.cc",
"policy_manager_unittest.cc",
"policy_service_unittest.cc",
"prefs_unittest.cc",
"tag_unittest.cc",
"test/integration_test_commands.h",
"test/integration_test_commands_system.cc",
"test/integration_test_commands_user.cc",
"test/integration_tests.cc",
"test/integration_tests_impl.cc",
"test/integration_tests_impl.h",
"test/server.cc",
"test/server.h",
"unittest_util_unittest.cc",
"update_service_unittest.cc",
"updater_scope_unittest.cc",
"updater_unittest.cc",
]
deps = [
":base",
":branding_header",
":lib",
":updater",
":updater_tests_support",
":updater_version_cc",
":version_header",
"//base",
"//base/test:test_support",
"//chrome/common:constants",
"//chrome/updater/device_management:unittest",
"//chrome/updater/test/test_app:constants",
"//chrome/updater/test/test_app:version_header",
"//chrome/updater/tools:unittest",
"//components/prefs:test_support",
"//components/update_client",
"//net:test_support",
"//testing/gtest",
"//third_party/re2",
"//url",
]
if (is_win) {
sources += [ "test/integration_tests_win.cc" ]
deps += [
"//chrome/updater/app/server/win:updater_idl_idl",
"//chrome/updater/app/server/win:updater_internal_idl_idl",
"//chrome/updater/app/server/win:updater_legacy_idl_idl",
"//chrome/updater/win:constants",
"//chrome/updater/win:updater_tests",
]
data_deps = [
"//chrome/updater/win:updater",
"//chrome/updater/win/installer",
]
}
if (is_mac) {
sources += [
"mac/scoped_xpc_service_mock.h",
"mac/scoped_xpc_service_mock.mm",
"mac/update_service_proxy_test.mm",
"test/integration_tests_mac.mm",
]
deps += [
"//chrome/common/mac:launchd",
"//chrome/updater/app/server/mac:protocol",
"//chrome/updater/mac:enterprise_tests",
"//chrome/updater/mac:network_fetcher_sources",
"//chrome/updater/mac:updater_bundle",
"//chrome/updater/mac:updater_setup_tests",
"//chrome/updater/mac:updater_tests",
"//chrome/updater/mac:xpc_names",
"//third_party/ocmock",
]
data_deps = [
"//chrome/updater/mac:updater_bundle",
"//chrome/updater/test/test_app",
]
}
}
# These tests are run serially since they mutate system state.
test("updater_tests") {
testonly = true
sources = [
"run_all_unittests.cc",
"test/integration_test_commands_factory_user.cc",
]
deps = [
":updater_test_sources",
"//base/test:test_support",
"//chrome/common:constants",
"//testing/gtest",
]
if (is_win) {
deps += [ "//chrome/updater/win:updater_tests" ]
}
data_deps = [ "//chrome/updater/test/test_app" ]
if (is_mac) {
data_deps += [ "//chrome/updater/mac:updater_bundle" ]
}
}
test("updater_tests_system") {
testonly = true
sources = [
"run_all_unittests.cc",
"test/integration_test_commands_factory_system.cc",
]
deps = [
":updater_test_sources",
"//base/test:test_support",
"//chrome/common:constants",
"//testing/gtest",
]
if (is_win) {
deps += [ "//chrome/updater/win:updater_tests" ]
}
data_deps = [ ":updater_integration_tests_helper" ]
if (is_mac) {
data_deps += [
"//chrome/updater/mac:updater_bundle",
"//chrome/updater/test/test_app",
]
}
}
executable("updater_integration_tests_helper") {
testonly = true
sources = [
"test/integration_test_commands_factory_system.cc",
"test/integration_tests_helper.cc",
]
deps = [
":base",
":lib",
":updater_test_sources",
"//base",
"//base/test:test_support",
"//url",
]
}
}