blob: 1dea265bfdc048ac99822a5c242e97dae1c11ad0 [file] [log] [blame]
# Copyright 2020 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/mac/rules.gni")
import("//build/util/process_version.gni")
import("//build/util/version.gni")
import("//chrome/updater/branding.gni")
app_name = "UpdaterTestApp"
app_bundle_id = "org.chromium.updatertestapp"
if (is_mac) {
app_framework_name = app_name + " Framework"
}
group("test_app") {
deps = [ ":app" ]
}
process_version("version_header") {
sources = [ "//chrome/VERSION" ]
extra_args = [
"-e",
"TEST_APP_FULLNAME=\"$app_name\"",
"-e",
"TEST_APP_BUNDLE_IDENTIFIER=\"$app_bundle_id\"",
"-e",
"UPDATER_APP_FULLNAME=\"$updater_product_full_name\"",
"-e",
"UPDATER_APP_BUNDLE_IDENTIFIER=\"$mac_updater_bundle_identifier\"",
"-e",
"TEST_APP_COMPANY_NAME=\"$updater_company_short_name\"",
]
template_file = "test_app_version.h.in"
output = "$target_gen_dir/test_app_version.h"
}
source_set("constants") {
sources = [
"constants.cc",
"constants.h",
]
}
source_set("app_sources") {
sources = [
"//chrome/updater/app/app.cc",
"//chrome/updater/app/app.h",
"test_app.cc",
"test_app.h",
"update_client.cc",
"update_client.h",
]
deps = [
":constants",
":version_header",
"//base",
"//chrome/updater:base",
"//chrome/updater:version_header",
"//components/update_client: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",
"test_app_mac.mm",
"update_client_mac.h",
"update_client_mac.mm",
]
deps += [ "//chrome/updater/mac:xpc_names" ]
frameworks = [ "CoreFoundation.framework" ]
}
if (is_win) {
sources += [
"test_app_win.cc",
"update_client_win.cc",
"update_client_win.h",
]
deps += [
"//chrome/updater/app/server/win:updater_idl_idl",
"//chrome/updater/win:lib",
]
}
}
if (is_win) {
executable("app") {
output_name = "updatertestapp"
sources = [ "main_win.cc" ]
configs += [ "//build/config/win:windowed" ]
deps = [ ":app_sources" ]
}
}
if (is_mac) {
mac_app_bundle("app") {
info_plist = "mac/Info.plist"
output_name = app_name
extra_substitutions = [ "MAC_BUNDLE_IDENTIFIER=$app_bundle_id" ]
sources = [ "main_mac.cc" ]
deps = [
":app_sources",
":bundle_versioned_data",
":version_header",
"//base",
]
}
bundle_data("bundle_versioned_data") {
sources = [ "$root_out_dir/$app_framework_name.framework" ]
outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
public_deps = [ ":app_framework" ]
}
bundle_data("bundle_updater") {
sources = [ "$root_out_dir/$updater_product_full_name.app" ]
outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
public_deps = [ "//chrome/updater/mac:updater_bundle" ]
}
mac_framework_bundle("app_framework") {
output_name = app_framework_name
framework_version = chrome_version_full
framework_contents = [
"Helpers",
"Resources",
]
info_plist = "mac/framework-Info.plist"
extra_substitutions = [ "CHROMIUM_BUNDLE_ID=$app_bundle_id" ]
deps = [ ":bundle_updater" ]
ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$app_framework_name.framework/Versions/$chrome_version_full/$app_framework_name" ]
ldflags += [
"-compatibility_version",
chrome_dylib_version,
"-current_version",
chrome_dylib_version,
]
}
}