diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 19:09:41 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 19:09:41 +0000 |
commit | 06e6f87a7d99758524cefbd9d234b0635c420dbc (patch) | |
tree | d72cc2e2e116a2f8f77252a5c9510953a7540800 /chrome/tools | |
parent | 58531df60b957442c986f947e6e1566fd9cf6084 (diff) | |
download | chromium_src-06e6f87a7d99758524cefbd9d234b0635c420dbc.zip chromium_src-06e6f87a7d99758524cefbd9d234b0635c420dbc.tar.gz chromium_src-06e6f87a7d99758524cefbd9d234b0635c420dbc.tar.bz2 |
Parameterize the Google Update appid at build time instead of hard coding it in the source.
Review URL: http://codereview.chromium.org/178011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25072 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools')
-rw-r--r-- | chrome/tools/build/appid.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/chrome/tools/build/appid.py b/chrome/tools/build/appid.py new file mode 100644 index 0000000..b563022 --- /dev/null +++ b/chrome/tools/build/appid.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# Copyright (c) 2009 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. + +""" +appid.py -- Chromium appid header file generation utility. +""" + +import optparse +import sys + +GENERATED_APPID_INCLUDE_FILE_CONTENTS = """ +// This file is automatically generated by appid.py. +// It contains the Google Update Appid used for this build. Note that +// the Appid will be empty for non Google Chrome builds. +namespace google_update { +const wchar_t kChromeGuid[] = L"%s"; +} +""" + +def GenerateAppIdHeader(opts): + contents = GENERATED_APPID_INCLUDE_FILE_CONTENTS % opts.appid + + output_file = open(opts.output_file, 'w') + try: + output_file.write(contents) + finally: + output_file.close() + +def main(): + parser = optparse.OptionParser() + parser.add_option('-a', '--appid', + help='The Google Update App Id of the Chrome being built.') + parser.add_option('-o', '--output_file', + help='The path to the generated output header file') + + (opts, args) = parser.parse_args() + + if opts.appid is None or not opts.output_file: + parser.print_help() + return 1 + + # Log a trace in the build output when we run. + print "Generating appid header... ", + GenerateAppIdHeader(opts) + + print "Done." + + +if __name__ == '__main__': + sys.exit(main()) |