diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 02:33:04 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 02:33:04 +0000 |
commit | 5f9d02c528815968da8dd10058195276ede6eb3d (patch) | |
tree | 0c8718d71ee89bf51a25fa39c75450c891237cb8 /ceee | |
parent | 51bd0b0d14f9bb0354061ca69f6be144090accc1 (diff) | |
download | chromium_src-5f9d02c528815968da8dd10058195276ede6eb3d.zip chromium_src-5f9d02c528815968da8dd10058195276ede6eb3d.tar.gz chromium_src-5f9d02c528815968da8dd10058195276ede6eb3d.tar.bz2 |
Branding support for FF CEEE.
BUG=65191
TEST=it builds, expanding ceee_ff.xpi you find no strings like @CEEE_PRODUCT_FULLNAME@
Review URL: http://codereview.chromium.org/5604003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee')
-rw-r--r-- | ceee/firefox/content/about.xul | 6 | ||||
-rw-r--r-- | ceee/firefox/firefox.gyp | 49 | ||||
-rw-r--r-- | ceee/firefox/install.rdf | 8 | ||||
-rw-r--r-- | ceee/firefox/locale/en-US/ceee.dtd | 6 | ||||
-rw-r--r-- | ceee/firefox/locale/en-US/ceee.properties | 6 | ||||
-rw-r--r-- | ceee/firefox/locale/en-US/options.dtd | 2 | ||||
-rw-r--r-- | ceee/firefox/xpi_file_list.gypi | 6 | ||||
-rw-r--r-- | ceee/firefox/zipfiles.py | 50 |
8 files changed, 102 insertions, 31 deletions
diff --git a/ceee/firefox/content/about.xul b/ceee/firefox/content/about.xul index 4d1792f6..09ac916 100644 --- a/ceee/firefox/content/about.xul +++ b/ceee/firefox/content/about.xul @@ -9,17 +9,17 @@ <!DOCTYPE dialog SYSTEM "chrome://ceee/locale/about.dtd"> -<dialog title="&about; Google Chrome Extensions Execution Environment" orient="vertical" autostretch="always" +<dialog title="&about; @CEEE_PRODUCT_FULLNAME@" orient="vertical" autostretch="always" onload="sizeToContent()" buttons="accept" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <groupbox align="center" orient="horizontal"> <vbox> - <text value="Google Chrome Extensions Execution Environment" + <text value="@CEEE_PRODUCT_FULLNAME@" style="font-weight: bold; font-size: x-large;"/> <text value="&version; 0.2"/> <separator class="thin"/> <text value="&createdBy;" style="font-weight: bold;"/> - <text value="Google Inc."/> + <text value="@COMPANY_FULLNAME@"/> <separator class="thin"/> <text value="&homepage;" style="font-weight: bold;"/> <text value="http://www.google.com" class="url" diff --git a/ceee/firefox/firefox.gyp b/ceee/firefox/firefox.gyp index 4f0eb31..6d1efdb 100644 --- a/ceee/firefox/firefox.gyp +++ b/ceee/firefox/firefox.gyp @@ -8,6 +8,22 @@ '../../ceee/common.gypi', 'xpi_file_list.gypi', ], + 'variables': { + 'version_path': '<(DEPTH)/chrome/VERSION', + }, + 'conditions': [ + [ 'branding == "Chrome"', { + 'variables': { + 'branding_path': + '<(DEPTH)/chrome/app/theme/google_chrome/BRANDING', + }, + }, { # else branding!="Chrome" + 'variables': { + 'branding_path': + '<(DEPTH)/chrome/app/theme/chromium/BRANDING', + }, + }], + ], 'targets': [ { 'target_name': 'xpi', @@ -22,6 +38,8 @@ '<(SHARED_INTERMEDIATE_DIR)/ceee_ff.xpi', '<(SHARED_INTERMEDIATE_DIR)/event_bindings.js', '<(SHARED_INTERMEDIATE_DIR)/renderer_extension_bindings.js', + '<(version_path)', + '<(branding_path)', ], 'actions': [ { @@ -36,13 +54,19 @@ 'action': [ '<@(python)', '$(ProjectDir)\zipfiles.py', - '-c', + '--config', '$(ConfigurationName)', - '-i', + '--input', '<(SHARED_INTERMEDIATE_DIR)/ceee_ff.xpi', - '-o', + '--version', + '<(version_path)', + '--branding', + '<(branding_path)', + '--ignore_extensions', + '<(xpi_no_expand_extensions)', + '--output', '<(_outputs)', - '-p', + '--path', 'content/us', '<(SHARED_INTERMEDIATE_DIR)/event_bindings.js', '<(SHARED_INTERMEDIATE_DIR)/renderer_extension_bindings.js', @@ -53,13 +77,12 @@ { 'target_name': 'create_xpi', 'type': 'none', - # TODO(rogerta@chromium.org): This needs to be conditional on - # configuration. We should only include _xpi_test_files for - # debug builds, or when we want to test the add-on. 'sources': [ 'zipfiles.py', '<@(_xpi_files)', '<@(_xpi_test_files)', + '<(version_path)', + '<(branding_path)', ], 'actions': [ { @@ -79,13 +102,19 @@ # one of the form "-o >(_outputs)". '<@(python)', '$(ProjectDir)\zipfiles.py', - '-c', + '--config', '$(ConfigurationName)', - '-o', + '--version', + '<(version_path)', + '--branding', + '<(branding_path)', + '--ignore_extensions', + '<(xpi_no_expand_extensions)', + '--output', '<(_outputs)', '<@(_xpi_files)', '##', - '<@(_xpi_test_files)', + '<@(_xpi_test_files)', # Included only in Debug build config. ], }, ], diff --git a/ceee/firefox/install.rdf b/ceee/firefox/install.rdf index c40b452..d588012 100644 --- a/ceee/firefox/install.rdf +++ b/ceee/firefox/install.rdf @@ -10,10 +10,10 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-manifest"> <em:id>ceee@google.com</em:id> - <em:name>Google Chrome Extensions Execution Environment for Firefox</em:name> - <em:version>0.1</em:version> - <em:creator>Google Inc.</em:creator> - <em:description>Enable Google Chrome Extensions in Firefox.</em:description> + <em:name>@CEEE_PRODUCT_FULLNAME@</em:name> + <em:version>@MAJOR@.@MINOR@.@BUILD@.@PATCH@</em:version> + <em:creator>@COMPANY_FULLNAME@</em:creator> + <em:description>Enables @CEEE_PRODUCT_FULLNAME@ in Firefox.</em:description> <em:homepageURL>http://www.google.com</em:homepageURL> <em:aboutURL>chrome://ceee/content/about.xul</em:aboutURL> <em:optionsURL>chrome://ceee/content/options.xul</em:optionsURL> diff --git a/ceee/firefox/locale/en-US/ceee.dtd b/ceee/firefox/locale/en-US/ceee.dtd index 4c227710..0e382e4 100644 --- a/ceee/firefox/locale/en-US/ceee.dtd +++ b/ceee/firefox/locale/en-US/ceee.dtd @@ -4,8 +4,8 @@ Defines string substitutions for the overlay.xul file. --> -<!ENTITY ceee.browser.label "Google Chrome Extensions Execution Environment"> -<!ENTITY ceee.browser.tooltip "Google Chrome Extensions Execution Environment"> +<!ENTITY ceee.browser.label "@CEEE_PRODUCT_FULLNAME@"> +<!ENTITY ceee.browser.tooltip "@CEEE_PRODUCT_FULLNAME@"> -<!ENTITY ceee.toolstrip.label "Google Chrome Extensions Execution Environment"> +<!ENTITY ceee.toolstrip.label "@CEEE_PRODUCT_FULLNAME@"> <!ENTITY ceee.toolstrip.accesskey "G"> diff --git a/ceee/firefox/locale/en-US/ceee.properties b/ceee/firefox/locale/en-US/ceee.properties index cd726cb..11ce565 100644 --- a/ceee/firefox/locale/en-US/ceee.properties +++ b/ceee/firefox/locale/en-US/ceee.properties @@ -1,4 +1,4 @@ -helloMessage=Google Chrome Extensions Execution Environment
-helloMessageTitle=Google Chrome Extensions Execution Environment
+helloMessage=@CEEE_PRODUCT_FULLNAME@
+helloMessageTitle=@CEEE_PRODUCT_FULLNAME@
prefMessage=Int Pref Value: %d
-extensions.ceee.description=Enable Google Chrome Extensions in Firefox.
+extensions.ceee.description=Enables @CEEE_PRODUCT_FULLNAME@ in Firefox.
diff --git a/ceee/firefox/locale/en-US/options.dtd b/ceee/firefox/locale/en-US/options.dtd index c520b86..3ef88ca 100644 --- a/ceee/firefox/locale/en-US/options.dtd +++ b/ceee/firefox/locale/en-US/options.dtd @@ -4,7 +4,7 @@ Defines string substitutions for the overlay.xul file. --> -<!ENTITY options.title "Google Chrome Extensions Execution Environment Options"> +<!ENTITY options.title "@CEEE_PRODUCT_FULLNAME@ Options"> <!ENTITY options.path.accesskey "P"> <!ENTITY options.path.label "Chrome Extension Path (Set to load extension from a specific location on disk)"> <!ENTITY options.url.accesskey "U"> diff --git a/ceee/firefox/xpi_file_list.gypi b/ceee/firefox/xpi_file_list.gypi index 57effb0..642dea8 100644 --- a/ceee/firefox/xpi_file_list.gypi +++ b/ceee/firefox/xpi_file_list.gypi @@ -14,7 +14,11 @@ # xpi_files_test lists additional files needed for testing. { 'variables': { - 'xpi_file_root%': '', + 'xpi_file_root': '', + + # Comma-separated list of extensions to ignore when expanding + # version and branding strings. + 'xpi_no_expand_extensions': 'png', }, 'xpi_files': [ '<(xpi_file_root)chrome.manifest', diff --git a/ceee/firefox/zipfiles.py b/ceee/firefox/zipfiles.py index 3ddff74..ed2cece 100644 --- a/ceee/firefox/zipfiles.py +++ b/ceee/firefox/zipfiles.py @@ -1,7 +1,9 @@ # Copyright (c) 2010 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. -"""Compresses input arguments to a zip archive.""" +"""Compresses input arguments to a zip archive after running text files +through version/branding token replacement. +""" import optparse import os @@ -9,6 +11,10 @@ import shutil import sys import zipfile +sys.path.append( + os.path.join(os.path.dirname(sys.argv[0]), '../../chrome/tools/build')) +import version + # Special token to separate the regular files needed in the XPI file from # the debug-only files. The regular files are listed first, then the separator, @@ -21,8 +27,9 @@ _USAGE='Usage: %prog [options] <file-list> [## <debug-only-file-list>]' # Help description text for option parser. -_DESCRIPTION="""Creates a zip file containing the list of files specified on -the command line. +_DESCRIPTION="""Creates a zip file containing the list of files +specified on the command line. Also expands constants from VERSION +and BRANDING files. The files before the ## token are always added to the zip file. The files after the ## token are added only if the configuration specified is Debug. @@ -31,6 +38,11 @@ If relative paths are used to name the files, they are assumed to be relative to the current working directory. Any directory structure will be preserved unless the -p command line option is used to place the files in a specific folder of the zip file. + +The --version and --branding flags must be used to specify the paths +to VERSION and BRANDING files, respectively. Add any binary files +(and/or text files you know won't need expanding) to the +--ignore_extensions list. """ @@ -50,6 +62,13 @@ def ParseCommandLine(): help='Path within the archive to write the files to.') parser.add_option('-c', '--config', dest='config', help='Configuration being built, either Debug or Release.') + parser.add_option('-v', '--version', dest='version_file', + help='Path to VERSION file.') + parser.add_option('-b', '--branding', dest='branding_file', + help='Path to BRANDING file.') + parser.add_option('-x', '--ignore_extensions', dest='ignore_extensions', + default='', + help='Comma-separated list of extensions to not expand.') (options, args) = parser.parse_args() @@ -59,6 +78,9 @@ def ParseCommandLine(): if not options.config: parser.error('You must provide configuration.') + if not options.version_file or not options.branding_file: + parser.error('You must provide --version and --branding.') + return (options, args) @@ -76,6 +98,12 @@ def Main(): if os.path.isdir(path): raise Exception('Input file is a path:', path) + ignore_extensions = options.ignore_extensions.split(',') + + # Set up variable substitution mapping. + variable_files = [options.version_file, options.branding_file] + subst_values = version.fetch_values(variable_files) + # Open the output file. if options.input: shutil.copyfile(options.input, options.output) @@ -89,10 +117,20 @@ def Main(): if path == _DEBUG_ONLY_FILE_SEPARATOR: if options.config != 'Debug': break - elif options.path: - output.write(path, os.path.join(options.path, os.path.basename(path))) else: - output.write(path) + dest_path = path + if options.path: + dest_path = os.path.join(options.path, os.path.basename(path)) + + extension = os.path.splitext(path)[1] + if extension: + extension = extension[1:] + + if extension in ignore_extensions: + output.write(path, dest_path) + else: + contents = version.subst_file(path, subst_values) + output.writestr(dest_path, contents) output.close() |