Index: chrome/tools/build/win/create_installer_archive.py |
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py |
index 78bc63b9e04a03fbc810391b2527ccf2dbf3a8fa..0642594f536571930a79aec7936620ad087d2ad4 100755 |
--- a/chrome/tools/build/win/create_installer_archive.py |
+++ b/chrome/tools/build/win/create_installer_archive.py |
@@ -312,6 +312,77 @@ def CreateResourceInputFile( |
f.write(resource_file) |
+def DoComponentBuildTasks(staging_dir, build_dir, current_version): |
+ # Copy all the DLLs in |build_dir| to the version directory. |
+ chrome_dir = os.path.join(staging_dir, CHROME_DIR) |
+ version_dir = os.path.join(chrome_dir, current_version) |
+ dlls = glob.glob(os.path.join(build_dir, '*.dll')) |
+ for dll in dlls: |
+ shutil.copy(dll, version_dir) |
+ |
+ # Write chrome.exe.config to point to the version directory. |
+ chrome_exe_config = ( |
+ "<configuration>\n" |
+ " <windows>\n" |
+ " <assemblyBinding xmlns='urn:schemas-microsoft-com:asm.v1'>\n" |
+ " <probing privatePath='{version}'/>\n" |
+ " </assemblyBinding>\n" |
+ " </windows>\n" |
+ "</configuration>".format(version = current_version)) |
robertshield
2012/05/09 21:42:41
no spaces around '=', consider using %
gab
2012/05/10 00:12:55
Done.
|
+ |
+ chrome_exe_config_file = open( |
+ os.path.join(chrome_dir, 'chrome.exe.config'), 'w') |
+ chrome_exe_config_file.write(chrome_exe_config) |
+ chrome_exe_config_file.close() |
+ |
+ # Build a list containing the name of each DLL found in |build_dir| |
+ dll_names = [] |
+ for dll in dlls: |
+ dll_names.append(os.path.splitext(os.path.basename(dll))[0]) |
+ |
+ # Write chrome.exe.manifest in which we list all the DLLs as side by side |
+ # assembly dependencies. |
+ chrome_exe_manifest_parts = [ |
+ "<assembly\n" |
+ " xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\n" |
+ " <assemblyIdentity\n" |
+ " name='chrome.chromeexe' version='0.0.0.0' type='win32'/>\n"] |
+ |
+ for name in dll_names: |
+ chrome_exe_manifest_parts.append( |
+ " <dependency>\n" |
+ " <dependentAssembly>\n" |
+ " <assemblyIdentity type='win32' name='chrome.{dll_basename}'\n" |
+ " version='0.0.0.0' processorArchitecture='x86'\n" |
+ " language='*'/>\n" |
+ " </dependentAssembly>\n" |
+ " </dependency>\n".format(dll_basename = name)) |
robertshield
2012/05/09 21:42:41
python style states that there are no spaces aroun
gab
2012/05/10 00:12:55
Done.
|
+ |
+ chrome_exe_manifest_parts.append("</assembly>") |
+ |
+ chrome_exe_manifest_file = open( |
+ os.path.join(chrome_dir, 'chrome.exe.manifest'), 'w') |
+ chrome_exe_manifest_file.write(''.join(chrome_exe_manifest_parts)) |
+ chrome_exe_manifest_file.close() |
+ |
+ # Write chrome.{dllname}.manifest in the version directory for each DLL list |
+ # as a dependency in the previous step. |
+ for name in dll_names: |
+ dll_manifest = ( |
+ "<assembly\n" |
+ " xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\n" |
+ " <assemblyIdentity name='chrome.{dll_basename}' version='0.0.0.0'\n" |
+ " type='win32' processorArchitecture='x86'/>\n" |
+ " <file name='{dll_basename}.dll'/>\n" |
+ "</assembly>".format(dll_basename = name)) |
robertshield
2012/05/09 21:42:41
no spaces around '=', consider using %
gab
2012/05/10 00:12:55
Done.
|
+ |
+ dll_manifest_file = open(os.path.join( |
+ version_dir, |
+ "chrome.{dll_basename}.manifest".format(dll_basename = name)), 'w') |
robertshield
2012/05/09 21:42:41
no spaces around '=', consider using %, like so:
gab
2012/05/10 00:12:55
Done.
|
+ dll_manifest_file.write(dll_manifest) |
+ dll_manifest_file.close() |
+ |
+ |
def main(options): |
"""Main method that reads input file, creates archive file and write |
resource input file. |
@@ -338,6 +409,9 @@ def main(options): |
staging_dir, options.build_dir, |
options.enable_hidpi, options.enable_metro) |
+ if options.component_build == '1': |
+ DoComponentBuildTasks(staging_dir, options.build_dir, current_version) |
+ |
version_numbers = current_version.split('.') |
current_build_number = version_numbers[2] + '.' + version_numbers[3] |
prev_build_number = '' |
@@ -393,6 +467,8 @@ def _ParseOptions(): |
parser.add_option('--enable_metro', default='0', |
help='Whether to include resource files from the "METRO" section of the ' |
'input file.') |
+ parser.add_option('--component_build', default='0', |
+ help='Whether this archive is packaging a component build.') |
options, args = parser.parse_args() |
if not options.build_dir: |
@@ -401,12 +477,15 @@ def _ParseOptions(): |
if not options.staging_dir: |
parser.error('You must provide a staging dir.') |
+ if not options.input_file: |
+ parser.error('You must provide an input file') |
+ |
if not options.output_dir: |
options.output_dir = options.build_dir |
if not options.resource_file_path: |
- options.options.resource_file_path = os.path.join(options.build_dir, |
- MINI_INSTALLER_INPUT_FILE) |
+ options.resource_file_path = os.path.join(options.build_dir, |
+ MINI_INSTALLER_INPUT_FILE) |
return options |