blob: 801063366996ee16749ec6b623d8270ef0bc9139 [file] [log] [blame]
# Copyright 2014 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("//base/win/embedded_i18n/generate_embedded_i18n.gni")
import("//build/config/chrome_build.gni")
import("//testing/test.gni")
# This file deliberately has no default "util" target so dependants have to
# specify with the ":with_no_strings" or ":with_rc_strings" variants. Random
# code that ends up getting linked into chrome proper should depend on the
# ":with_no_strings" variant. Other standalone apps will need to decide if they
# need the resource strings or not.
#
# chrome/installer/util has generated strings on Windows. These appear as
# Windows resources and are fairly large (~200KB). They are generated by the
# ":generate_strings" target and compiled by the ":strings" target.
#
# Some code, like the Windows chrome.exe (the small bootstrap binary, not
# all of chrome.dll) code uses installer_util functions without calling any
# functions that use the strings. And historically in the GYP build the strings
# resource had to be manually linked, so the strings never ended up being in
# chrome.exe and everything was fine.
#
# Other code, like chrome.dll links to installer util, and hooks up a
# TranslationDelegate which overrides the strings retrieved from the resources
# with grit pak strings.
#
# In both of these cases, link to the ":with_no_strings" variant. However, this
# is obviously a fragile and confusing situation. In the "I don't use strings at
# all case", there is no definition of what works and doesn't work, and this may
# also change over time. As an example at the time of this writing, chrome.exe
# calls GoogleUpdateSettings::UpdateDidRunState. This function doesn't use any
# strings, but other functions in InstallUtil do use localized strings.
#
# Ideally, this should be cleaved in two parts: the main "installer util" and
# some kind of mini installer util that just contains the functions needed by
# chrome.exe and any other clients that don't need the strings. It's likely
# we would still need the variant with no strings for when chrome.dll replaces
# all strings with its own versions.
static_library("with_no_strings") {
public_deps = [ ":constants" ]
deps = [
"//base",
"//chrome:strings",
"//chrome/common:constants",
"//components/variations",
"//content/public/common:result_codes",
]
# The constants target checks the Chrome distribution from this target. Both
# targets have to be linked together in practice.
allow_circular_includes_from = [ "//chrome/common:constants" ]
if (is_win) {
sources = [
"delete_after_reboot_helper.cc",
"delete_after_reboot_helper.h",
"experiment.cc",
"experiment.h",
"experiment_labels.cc",
"experiment_labels.h",
"experiment_metrics.cc",
"experiment_metrics.h",
"experiment_storage.cc",
"experiment_storage.h",
"html_dialog.h",
"html_dialog_impl.cc",
"logging_installer.cc",
"logging_installer.h",
"lzma_util.cc",
"lzma_util.h",
"master_preferences.cc",
"master_preferences.h",
"registry_entry.cc",
"registry_entry.h",
"scoped_token_privilege.cc",
"scoped_token_privilege.h",
"scoped_user_protocol_entry.cc",
"scoped_user_protocol_entry.h",
"self_cleaning_temp_dir.cc",
"self_cleaning_temp_dir.h",
"shell_util.cc",
"shell_util.h",
]
public_deps += [ ":did_run_support" ]
deps += [
# Need to depend on the generated strings target since files here
# depend on the generated header, but only depend on the ":strings"
# target (which actually compiles and causes the generated code to be
# linked) from the ":util" target.
":generate_strings",
"//base:i18n",
"//base/third_party/dynamic_annotations",
"//build:branding_buildflags",
"//chrome/install_static:install_static_util",
"//components/base32",
"//components/metrics",
"//courgette:courgette_lib",
"//crypto",
"//rlz/buildflags",
"//third_party/icu",
"//third_party/lzma_sdk",
]
libs = [
"urlmon.lib",
"wtsapi32.lib",
]
configs += [
"//build/config:precompiled_headers",
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
"//build/config/compiler:no_size_t_to_int_warning",
]
sources += [
"advanced_firewall_manager_win.cc",
"advanced_firewall_manager_win.h",
"app_command.cc",
"app_command.h",
"app_commands.cc",
"app_commands.h",
"auto_launch_util.cc",
"auto_launch_util.h",
"beacons.cc",
"beacons.h",
"callback_work_item.cc",
"callback_work_item.h",
"channel_info.cc",
"channel_info.h",
"conditional_work_item_list.cc",
"conditional_work_item_list.h",
"copy_tree_work_item.cc",
"copy_tree_work_item.h",
"create_dir_work_item.cc",
"create_dir_work_item.h",
"create_reg_key_work_item.cc",
"create_reg_key_work_item.h",
"delete_old_versions.cc",
"delete_old_versions.h",
"delete_reg_key_work_item.cc",
"delete_reg_key_work_item.h",
"delete_reg_value_work_item.cc",
"delete_reg_value_work_item.h",
"delete_tree_work_item.cc",
"delete_tree_work_item.h",
"duplicate_tree_detector.cc",
"duplicate_tree_detector.h",
"firewall_manager_win.cc",
"firewall_manager_win.h",
"google_update_settings.cc",
"google_update_settings.h",
"google_update_util.cc",
"google_update_util.h",
"helper.cc",
"helper.h",
"install_service_work_item.cc",
"install_service_work_item.h",
"install_service_work_item_impl.cc",
"install_service_work_item_impl.h",
"install_util.cc",
"install_util.h",
"installation_state.cc",
"installation_state.h",
"l10n_string_util.cc",
"l10n_string_util.h",
"move_tree_work_item.cc",
"move_tree_work_item.h",
"registry_key_backup.cc",
"registry_key_backup.h",
"set_reg_value_work_item.cc",
"set_reg_value_work_item.h",
"work_item.cc",
"work_item.h",
"work_item_list.cc",
"work_item_list.h",
]
} else {
sources = [
"master_preferences.cc",
"master_preferences.h",
]
}
}
# Use this version of installer_util to link to the generated strings in .rc
# format.
group("with_rc_strings") {
public_deps = [ ":with_no_strings" ]
if (is_win) {
public_deps += [ ":strings" ]
}
}
generate_embedded_i18n("generate_strings") {
visibility = [
":strings",
":with_no_strings",
]
extractor_datafile =
"//chrome/installer/util/prebuild/create_installer_string_rc.py"
grdfile_folder = "//chrome/app/"
if (is_chrome_branded) {
grdfile_name = "google_chrome_strings"
} else {
grdfile_name = "chromium_strings"
}
xtb_relative_path = "resources"
grd_files_info = [ [
grdfile_folder,
grdfile_name,
xtb_relative_path,
default_embedded_i18_locales,
] ]
output_file_name_base = "installer_util_strings"
branding = branding_path_component
}
# Compile the generated .rc file.
source_set("strings") {
sources = get_target_outputs(":generate_strings")
public_deps = [ ":generate_strings" ]
}
source_set("constants") {
public = [ "master_preferences_constants.h" ]
sources = [ "master_preferences_constants.cc" ]
if (is_win) {
public += [
"google_update_constants.h",
"util_constants.h",
]
sources += [
"google_update_constants.cc",
"util_constants.cc",
]
public_deps = [ "//base" ]
}
}
if (is_win) {
source_set("did_run_support") {
public = [ "update_did_run_state.h" ]
sources = [ "update_did_run_state.cc" ]
deps = [
":constants",
"//base",
"//chrome/install_static:install_static_util",
]
}
source_set("test_support") {
testonly = true
sources = [
"fake_installation_state.h",
"fake_product_state.h",
]
deps = [
":with_no_strings",
"//base",
]
}
# This source set contains tests that must run serially. These are linked into
# setup_unittests, which does so.
source_set("serial_unittests") {
testonly = true
sources = [ "install_service_work_item_unittest.cc" ]
deps = [
":with_no_strings",
"//base",
"//chrome/install_static:install_static_util",
"//chrome/install_static/test:test_support",
"//testing/gtest",
]
}
test("installer_util_unittests") {
sources = [
"advanced_firewall_manager_win_unittest.cc",
"beacons_unittest.cc",
"callback_work_item_unittest.cc",
"channel_info_unittest.cc",
"conditional_work_item_list_unittest.cc",
"copy_tree_work_item_unittest.cc",
"create_dir_work_item_unittest.cc",
"create_reg_key_work_item_unittest.cc",
"delete_after_reboot_helper_unittest.cc",
"delete_old_versions_unittest.cc",
"delete_reg_key_work_item_unittest.cc",
"delete_reg_value_work_item_unittest.cc",
"delete_tree_work_item_unittest.cc",
"duplicate_tree_detector_unittest.cc",
"experiment_labels_unittest.cc",
"experiment_storage_unittest.cc",
"experiment_unittest.cc",
"google_update_settings_unittest.cc",
"install_util_unittest.cc",
"l10n_string_util_unittest.cc",
"logging_installer_unittest.cc",
"lzma_util_unittest.cc",
"master_preferences_unittest.cc",
"move_tree_work_item_unittest.cc",
"product_state_unittest.cc",
"product_unittest.cc",
"registry_key_backup_unittest.cc",
"registry_test_data.cc",
"registry_test_data.h",
"run_all_unittests.cc",
"scoped_token_privilege_unittest.cc",
"scoped_user_protocol_entry_unittest.cc",
"self_cleaning_temp_dir_unittest.cc",
"set_reg_value_work_item_unittest.cc",
"shell_util_unittest.cc",
"work_item_list_unittest.cc",
"work_item_mocks.cc",
"work_item_mocks.h",
"work_item_unittest.cc",
]
deps = [
":test_support",
":with_rc_strings",
"//base",
"//base/test:test_support",
"//build:branding_buildflags",
"//chrome:other_version",
"//chrome/common:constants",
"//chrome/install_static:install_static_util",
"//chrome/install_static/test:test_support",
"//chrome/installer/setup:lib",
"//chrome/installer/test:alternate_version_generator_lib",
"//components/variations",
"//rlz/buildflags",
"//testing/gmock",
"//testing/gtest",
]
data = [
"//chrome/test/data/extensions/",
"//chrome/test/data/installer/",
]
}
} # is_win