Skip to content

Commit

Permalink
Cleanup chrome/common/chrome_version.h handling
Browse files Browse the repository at this point in the history
Rename "version.h" to "chrome/common/chrome_version.h"
Update #include and GYP/GN references
Generate on all platforms
Remove redundant generated chrome/common/chrome_version.cc.version
Fix DEPS include_rules

BUG=542807

Committed: https://crrev.com/59647ecac9524d954010d3d10b539ee4a340bf94
Cr-Commit-Position: refs/heads/master@{#355196}

Committed: https://crrev.com/31f086c2013853749cac45522eb950b9d0ab0302
Cr-Commit-Position: refs/heads/master@{#355377}

Review URL: https://codereview.chromium.org/1405633002

Cr-Commit-Position: refs/heads/master@{#355434}
  • Loading branch information
mdempsky authored and Commit bot committed Oct 21, 2015
1 parent fab6928 commit 15a48be
Show file tree
Hide file tree
Showing 28 changed files with 88 additions and 123 deletions.
16 changes: 0 additions & 16 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -425,22 +425,6 @@ group("child_dependencies") {
}

if (is_win) {
# TODO(brettw) this duplicates "//chrome/common:version" which applies to
# Linux.
process_version("version_header") {
# TODO(brettW) this should have more reduced visibility, but chrome/browser
# currently depends on this.
#visibility = [ ":*" ]

# This one just uses the custom template and no separate sources.
sources = []
template_file = "version.h.in"

# TODO(brettw) this should move to $target_gen_dir/version.h and
# source files including it should reference it via "chrome/version.h"
output = "$root_gen_dir/version.h"
}

process_version("chrome_exe_version") {
template_file = chrome_version_rc_template
sources = [
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ source_set("browser") {
]
deps += [
":chrome_process_finder",
"//chrome:version_header",
"//chrome/common:version_header",
"//chrome/installer/util:strings",
"//chrome_elf",
"//chrome_elf:constants",
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chrome_elf_init_unittest_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_reg_util_win.h"
#include "chrome/common/chrome_version.h"
#include "chrome_elf/chrome_elf_constants.h"
#include "components/variations/entropy_provider.h"
#include "components/variations/variations_associated_data.h"
#include "components/version_info/version_info.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "version.h" // NOLINT

namespace {

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chrome_elf_init_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
#include "chrome/browser/chrome_elf_init_win.h"
#include "chrome/common/chrome_version.h"
#include "chrome_elf/blacklist/blacklist.h"
#include "chrome_elf/chrome_elf_constants.h"
#include "chrome_elf/dll_hash/dll_hash.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/browser_thread.h"
#include "version.h" // NOLINT

const char kBrowserBlacklistTrialName[] = "BrowserBlacklist";
const char kBrowserBlacklistTrialDisabledGroupName[] = "NoBlacklist";
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/google/google_update_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#include "base/version.h"
#include "base/win/registry.h"
#include "base/win/scoped_comptr.h"
#include "chrome/common/chrome_version.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/helper.h"
#include "google_update/google_update_idl.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/win/atl_module.h"
#include "version.h"

using ::testing::DoAll;
using ::testing::HasSubstr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "version.h" // NOLINT
#include "chrome/common/chrome_version.h"

namespace safe_browsing {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#include "chrome/browser/safe_browsing/incident_reporting/incident.h"
#include "chrome/browser/safe_browsing/incident_reporting/mock_incident_receiver.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_version.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "version.h" // NOLINT

using ::testing::_;
using ::testing::StrictMock;
Expand Down
35 changes: 0 additions & 35 deletions chrome/chrome.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -414,41 +414,6 @@
'version_resource_rules.gypi',
],
},
{
# GN version: //chrome:version_header
'target_name': 'chrome_version_header',
'type': 'none',
'hard_dependency': 1,
'actions': [
{
'action_name': 'version_header',
'variables': {
'lastchange_path':
'<(DEPTH)/build/util/LASTCHANGE',
'branding_path': 'app/theme/<(branding_path_component)/BRANDING',
},
'inputs': [
'<(version_path)',
'<(branding_path)',
'<(lastchange_path)',
'version.h.in',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/version.h',
],
'action': [
'python',
'<(version_py_path)',
'-f', '<(version_path)',
'-f', '<(branding_path)',
'-f', '<(lastchange_path)',
'version.h.in',
'<@(_outputs)',
],
'message': 'Generating version header file: <@(_outputs)',
},
],
},
{
'target_name': 'crash_service',
'type': 'executable',
Expand Down
2 changes: 1 addition & 1 deletion chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3733,7 +3733,7 @@
'chrome_process_finder',
'chrome_watcher_client',
'installer_util_strings',
'../chrome/chrome.gyp:chrome_version_header',
'../chrome/common_constants.gyp:version_header',
'../chrome_elf/chrome_elf.gyp:chrome_elf',
'../chrome_elf/chrome_elf.gyp:chrome_elf_constants',
'../chrome_elf/chrome_elf.gyp:dll_hash',
Expand Down
2 changes: 1 addition & 1 deletion chrome/chrome_installer.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@
'target_name': 'setup',
'type': 'executable',
'dependencies': [
'chrome_version_header',
'installer_util',
'installer_util_strings',
'../base/base.gyp:base',
'../breakpad/breakpad.gyp:breakpad_handler',
'../chrome/common_constants.gyp:common_constants',
'../chrome/common_constants.gyp:version_header',
'../chrome_elf/chrome_elf.gyp:chrome_elf_constants',
'../rlz/rlz.gyp:rlz_lib',
'../third_party/zlib/zlib.gyp:zlib',
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,7 @@
'hard_dependency': 1,
'dependencies': [
'automation_client_lib',
'common_constants.gyp:version_header',
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../crypto/crypto.gyp:crypto',
Expand Down
20 changes: 14 additions & 6 deletions chrome/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (enable_extensions) {
}
}

# GYP version: chrome/chrome_common.gyp:common
# GYP version: chrome/chrome_common.gypi:common
static_library("common") {
sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome")
defines = []
Expand Down Expand Up @@ -269,12 +269,20 @@ static_library("common") {
}
}

process_version("make_chrome_version") {
template_file = "chrome_version.cc.version"
output = "$target_gen_dir/chrome_version.cc"
# GYP version: chrome/common_constants.gyp:version_header
process_version("version_header") {
# TODO(brettw) this should have more reduced visibility, but chrome/browser
# currently depends on this.
#visibility = [ ":*" ]

# This one just uses the custom template and no separate sources.
sources = []
template_file = "chrome_version.h.in"

output = "$target_gen_dir/chrome_version.h"
}

# GN version: chrome/common_constants.gyp:common_constants
# GYP version: chrome/common_constants.gyp:common_constants
static_library("constants") {
sources = [
"chrome_constants.cc",
Expand Down Expand Up @@ -303,7 +311,7 @@ static_library("constants") {
"//content/public/common:result_codes",
]
deps = [
":make_chrome_version",
":version_header",
"//base",
"//base/third_party/dynamic_annotations",
"//components/bookmarks/common",
Expand Down
3 changes: 3 additions & 0 deletions chrome/common/chrome_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_version.h"

#define FPL FILE_PATH_LITERAL

Expand All @@ -19,6 +20,8 @@

namespace chrome {

const char kChromeVersion[] = CHROME_VERSION_STRING;

#if defined(OS_WIN)
const char kChromeVersionEnvVar[] = "CHROME_VERSION";
#endif
Expand Down
11 changes: 0 additions & 11 deletions chrome/common/chrome_version.cc.version

This file was deleted.

File renamed without changes.
84 changes: 49 additions & 35 deletions chrome/common_constants.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
{
'variables': {
'chromium_code': 1,
},

'includes': [
'../build/util/version.gypi',
],

'target_defaults': {
'sources': [
'common_constants_sources': [
'common/chrome_constants.cc',
'common/chrome_constants.h',
'common/chrome_icon_resources_win.cc',
Expand All @@ -33,43 +26,60 @@
'common/pref_names.cc',
'common/pref_names.h',
],
'actions': [
{
'action_name': 'Make chrome_version.cc',
'variables': {
'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
'template_input_path': 'common/chrome_version.cc.version',
},
'inputs': [
'<(version_py_path)',
'<(version_path)',
'<(lastchange_path)',
'<(template_input_path)',
],
'outputs': [
'<(INTERMEDIATE_DIR)/chrome_version.cc',
],
'action': [
'python',
'<(version_py_path)',
'-f', '<(version_path)',
'-f', '<(lastchange_path)',
'<(template_input_path)',
'<@(_outputs)',
],
'process_outputs_as_sources': 1,
},
],
},

'includes': [
'../build/util/version.gypi',
],

'targets': [
{
# GN version: //chrome/common:version_header
'target_name': 'version_header',
'type': 'none',
'hard_dependency': 1,
'actions': [
{
'action_name': 'version_header',
'variables': {
'lastchange_path':
'<(DEPTH)/build/util/LASTCHANGE',
'branding_path': 'app/theme/<(branding_path_component)/BRANDING',
},
'inputs': [
'<(version_path)',
'<(branding_path)',
'<(lastchange_path)',
'common/chrome_version.h.in',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/chrome/common/chrome_version.h',
],
'action': [
'python',
'<(version_py_path)',
'-f', '<(version_path)',
'-f', '<(branding_path)',
'-f', '<(lastchange_path)',
'common/chrome_version.h.in',
'<@(_outputs)',
],
'message': 'Generating version header file: <@(_outputs)',
},
],
},
{
# GN version: //chrome/common:constants
'target_name': 'common_constants',
'type': 'static_library',
'sources': [
'<@(common_constants_sources)'
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)', # Needed by chrome_paths.cc.
],
'dependencies': [
'version_header',
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../components/components.gyp:bookmarks_common',
Expand Down Expand Up @@ -99,10 +109,14 @@
{
'target_name': 'common_constants_win64',
'type': 'static_library',
'sources': [
'<@(common_constants_sources)'
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)', # Needed by chrome_paths.cc.
],
'dependencies': [
'version_header',
'../base/base.gyp:base_win64',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
'../components/nacl.gyp:nacl_switches_win64',
Expand Down
2 changes: 1 addition & 1 deletion chrome/installer/setup/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (is_win) {
deps = [
":lib",
"//build/config/sanitizers:deps",
"//chrome:version_header",
"//chrome/common:version_header",
]
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/installer/setup/setup_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version.h"
#include "chrome/installer/setup/archive_patch_helper.h"
#include "chrome/installer/setup/install.h"
#include "chrome/installer/setup/install_worker.h"
Expand Down Expand Up @@ -68,7 +69,6 @@
#include "chrome/installer/util/self_cleaning_temp_dir.h"
#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/user_experiment.h"
#include "version.h" // NOLINT

#if defined(GOOGLE_CHROME_BUILD)
#include "chrome/installer/util/updating_app_registration_data.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/test/chromedriver/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ source_set("lib") {
":embed_version_in_cpp",
"//base",
"//base/third_party/dynamic_annotations",
"//chrome/common:version_header",
"//crypto",
"//net",
"//net:http_server",
Expand Down
Loading

0 comments on commit 15a48be

Please sign in to comment.