0

updater: refactor the midl generation into a template

This reduces repetitiveness in the build scripts, and will make it
easier to transition to building separate IDL and typelib files for user
and system in the future.

The `linux-chromeos-rel` bot has been retrying since yesterday night. My
change is Windows only, so I'm bypassing this bot with `No-Try: true`.

No-Try: true
Bug: 1496516
Change-Id: I922ab37f116261445516a3a4321f879c0222e8bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5214730
Reviewed-by: Xiaoling Bao <xiaolingbao@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Auto-Submit: S Ganesh <ganesh@chromium.org>
Commit-Queue: S Ganesh <ganesh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1249501}
This commit is contained in:
S. Ganesh
2024-01-19 21:09:50 +00:00
committed by Chromium LUCI CQ
parent e9af5de179
commit 56b29fed09
8 changed files with 47 additions and 55 deletions
chrome
browser
BUILD.gn
enterprise
connectors
device_trust
key_management
browser
commands
google
ui
updater
tools/win

@ -6049,7 +6049,7 @@ static_library("browser") {
"//chrome/installer/util:with_no_strings",
"//chrome/notification_helper:constants",
"//chrome/services/util_win/public/mojom",
"//chrome/updater/app/server/win:updater_legacy_idl_idl",
"//chrome/updater/app/server/win:updater_legacy_idl",
"//components/crash/core/app",
"//components/crash/core/app:crash_export_thunk_include",
"//sandbox/win:sandbox",
@ -6084,7 +6084,7 @@ static_library("browser") {
"//chrome/browser/win/conflicts:module_list_proto",
"//chrome/chrome_elf:sha1",
"//chrome/chrome_elf:third_party_shared_defines",
"//chrome/updater/app/server/win:updater_legacy_idl_idl",
"//chrome/updater/app/server/win:updater_legacy_idl",
]
libs += [ "msi.lib" ]
sources += [

@ -36,7 +36,7 @@ source_set("commands") {
deps += [
"//chrome/install_static:install_static_util",
"//chrome/installer/util:with_no_strings",
"//chrome/updater/app/server/win:updater_legacy_idl_idl",
"//chrome/updater/app/server/win:updater_legacy_idl",
]
}
if (is_linux) {

@ -50,7 +50,7 @@ source_set("google") {
"switches.h",
]
deps += [ "//chrome/updater/app/server/win:updater_legacy_idl_idl" ]
deps += [ "//chrome/updater/app/server/win:updater_legacy_idl" ]
}
deps += [
@ -104,7 +104,7 @@ source_set("unit_tests") {
deps += [
"//chrome/common:version_header",
"//chrome/install_static/test:test_support",
"//chrome/updater/app/server/win:updater_legacy_idl_idl",
"//chrome/updater/app/server/win:updater_legacy_idl",
"//components/policy/core/common",
]
}

@ -4617,7 +4617,7 @@ static_library("ui") {
"webui/settings/incompatible_applications_handler_win.cc",
"webui/settings/incompatible_applications_handler_win.h",
]
deps += [ "//chrome/updater/app/server/win:updater_legacy_idl_idl" ]
deps += [ "//chrome/updater/app/server/win:updater_legacy_idl" ]
} else {
sources += [
"webui/help/version_updater_basic.cc",

@ -303,9 +303,9 @@ if (is_win || is_mac || is_linux) {
"//chrome/installer/util:constants",
"//chrome/installer/util:metainstaller_utils",
"//chrome/installer/util:work_item",
"//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/app/server/win:updater_idl",
"//chrome/updater/app/server/win:updater_internal_idl",
"//chrome/updater/app/server/win:updater_legacy_idl",
"//chrome/updater/win/ui/resources",
"//chrome/updater/win/ui/resources:strings",
"//components/winhttp",
@ -591,7 +591,7 @@ if (is_win || is_mac || is_linux) {
"win/win_constants.h",
]
deps += [ "//chrome/updater/app/server/win:updater_idl_idl" ]
deps += [ "//chrome/updater/app/server/win:updater_idl" ]
configs -= [ "//build/config/win:winver" ]
configs += [
@ -864,9 +864,9 @@ if (is_win || is_mac || is_linux) {
]
deps += [
"app/server/win:updater_idl_idl",
"app/server/win:updater_internal_idl_idl",
"app/server/win:updater_legacy_idl_idl",
"app/server/win:updater_idl",
"app/server/win:updater_internal_idl",
"app/server/win:updater_legacy_idl",
"win/installer:lib",
"win/installer:msi_custom_action_sources",
"win/test:test_executables",

@ -10,7 +10,10 @@ import("//chrome/version.gni")
# system identities for interfaces that are decorated with `BEGIN_INTERFACE` and
# `END_INTERFACE`.
template("generate_user_system_idl") {
action(target_name + "_generate_user_system_idl") {
assert(defined(invoker.idl_template_filename),
"Need `idl_template_filename` in $target_name.")
action(target_name) {
script = "generate_user_system_idl.py"
inputs = [
script,
@ -27,6 +30,25 @@ template("generate_user_system_idl") {
}
}
template("midl_user_system_idl") {
assert(defined(invoker.replacement_guids),
"Need `replacement_guids` in $target_name for placeholder guids.")
target_name_generate = target_name + "_gen"
target_name_template = target_name + ".template"
generate_user_system_idl(target_name_generate) {
idl_template_filename = target_name_template
}
midl(target_name) {
dynamic_guids = "ignore_proxy_stub," + invoker.replacement_guids
sources = get_target_outputs(":$target_name_generate")
writes_tlb = true
deps = [ ":$target_name_generate" ]
}
}
# These GUIDs must depend on branding only.
branding_only_placeholder_guids = [
"PLACEHOLDER-GUID-69464FF0-D9EC-4037-A35F-8AE4358106CC", # UpdaterLib
@ -69,18 +91,8 @@ foreach(guid, branding_only_placeholder_guids) {
}
uuid5_guids = string_join(",", uuid5_guids)
generate_user_system_idl("updater_idl") {
idl_template_filename = "updater_idl.template"
}
midl("updater_idl_idl") {
dynamic_guids = "ignore_proxy_stub," + uuid5_guids
sources = [ "$target_gen_dir/updater_idl.template" ]
writes_tlb = true
deps = [ ":updater_idl_generate_user_system_idl" ]
midl_user_system_idl("updater_idl") {
replacement_guids = uuid5_guids
}
# These GUIDs must depend on branding and version.
@ -103,18 +115,8 @@ foreach(guid, branding_version_placeholder_guids) {
}
uuid5_guids = string_join(",", uuid5_guids)
generate_user_system_idl("updater_internal_idl") {
idl_template_filename = "updater_internal_idl.template"
}
midl("updater_internal_idl_idl") {
dynamic_guids = "ignore_proxy_stub," + uuid5_guids
sources = [ "$target_gen_dir/updater_internal_idl.template" ]
writes_tlb = true
deps = [ ":updater_internal_idl_generate_user_system_idl" ]
midl_user_system_idl("updater_internal_idl") {
replacement_guids = uuid5_guids
}
updater_legacy_idl_guids = [
@ -172,18 +174,8 @@ updater_legacy_idl_guids = [
]
updater_legacy_idl_guids = string_join(",", updater_legacy_idl_guids)
generate_user_system_idl("updater_legacy_idl") {
idl_template_filename = "updater_legacy_idl.template"
}
midl("updater_legacy_idl_idl") {
dynamic_guids = "ignore_proxy_stub," + updater_legacy_idl_guids
sources = [ "$target_gen_dir/updater_legacy_idl.template" ]
writes_tlb = true
deps = [ ":updater_legacy_idl_generate_user_system_idl" ]
midl_user_system_idl("updater_legacy_idl") {
replacement_guids = updater_legacy_idl_guids
}
# The COM server needs to work with Windows 7, so explicitly setting the defines

@ -86,8 +86,8 @@ artifact_zip("updater_zip") {
] + get_target_outputs(":signing")
deps = [
":signing",
"//chrome/updater/app/server/win:updater_idl_idl",
"//chrome/updater/app/server/win:updater_internal_idl_idl",
"//chrome/updater/app/server/win:updater_idl",
"//chrome/updater/app/server/win:updater_internal_idl",
"//chrome/updater/test/qualification_app",
"//chrome/updater/win/installer",
"//chrome/updater/win/installer:installer_test",

@ -138,9 +138,9 @@ def main():
for target_cpu in ['arm64', 'x64', 'x86']:
for idl_target in [
'updater_idl_idl',
'updater_internal_idl_idl',
'updater_legacy_idl_idl',
'updater_idl',
'updater_internal_idl',
'updater_legacy_idl',
'google_update',
'elevation_service_idl',
'gaia_credential_provider_idl',