Commit d2e619ec authored by Michael Chang's avatar Michael Chang Committed by Commit Bot

Use new branding.gni file strings to set macOS chrome/updater target names.

Bug: 1047214
Change-Id: Ie9bf8d7130debcbafcbdd9df2bbe40a5be28ec83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033924
Commit-Queue: Michael Chang <donchan@microsoft.com>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741554}
parent 5a4c8f51
...@@ -131,7 +131,7 @@ FILES = [ ...@@ -131,7 +131,7 @@ FILES = [
}, },
# Updater files: # Updater files:
{ {
'filename': 'GoogleUpdate.app', 'filename': 'GoogleUpdater.app',
'buildtype': ['official'], 'buildtype': ['official'],
'archive': 'updater.zip', 'archive': 'updater.zip',
}, },
......
COMPANY_FULLNAME=Google LLC
COMPANY_SHORTNAME=Google
PRODUCT_FULLNAME=GoogleUpdater
COPYRIGHT=Copyright 2019 The Chromium Authors. All rights reserved.
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//build/util/process_version.gni") import("//build/util/process_version.gni")
import("//chrome/updater/branding.gni")
import("//testing/test.gni") import("//testing/test.gni")
# TODO(sorin): make the code build on Linux. https://crbug.com/1014320 # TODO(sorin): make the code build on Linux. https://crbug.com/1014320
...@@ -72,10 +73,21 @@ if (is_win || is_mac) { ...@@ -72,10 +73,21 @@ if (is_win || is_mac) {
} }
process_version("version_header") { process_version("version_header") {
sources = [ sources = [ "//chrome/VERSION" ]
"//chrome/VERSION",
"BRANDING", 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\"",
] ]
template_file = "updater_version.h.in" template_file = "updater_version.h.in"
output = "$target_gen_dir/updater_version.h" output = "$target_gen_dir/updater_version.h"
} }
......
# 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/chrome_build.gni")
if (is_chrome_branded) {
updater_company_full_name = "Google LLC"
updater_company_short_name = "Google"
updater_product_full_name = "GoogleUpdater"
updater_copyright =
"Copyright 2020 The Chromium Authors. All rights reserved."
mac_updater_bundle_identifier = "com.google.GoogleUpdater"
} else {
updater_company_full_name = "Chromium Authors"
updater_company_short_name = "Chromium"
updater_product_full_name = "ChromiumUpdater"
updater_copyright =
"Copyright 2020 The Chromium Authors. All rights reserved."
mac_updater_bundle_identifier = "org.chromium.ChromiumUpdater"
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/mac/rules.gni") import("//build/config/mac/rules.gni")
import("//chrome/updater/branding.gni")
group("mac") { group("mac") {
deps = [ deps = [
...@@ -43,7 +44,7 @@ source_set("updater_tests") { ...@@ -43,7 +44,7 @@ source_set("updater_tests") {
mac_app_bundle("updater_bundle") { mac_app_bundle("updater_bundle") {
info_plist = "Info.plist" info_plist = "Info.plist"
output_name = "GoogleUpdate" output_name = updater_product_full_name
sources = [ "main.cc" ] sources = [ "main.cc" ]
deps = [ deps = [
......
...@@ -31,9 +31,16 @@ namespace updater { ...@@ -31,9 +31,16 @@ namespace updater {
namespace setup { namespace setup {
namespace { namespace {
const base::FilePath GetUpdateFolderName() {
constexpr base::FilePath::CharType kUpdaterFolder[] = return base::FilePath(COMPANY_SHORTNAME_STRING)
FILE_PATH_LITERAL("Google/GoogleUpdate/"); .AppendASCII(PRODUCT_FULLNAME_STRING);
}
const base::FilePath GetUpdaterAppName() {
return base::FilePath(PRODUCT_FULLNAME_STRING ".app");
}
const base::FilePath GetUpdaterAppExecutablePath() {
return base::FilePath("Contents/MacOS").AppendASCII(PRODUCT_FULLNAME_STRING);
}
void ThreadPoolStart() { void ThreadPoolStart() {
base::ThreadPoolInstance::CreateAndStartWithDefaultParams("UpdaterSetup"); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("UpdaterSetup");
...@@ -83,12 +90,12 @@ void TerminateUpdaterSetupMain() { ...@@ -83,12 +90,12 @@ void TerminateUpdaterSetupMain() {
bool CopyBundle() { bool CopyBundle() {
// Copy bundle to "~/Library/Google/GoogleUpdate". // Copy bundle to "~/Library/Google/GoogleUpdate".
const base::FilePath dest_path = const base::FilePath dest_path =
base::mac::GetUserLibraryPath().Append(kUpdaterFolder); base::mac::GetUserLibraryPath().Append(GetUpdateFolderName());
base::FilePath this_executable_path; base::FilePath this_executable_path;
base::PathService::Get(base::FILE_EXE, &this_executable_path); base::PathService::Get(base::FILE_EXE, &this_executable_path);
const base::FilePath src_path = this_executable_path.DirName().Append( const base::FilePath src_path =
FILE_PATH_LITERAL("GoogleUpdate.app")); this_executable_path.DirName().Append(GetUpdaterAppName());
if (!base::CopyDirectory(src_path, dest_path, true)) { if (!base::CopyDirectory(src_path, dest_path, true)) {
LOG(ERROR) << "Copying app to ~/Library failed"; LOG(ERROR) << "Copying app to ~/Library failed";
...@@ -100,7 +107,7 @@ bool CopyBundle() { ...@@ -100,7 +107,7 @@ bool CopyBundle() {
bool DeleteInstallFolder() { bool DeleteInstallFolder() {
// Delete the install folder - "~/Library/Google/GoogleUpdate". // Delete the install folder - "~/Library/Google/GoogleUpdate".
const base::FilePath dest_path = const base::FilePath dest_path =
base::mac::GetUserLibraryPath().Append(kUpdaterFolder); base::mac::GetUserLibraryPath().Append(GetUpdateFolderName());
if (!base::DeleteFileRecursively(dest_path)) { if (!base::DeleteFileRecursively(dest_path)) {
LOG(ERROR) << "Deleting " << dest_path << " failed"; LOG(ERROR) << "Deleting " << dest_path << " failed";
...@@ -110,8 +117,10 @@ bool DeleteInstallFolder() { ...@@ -110,8 +117,10 @@ bool DeleteInstallFolder() {
} }
base::ScopedCFTypeRef<CFStringRef> CopyGoogleUpdateCheckLaunchDName() { base::ScopedCFTypeRef<CFStringRef> CopyGoogleUpdateCheckLaunchDName() {
return base::ScopedCFTypeRef<CFStringRef>(CFStringCreateCopy( std::string launchd_name = MAC_BUNDLE_IDENTIFIER_STRING;
kCFAllocatorDefault, CFSTR("com.google.GoogleUpdate.check"))); launchd_name.append(".check");
return base::ScopedCFTypeRef<CFStringRef>(
base::SysUTF8ToCFStringRef(launchd_name), base::scoped_policy::RETAIN);
} }
base::scoped_nsobject<NSString> GetGoogleUpdateCheckLaunchDLabel() { base::scoped_nsobject<NSString> GetGoogleUpdateCheckLaunchDLabel() {
...@@ -125,12 +134,11 @@ base::scoped_nsobject<NSString> GetGoogleUpdateCheckMachName() { ...@@ -125,12 +134,11 @@ base::scoped_nsobject<NSString> GetGoogleUpdateCheckMachName() {
base::mac::CFToNSCast(CopyGoogleUpdateCheckLaunchDName())); base::mac::CFToNSCast(CopyGoogleUpdateCheckLaunchDName()));
return base::scoped_nsobject<NSString>( return base::scoped_nsobject<NSString>(
[name stringByAppendingFormat:@".%lu", [name stringByAppendingFormat:@".%lu",
[GetGoogleUpdateCheckLaunchDLabel() hash]], [GetGoogleUpdateCheckLaunchDLabel() hash]]);
base::scoped_policy::RETAIN);
} }
base::ScopedCFTypeRef<CFDictionaryRef> CreateGoogleUpdateCheckLaunchdPlist( base::ScopedCFTypeRef<CFDictionaryRef> CreateGoogleUpdateCheckLaunchdPlist(
base::FilePath* updater_path) { const base::FilePath* updater_path) {
// See the man page for launchd.plist. // See the man page for launchd.plist.
NSDictionary* launchd_plist = @{ NSDictionary* launchd_plist = @{
@LAUNCH_JOBKEY_LABEL : GetGoogleUpdateCheckLaunchDLabel(), @LAUNCH_JOBKEY_LABEL : GetGoogleUpdateCheckLaunchDLabel(),
...@@ -154,11 +162,11 @@ bool CreateLaunchdItems() { ...@@ -154,11 +162,11 @@ bool CreateLaunchdItems() {
base::BlockingType::MAY_BLOCK); base::BlockingType::MAY_BLOCK);
base::ScopedCFTypeRef<CFStringRef> name(CopyGoogleUpdateCheckLaunchDName()); base::ScopedCFTypeRef<CFStringRef> name(CopyGoogleUpdateCheckLaunchDName());
base::FilePath updater_path = const base::FilePath updater_path =
base::mac::GetUserLibraryPath() base::mac::GetUserLibraryPath()
.Append(kUpdaterFolder) .Append(GetUpdateFolderName())
.Append(FILE_PATH_LITERAL("GoogleUpdate.app")) .Append(GetUpdaterAppName())
.Append(FILE_PATH_LITERAL("Contents/MacOS/GoogleUpdate")); .Append(GetUpdaterAppExecutablePath());
base::ScopedCFTypeRef<CFDictionaryRef> plist( base::ScopedCFTypeRef<CFDictionaryRef> plist(
CreateGoogleUpdateCheckLaunchdPlist(&updater_path)); CreateGoogleUpdateCheckLaunchdPlist(&updater_path));
......
...@@ -9,12 +9,13 @@ ...@@ -9,12 +9,13 @@
#include "base/process/process.h" #include "base/process/process.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/updater/updater_version.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#define EXECUTABLE_EXTENSION ".exe" #define EXECUTABLE_EXTENSION ".exe"
#else #else
#define EXECUTABLE_EXTENSION "" #define EXECUTABLE_EXTENSION ".app"
#endif #endif
// Tests the updater process returns 0 when run with --test argument. // Tests the updater process returns 0 when run with --test argument.
...@@ -28,10 +29,11 @@ TEST(UpdaterTest, UpdaterExitCode) { ...@@ -28,10 +29,11 @@ TEST(UpdaterTest, UpdaterExitCode) {
FILE_PATH_LITERAL("updater" EXECUTABLE_EXTENSION)); FILE_PATH_LITERAL("updater" EXECUTABLE_EXTENSION));
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
this_executable_path.DirName() this_executable_path.DirName()
.Append(FILE_PATH_LITERAL("GoogleUpdate.app")) .Append(
FILE_PATH_LITERAL(PRODUCT_FULLNAME_STRING EXECUTABLE_EXTENSION))
.Append(FILE_PATH_LITERAL("Contents")) .Append(FILE_PATH_LITERAL("Contents"))
.Append(FILE_PATH_LITERAL("MacOS")) .Append(FILE_PATH_LITERAL("MacOS"))
.Append(FILE_PATH_LITERAL("GoogleUpdate")); .Append(FILE_PATH_LITERAL(PRODUCT_FULLNAME_STRING));
#else #else
""; "";
#endif #endif
......
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
#define COMPANY_SHORTNAME_STRING "@COMPANY_SHORTNAME@" #define COMPANY_SHORTNAME_STRING "@COMPANY_SHORTNAME@"
#define PRODUCT_FULLNAME_STRING "@PRODUCT_FULLNAME@" #define PRODUCT_FULLNAME_STRING "@PRODUCT_FULLNAME@"
#define OFFICIAL_BUILD_STRING "@OFFICIAL_BUILD@" #define OFFICIAL_BUILD_STRING "@OFFICIAL_BUILD@"
#define MAC_BUNDLE_IDENTIFIER_STRING "@MAC_BUNDLE_IDENTIFIER@"
...@@ -1298,8 +1298,8 @@ class MetaBuildWrapper(object): ...@@ -1298,8 +1298,8 @@ class MetaBuildWrapper(object):
# these will lead to incorrect incremental builds if their directory # these will lead to incorrect incremental builds if their directory
# contents change. Do not add to this list. # contents change. Do not add to this list.
# TODO(https://crbug.com/912946): Remove this if statement. # TODO(https://crbug.com/912946): Remove this if statement.
if ((is_msan and f == 'instrumented_libraries_prebuilt/') or if ((is_msan and f == 'instrumented_libraries_prebuilt/')
f == 'mr_extension/' or # https://crbug.com/997947 or f == 'mr_extension/' or # https://crbug.com/997947
f.startswith('nacl_test_data/') or f.startswith('nacl_test_data/') or
f.startswith('ppapi_nacl_tests_libs/') or f.startswith('ppapi_nacl_tests_libs/') or
(is_cros and f in ( # https://crbug.com/1002509 (is_cros and f in ( # https://crbug.com/1002509
...@@ -1310,17 +1310,17 @@ class MetaBuildWrapper(object): ...@@ -1310,17 +1310,17 @@ class MetaBuildWrapper(object):
'resources/chromeos/accessibility/chromevox/', 'resources/chromeos/accessibility/chromevox/',
'resources/chromeos/accessibility/select_to_speak/', 'resources/chromeos/accessibility/select_to_speak/',
'test_data/chrome/browser/resources/chromeos/accessibility/' 'test_data/chrome/browser/resources/chromeos/accessibility/'
'autoclick/', 'autoclick/',
'test_data/chrome/browser/resources/chromeos/accessibility/' 'test_data/chrome/browser/resources/chromeos/accessibility/'
'chromevox/', 'chromevox/',
'test_data/chrome/browser/resources/chromeos/accessibility/' 'test_data/chrome/browser/resources/chromeos/accessibility/'
'select_to_speak/', 'select_to_speak/',
)) or )) or (is_mac and f in ( # https://crbug.com/1000667
(is_mac and f in ( # https://crbug.com/1000667
'AlertNotificationService.xpc/', 'AlertNotificationService.xpc/',
'Chromium Framework.framework/', 'Chromium Framework.framework/',
'Chromium Helper.app/', 'Chromium Helper.app/',
'Chromium.app/', 'Chromium.app/',
'ChromiumUpdater.app/',
'Content Shell.app/', 'Content Shell.app/',
'Google Chrome Framework.framework/', 'Google Chrome Framework.framework/',
'Google Chrome Helper (GPU).app/', 'Google Chrome Helper (GPU).app/',
...@@ -1328,7 +1328,7 @@ class MetaBuildWrapper(object): ...@@ -1328,7 +1328,7 @@ class MetaBuildWrapper(object):
'Google Chrome Helper (Renderer).app/', 'Google Chrome Helper (Renderer).app/',
'Google Chrome Helper.app/', 'Google Chrome Helper.app/',
'Google Chrome.app/', 'Google Chrome.app/',
'GoogleUpdate.app/', 'GoogleUpdater.app/',
'blink_deprecated_test_plugin.plugin/', 'blink_deprecated_test_plugin.plugin/',
'blink_test_plugin.plugin/', 'blink_test_plugin.plugin/',
'corb_test_plugin.plugin/', 'corb_test_plugin.plugin/',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment