diff options
-rw-r--r-- | base/base.gyp | 12 | ||||
-rw-r--r-- | base/base.scons | 11 | ||||
-rw-r--r-- | base/file_version_info_linux.cc | 39 | ||||
-rwxr-xr-x | chrome/tools/build/linux/version.sh | 17 |
4 files changed, 55 insertions, 24 deletions
diff --git a/base/base.gyp b/base/base.gyp index da7a0df..2c185d3 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -324,7 +324,9 @@ { 'action_name': 'linux_version', 'variables': { - 'template_input_path': 'file_version_info_linux.h.version' + 'template_input_path': 'file_version_info_linux.h.version', + 'template_output_path': + '<(INTERMEDIATE_DIR)/base/file_version_info_linux.h', }, 'inputs': [ '<(template_input_path)', @@ -339,11 +341,15 @@ }], ], 'outputs': [ - '<(INTERMEDIATE_DIR)/base/file_version_info_linux.h', + # Use a non-existant output so this action always runs and + # generates version information, e.g. to capture revision + # changes, which aren't captured by file dependencies. + '<(INTERMEDIATE_DIR)/base/file_version_info_linux.bogus', ], 'action': [ '../chrome/tools/build/linux/version.sh', - '<(template_input_path)', '<@(_outputs)', '../chrome' + '<(template_input_path)', '<(template_output_path)', + '../chrome' ], }, ], diff --git a/base/base.scons b/base/base.scons index f3a7f9b..09f5948 100644 --- a/base/base.scons +++ b/base/base.scons @@ -404,6 +404,17 @@ if env.Bit('linux'): 'worker_pool_linux.cc', ]) + linux_version = env.Command('$BASE_DIR/file_version_info_linux.h', + 'file_version_info_linux.h.version', + ('../chrome/tools/build/linux/version.sh' + ' ${SOURCE}' + ' ${TARGET}' + ' ../chrome')) + env.AlwaysBuild(linux_version) + # Always generate version information, e.g. to capture revision changes, which + # aren't captured by file dependencies. + env.Append(CPPPATH = ['$OBJ_ROOT']) + env.ChromeLibrary('base', input_files) p = env.ChromeMSVSProject('build/base.vcproj', diff --git a/base/file_version_info_linux.cc b/base/file_version_info_linux.cc index 59d425a..55e1bd2 100644 --- a/base/file_version_info_linux.cc +++ b/base/file_version_info_linux.cc @@ -3,13 +3,12 @@ // found in the LICENSE file. #include "base/file_version_info.h" +#include "base/file_version_info_linux.h" #include <string> -// TODO(port): This whole file is stubbed. We can't return NULL -// because that is used as a catastrophic error code where the file -// doesn't exist or can't be opened. -// +// TODO(mmoss) This only provides version info for the current binary, but it's +// also called for arbitrary files (e.g. plugins). // See http://code.google.com/p/chromium/issues/detail?id=8132 for a discussion // on what we should do with this module. @@ -23,65 +22,65 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() { } std::wstring FileVersionInfo::company_name() { - return L""; + return COMPANY_NAME; } std::wstring FileVersionInfo::company_short_name() { - return L""; + return COMPANY_SHORT_NAME; } std::wstring FileVersionInfo::product_name() { - return L""; + return PRODUCT_NAME; } std::wstring FileVersionInfo::product_short_name() { - return L""; + return PRODUCT_SHORT_NAME; } std::wstring FileVersionInfo::internal_name() { - return L""; + return INTERNAL_NAME; } std::wstring FileVersionInfo::product_version() { - return L"0.1.2.3.4.5.6-lie"; + return PRODUCT_VERSION; } std::wstring FileVersionInfo::private_build() { - return L""; + return PRIVATE_BUILD; } std::wstring FileVersionInfo::special_build() { - return L""; + return SPECIAL_BUILD; } std::wstring FileVersionInfo::comments() { - return L""; + return COMMENTS; } std::wstring FileVersionInfo::original_filename() { - return L""; + return ORIGINAL_FILENAME; } std::wstring FileVersionInfo::file_description() { - return L""; + return FILE_DESCRIPTION; } std::wstring FileVersionInfo::file_version() { - return L"0.1.2.3.4.5.6-lie"; + return FILE_VERSION; } std::wstring FileVersionInfo::legal_copyright() { - return L""; + return LEGAL_COPYRIGHT; } std::wstring FileVersionInfo::legal_trademarks() { - return L""; + return LEGAL_TRADEMARKS; } std::wstring FileVersionInfo::last_change() { - return L"Last Thursday"; + return LAST_CHANGE; } bool FileVersionInfo::is_official_build() { - return false; + return OFFICIAL_BUILD; } diff --git a/chrome/tools/build/linux/version.sh b/chrome/tools/build/linux/version.sh index 2b6bb61..22fa30a 100755 --- a/chrome/tools/build/linux/version.sh +++ b/chrome/tools/build/linux/version.sh @@ -35,6 +35,14 @@ if [ "$CHROME_BUILD_TYPE" = "_official" ]; then OFFICIAL_BUILD="true" fi +# Write to a temp file and only overwrite the target if it changes, to avoid +# unnecessary compiles due to timestamp changes. +TMPFILE=$(mktemp -q -t chromiumver-XXXX) +if [ $? -ne 0 ]; then + # Oops, just use the target file and suffer possibly unnecessary compile. + TMPFILE="$OUTFILE" +fi + # TODO(mmoss) Make sure no sed special chars in substitutions. sed -e "s/@MAJOR@/$MAJOR/" \ -e "s/@MINOR@/$MINOR/" \ @@ -47,4 +55,11 @@ sed -e "s/@MAJOR@/$MAJOR/" \ -e "s/@PRODUCT_EXE@/$PRODUCT_EXE/" \ -e "s/@COPYRIGHT@/$COPYRIGHT/" \ -e "s/@OFFICIAL_BUILD@/$OFFICIAL_BUILD/" \ - -e "s/@LASTCHANGE@/$LASTCHANGE/" "$TMPL" > "$OUTFILE" + -e "s/@LASTCHANGE@/$LASTCHANGE/" "$TMPL" > "$TMPFILE" + +diff -q "$TMPFILE" "$OUTFILE" >/dev/null 2>&1 +if [ $? -ne 0 ]; then + mv -f "$TMPFILE" "$OUTFILE" +else + rm "$TMPFILE" +fi |