diff options
author | initial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-26 23:55:29 +0000 |
---|---|---|
committer | initial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-26 23:55:29 +0000 |
commit | 09911bf300f1a419907a9412154760efd0b7abc3 (patch) | |
tree | f131325fb4e2ad12c6d3504ab75b16dd92facfed /chrome/tools/build | |
parent | 586acc5fe142f498261f52c66862fa417c3d52d2 (diff) | |
download | chromium_src-09911bf300f1a419907a9412154760efd0b7abc3.zip chromium_src-09911bf300f1a419907a9412154760efd0b7abc3.tar.gz chromium_src-09911bf300f1a419907a9412154760efd0b7abc3.tar.bz2 |
Add chrome to the repository.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools/build')
35 files changed, 1316 insertions, 0 deletions
diff --git a/chrome/tools/build/win/FILES b/chrome/tools/build/win/FILES new file mode 100644 index 0000000..fa6dc0b --- /dev/null +++ b/chrome/tools/build/win/FILES @@ -0,0 +1,51 @@ +chrome.exe +chrome.dll +crash_service.exe +First Run +icudt38.dll +themes/default.dll +resources +rlz.dll +locales/ar.dll +locales/bg.dll +locales/ca.dll +locales/cs.dll +locales/da.dll +locales/de.dll +locales/el.dll +locales/en-GB.dll +locales/en-US.dll +locales/es.dll +locales/es-419.dll +locales/et.dll +locales/fi.dll +locales/fil.dll +locales/fr.dll +locales/he.dll +locales/hi.dll +locales/hr.dll +locales/hu.dll +locales/id.dll +locales/it.dll +locales/ja.dll +locales/ko.dll +locales/lt.dll +locales/lv.dll +locales/nl.dll +locales/nb.dll +locales/pl.dll +locales/pt-BR.dll +locales/pt-PT.dll +locales/ro.dll +locales/ru.dll +locales/sk.dll +locales/sl.dll +locales/sr.dll +locales/sv.dll +locales/th.dll +locales/tr.dll +locales/uk.dll +locales/vi.dll +locales/zh-CN.dll +locales/zh-TW.dll +plugins/gears/gears.dll diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py new file mode 100644 index 0000000..5f32472 --- /dev/null +++ b/chrome/tools/build/win/create_installer_archive.py @@ -0,0 +1,273 @@ +#!/usr/bin/python +# Copyright 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Script to create Chrome Installer archive. + + This script is used to create an archive of all the files required for a + Chrome install in appropriate directory structure. It reads chrome.release + file as input, creates chrome.7z archive, compresses setup.exe and + generates packed_files.txt for mini_installer project. + +""" + +import ConfigParser +import glob +import md5 +import optparse +import os +import shutil +import sys + + +ARCHIVE_DIR = "installer_archive" +FULL_ARCHIVE_FILE = "chrome.7z" # uncompresed full archive file +C_FULL_ARCHIVE_FILE = "chrome.packed.7z" # compressed full archive file +PATCH_FILE_NAME = "patch" # patch archive file name +PATCH_FILE_EXT = ".packed.7z" # extension of patch archive file +CHROME_DIR = "Chrome-bin" +MINI_INSTALLER_INPUT_FILE = "packed_files.txt" +SETUP_EXEC = "setup.exe" +BSDIFF_EXEC = "bsdiff.exe" +VERSION_FILE = "VERSION" +PACKED_FILE_COMMENTS = """ +// This file is automatically generated by create_installer_archive.py. +// It contains the resource entries that are going to be linked inside +// mini_installer.exe. For each file to be linked there should be two +// lines: +// - The first line contains the output filename (without path) and the +// type of the resource ('BN' means the file is not compressed and +// 'BL' means the file is compressed. +// - The second line contains the path to the input file. Uses '/' to +// separate path components. +""" + +def BuildVersion(output_dir): + """Returns the full build version string constructed from information in + VERSION_FILE. Any segment not found in that file will default to '0'. + """ + major = 0 + minor = 0 + build = 0 + patch = 0 + # TODO(rahulk): find a better way to locate VERSION file + for line in open(os.path.join(output_dir, "..", VERSION_FILE), 'r'): + line = line.rstrip() + if line.startswith('MAJOR='): + major = line[6:] + elif line.startswith('MINOR='): + minor = line[6:] + elif line.startswith('BUILD='): + build = line[6:] + elif line.startswith('PATCH='): + patch = line[6:] + return '%s.%s.%s.%s' % (major, minor, build, patch) + + +def Readconfig(output_dir, input_file, current_version): + """Reads config information from input file after setting default value of + global variabes. + """ + variables = {} + variables['ChromeDir'] = CHROME_DIR + variables['VersionDir'] = os.path.join(variables['ChromeDir'], + current_version) + config = ConfigParser.SafeConfigParser(variables) + config.read(input_file) + return config + + +def MakeStagingDirectory(output_dir): + """Creates a staging path for installer archive. If directory exists already, + deletes the existing directory. + """ + file_path = os.path.join(output_dir, ARCHIVE_DIR) + if os.path.exists(file_path): + shutil.rmtree(file_path) + os.makedirs(file_path) + return file_path + + +def CopyFilesToStagingDir(config, staging_dir, output_dir): + """Copies files required for installer archive to staging dir. + """ + for option in config.options('FILES'): + if option.endswith('dir'): + continue + + dst = os.path.join(staging_dir, config.get('FILES', option)) + if not os.path.exists(dst): + os.makedirs(dst) + for file in glob.glob(os.path.join(output_dir, option)): + shutil.copy(file, dst) + + +def RunSystemCommand(cmd): + if (os.system(cmd) != 0): + raise "Error while running cmd: %s" % cmd + + +def CreateArchiveFile(output_dir, staging_dir, current_version, + prev_version_dir, prev_version, rebuild_archive): + """Creates a new installer archive file after deleting any existing old file. + """ + # First create an uncompressed archive file for the current build + # TODO(rahulk): find a better way to locate 7za.exe + lzma_exec = os.path.join(output_dir, "..", "..", "third_party", + "lzma_sdk", "Executable", "7za.exe") + archive_file = os.path.join(output_dir, FULL_ARCHIVE_FILE) + cmd = '%s a -t7z "%s" "%s" -mx0' % (lzma_exec, archive_file, + os.path.join(staging_dir, CHROME_DIR)) + # There doesnt seem to be any way in 7za.exe to override existing file so + # we always delete before creating a new one. + if not os.path.exists(archive_file): + RunSystemCommand(cmd) + elif rebuild_archive: + os.remove(archive_file) + RunSystemCommand(cmd) + + # If we are generating a patch, run bsdiff against previous build and + # compress the resulting patch file. If this is not a patch just compress the + # uncompressed archive file. + if (prev_version_dir): + prev_archive_file = os.path.join(prev_version_dir, FULL_ARCHIVE_FILE) + patch_file = os.path.join(output_dir, "patch.7z") + cmd = '%s "%s" "%s" "%s"' % (os.path.join(output_dir, BSDIFF_EXEC), + prev_archive_file, archive_file, patch_file) + RunSystemCommand(cmd) + + archive_file_name = PATCH_FILE_NAME + "-" + if prev_version: + archive_file_name += prev_version + "-" + archive_file_name += current_version + PATCH_FILE_EXT + orig_file = patch_file + else: + archive_file_name = C_FULL_ARCHIVE_FILE + orig_file = archive_file + + compressed_archive_file_path = os.path.join(output_dir, archive_file_name) + cmd = '%s a -t7z "%s" "%s" -mx9' % (lzma_exec, compressed_archive_file_path, + orig_file) + if os.path.exists(compressed_archive_file_path): + os.remove(compressed_archive_file_path) + RunSystemCommand(cmd) + + return archive_file_name + + +def CompressSetupExec(output_dir): + """Compresses setup.exe to reduce size.""" + cmd = 'makecab.exe /V1 /L "%s" "%s"' % (output_dir, + os.path.join(output_dir, SETUP_EXEC)) + RunSystemCommand(cmd) + + +def GetFileMD5Hash(file): + f = open(file, 'rb') + hash = md5.new(f.read()).hexdigest() + f.close() + return hash + + +def CreateResourceInputFile(output_dir, + prev_version_dir, archive_file_name): + """Creates resource input file (packed_files.txt) for mini_installer project. + + This method checks if we are generating a patch instead of full installer. In + case of patch it also checks if setup.exe has changed by comparing its + MD5 hash with the MD5 hash of previous setup.exe. If hash values are same + setup.exe is not included in packed_files.txt. + + In case of patch we include patch.7z and in case of full + installer we include chrome.7z in packed_files.txt. + """ + setup_exe_needed = 1 + if (prev_version_dir): + current_hash = GetFileMD5Hash(os.path.join(output_dir, SETUP_EXEC)) + prev_hash = GetFileMD5Hash(os.path.join(prev_version_dir, SETUP_EXEC)) + if (current_hash == prev_hash): + setup_exe_needed = 0 + + if (setup_exe_needed): + CompressSetupExec(output_dir) + c_setup_file = SETUP_EXEC[:len(SETUP_EXEC) - 1] + "_" + setup_file_entry = "%s\t\tBL\n\"%s\"" % (c_setup_file, + os.path.join(output_dir, c_setup_file).replace("\\","/")) + + archive_file_entry = "\n%s\t\tB7\n\"%s\"" % (archive_file_name, + os.path.join(output_dir, archive_file_name).replace("\\","/")) + output_file = os.path.join(output_dir, MINI_INSTALLER_INPUT_FILE) + f = open(output_file, 'w') + try: + f.write(PACKED_FILE_COMMENTS) + if (setup_exe_needed): + f.write(setup_file_entry) + f.write(archive_file_entry) + finally: + f.close() + + +def main(options): + """Main method that reads input file, creates archive file and write + resource input file. + """ + current_version = BuildVersion(options.output_dir) + + config = Readconfig(options.output_dir, options.input_file, current_version) + + staging_dir = MakeStagingDirectory(options.output_dir) + + CopyFilesToStagingDir(config, staging_dir, options.output_dir) + + # Name of the archive file built (for example - chrome.lz or + # patch-<old_version>-<new_version>.lz or patch-<new_version>.lz + archive_file_name = CreateArchiveFile(options.output_dir, staging_dir, + current_version, options.last_chrome_installer, + options.last_chrome_version, options.rebuild_archive) + + CreateResourceInputFile(options.output_dir, options.last_chrome_installer, + archive_file_name) + + +if '__main__' == __name__: + option_parser = optparse.OptionParser() + option_parser.add_option('-o', '--output_dir', help='Output directory') + option_parser.add_option('-i', '--input_file', help='Input file') + option_parser.add_option('-r', '--rebuild_archive', action='store_true', + default=False, help='Rebuild Chrome.7z archive, even if it exists.') + option_parser.add_option('-l', '--last_chrome_installer', + help='Generate differential installer. The value of this parameter ' + + 'specifies the directory that contains base versions of ' + + 'setup.exe & chrome.7z.') + option_parser.add_option('-v', '--last_chrome_version', + help='Version of the previous installer. ' + + 'Used only for the purpose of naming archive file. Optional.') + + options, args = option_parser.parse_args() + sys.exit(main(options)) diff --git a/chrome/tools/build/win/data_dll.vsprops b/chrome/tools/build/win/data_dll.vsprops new file mode 100644 index 0000000..9e6f840 --- /dev/null +++ b/chrome/tools/build/win/data_dll.vsprops @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="data_dll" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="_USRDLL;GENERATED_RESOURCES_DLL_EXPORTS" + /> + <Tool + Name="VCLinkerTool" + IgnoreImportLibrary="true" + LinkIncremental="1" + LinkTimeCodeGeneration="0" + ResourceOnlyDLL="true" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/debugger_disabled.vsprops b/chrome/tools/build/win/debugger_disabled.vsprops new file mode 100644 index 0000000..b068039 --- /dev/null +++ b/chrome/tools/build/win/debugger_disabled.vsprops @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="debugger" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="CHROME_DEBUGGER_DISABLED" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="CHROME_DEBUGGER_DISABLED" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/dependencies.py b/chrome/tools/build/win/dependencies.py new file mode 100644 index 0000000..0ae3b8e --- /dev/null +++ b/chrome/tools/build/win/dependencies.py @@ -0,0 +1,197 @@ +#!/usr/bin/python +# Copyright 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Script to verify a Portable Executable's dependencies. + +Analyzes the input portable executable (a DLL or an EXE for example), extracts +its imports and confirms that its dependencies haven't changed. This is for +regression testing. + +Returns 0 if the list matches. + 1 if one or more dependencies has been removed. + 2 if one or more dependencies has been added. This preempts removal + result code. +""" + +import optparse +import os +import subprocess +import sys + +DUMPBIN = "dumpbin.exe" + + +class Error(Exception): + def __init__(self, message): + self.message = message + + +def RunSystemCommand(cmd): + return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] + + +def RunDumpbin(binary_file): + """Runs dumpbin and parses its output. + + Args: binary_file: the binary to analyze + Returns: a tuple of the dependencies and the delay-load dependencies + + The output of dumpbin that we will be parsing looks like this: + -- + <blah blah> + + Image has the following dependencies: + + foo.dll + bar.dll + + Image has the following delay load dependencies: + + foobar.dll + other.dll + + Summary + + <blah blah> + -- + The following parser extracts the dll names from the above format. + """ + cmd = DUMPBIN + " /dependents " + binary_file + output = RunSystemCommand(cmd) + dependents = [] + delay_loaded = [] + (START, DEPENDENCIES_HEADER, DEPENDENCIES, DELAY_LOAD_HEADER, DELAY_LOAD, + SUMMARY_HEADER, SUMMARY) = (0, 1, 2, 3, 4, 5, 6) + current_section = START + # Very basic scanning. + for line in output.splitlines(): + line = line.strip() + if len(line) > 1: + if line == "Image has the following dependencies:": + if current_section != START: + raise Error("Internal parsing error.") + current_section = DEPENDENCIES_HEADER; + elif line == "Image has the following delay load dependencies:": + if current_section != DEPENDENCIES: + raise Error("Internal parsing error.") + current_section = DELAY_LOAD_HEADER; + elif line == "Summary": + current_section = SUMMARY_HEADER; + elif current_section == DEPENDENCIES: + # Got a dependent + dependents.append(line) + elif current_section == DELAY_LOAD: + # Got a delay-loaded + delay_loaded.append(line) + else: + if current_section == DEPENDENCIES_HEADER: + current_section = DEPENDENCIES + elif current_section == DELAY_LOAD_HEADER: + current_section = DELAY_LOAD + elif current_section == SUMMARY_HEADER: + current_section = SUMMARY + return dependents, delay_loaded + + +def Diff(name, type, current, expected, deps_file): + """ + Args: name: Portable executable name being analysed. + type: Type of dependency. + current: List of current dependencies. + expected: List of dependencies that are expected. + deps_file: File name of the .deps file. + Returns 0 if the lists are equal + 1 if one entry in list1 is missing + 2 if one entry in list2 is missing. + """ + # Create sets of lower-case names. + set_expected = set([x.lower() for x in expected]) + set_current = set([x.lower() for x in current]) + only_in_expected = set_expected - set_current + only_in_current = set_current - set_expected + + # Find difference between the sets. + found_extra = 0 + name = os.path.basename(name).lower() + if len(only_in_expected) or len(only_in_current): + print name.upper() + " DEPENDENCIES MISMATCH\n" + + if len(only_in_current): + found_extra = 1 + print "%s is no longer dependent on these %s: %s." % (name, + type, + ' '.join(only_in_current)) + print "Please update \"%s\"." % deps_file + + if len(only_in_expected): + found_extra = 2 + string = "%s is now dependent on these %s, but shouldn't: %s." % (name, + type, + ' '.join(only_in_expected)) + stars = '*' * len(string) + print "**" + stars + "**" + print "* " + string + " *" + print "**" + stars + "**\n" + print "Please update \"%s\"." % deps_file + return found_extra + + +def VerifyDependents(pe_name, dependents, delay_loaded, list_file): + """Compare the actual dependents to the expected ones.""" + scope = {} + execfile(list_file, scope) + deps_result = Diff(pe_name, + "dll", + dependents, + scope["dependents"], + list_file) + delayed_result = Diff(pe_name, + "delay loaded dll", + delay_loaded, + scope["delay_loaded"], + list_file) + return max(deps_result, delayed_result) + + +def main(options, args): + # PE means portable executable. It's any .DLL, .EXE, .SYS, .AX, etc. + pe_name = args[0] + deps_file = args[1] + dependents, delay_loaded = RunDumpbin(pe_name) + return VerifyDependents(pe_name, dependents, delay_loaded, deps_file) + + +if '__main__' == __name__: + usage = "usage: %prog [options] input output" + option_parser = optparse.OptionParser(usage = usage) + options, args = option_parser.parse_args() + if len(args) != 2: + parser.error("Incorrect number of arguments") + sys.exit(main(options, args)) diff --git a/chrome/tools/build/win/flattened_html_file.bat b/chrome/tools/build/win/flattened_html_file.bat new file mode 100644 index 0000000..310d88d --- /dev/null +++ b/chrome/tools/build/win/flattened_html_file.bat @@ -0,0 +1,14 @@ +:: Batch file run as build command for flattening files +:: The custom build rule is set to expect (inputfile).html +@echo off + +setlocal + +set InFile=%~1 +set SolutionDir=%~2 +set OutFile=%~3 + +:: Use GNU tools +call %SolutionDir%\..\third_party\gnu\setup_env.bat + +%SolutionDir%\..\third_party\python_24\python.exe %SolutionDir%\tools\build\win\html_inline.py %InFile% %OutFile% diff --git a/chrome/tools/build/win/flattened_html_file.rules b/chrome/tools/build/win/flattened_html_file.rules new file mode 100644 index 0000000..8cc33ba --- /dev/null +++ b/chrome/tools/build/win/flattened_html_file.rules @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<VisualStudioToolFile + Name="Flattened HTML Resource" + Version="8.00" + > + <Rules> + <CustomBuildRule + Name="Flattened HTML Resource" + DisplayName="Flattened HTML Resource" + CommandLine="$(SolutionDir)\tools\build\win\flattened_html_file.bat $(InputPath) "$(SolutionDir)" "$(IntDir)\$(InputName)_flat.html"" + Outputs="$(IntDir)\$(InputName)_flat.html" + AdditionalDependencies="$(SolutionDir)\tools\build\win\flattened_html_file.bat" + FileExtensions="*.html" + ExecutionDescription="Generating resources..." + > + <Properties> + </Properties> + </CustomBuildRule> + </Rules> +</VisualStudioToolFile> diff --git a/chrome/tools/build/win/font_file_copy.rules b/chrome/tools/build/win/font_file_copy.rules new file mode 100644 index 0000000..912a79b --- /dev/null +++ b/chrome/tools/build/win/font_file_copy.rules @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<VisualStudioToolFile + Name="Font file copy" + Version="8.00" + > + <Rules> + <CustomBuildRule + Name="Font file copy" + DisplayName="Font file copy" + CommandLine="xcopy /Y /D /Q $(InputPath) $(OutDir)\fonts" + Outputs="$(OutDir)\fonts\$(InputFileName)" + FileExtensions="*.ttf;*.afm" + ExecutionDescription="Copying font file..." + > + <Properties> + </Properties> + </CustomBuildRule> + </Rules> +</VisualStudioToolFile> diff --git a/chrome/tools/build/win/hardlink_failsafe.bat b/chrome/tools/build/win/hardlink_failsafe.bat new file mode 100644 index 0000000..4113922 --- /dev/null +++ b/chrome/tools/build/win/hardlink_failsafe.bat @@ -0,0 +1,12 @@ +@echo off +:: %1 is source +:: %2 is output + +:: Delete it if it existed +if exist "%2" del "%2" + +:: Try to create a hardlink (argument are in reverse order). Hide errors if they occur, we have a fallback. +fsutil hardlink create "%2" "%1" > nul + +:: If it failed, copy it instead. Don't hide errors if it fails. +if errorlevel 1 copy "%1" "%2" diff --git a/chrome/tools/build/win/html_inline.py b/chrome/tools/build/win/html_inline.py new file mode 100644 index 0000000..17d24ca --- /dev/null +++ b/chrome/tools/build/win/html_inline.py @@ -0,0 +1,128 @@ +#!/usr/bin/python +# Copyright 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Flattens a HTML file by inlining its external resources. + +This is a small script that takes a HTML file, looks for src attributes +and inlines the specified file, producing one HTML file with no external +dependencies. + +This does not inline CSS styles, nor does it inline anything referenced +from an inlined file. +""" + +import re +import sys +import base64 +import mimetypes +from os import path + +def ReadFile(input_filename): + """Helper function that returns input_filename as a string. + + Args: + input_filename: name of file to be read + + Returns: + string + """ + f = open(input_filename, 'rb') + file_contents = f.read() + f.close() + return file_contents + +def SrcInline(src_match, base_path): + """regex replace function. + + Takes a regex match for src="filename", attempts to read the file + at 'filename' and returns the src attribute with the file inlined + as a data URI + + Args: + src_match: regex match object with 'filename' named capturing group + base_path: path that to look for files in + + Returns: + string + """ + filename = src_match.group('filename') + + if filename.find(':') != -1: + # filename is probably a URL, which we don't want to bother inlining + return src_match.group(0) + + filepath = path.join(base_path, filename) + mimetype = mimetypes.guess_type(filename)[0] or 'text/plain' + inline_data = base64.standard_b64encode(ReadFile(filepath)) + + prefix = src_match.string[src_match.start():src_match.start('filename')-1] + return "%s\"data:%s;base64,%s\"" % (prefix, mimetype, inline_data) + +def InlineFile(input_filename, output_filename): + """Inlines the resources in a specified file. + + Reads input_filename, finds all the src attributes and attempts to + inline the files they are referring to, then writes the result + to output_filename. + + Args: + input_filename: name of file to read in + output_filename: name of file to be written to + """ + print "inlining %s to %s" % (input_filename, output_filename) + input_filepath = path.dirname(input_filename) + + def SrcReplace(src_match): + """Helper function to provide SrcInline with the base file path""" + return SrcInline(src_match, input_filepath) + + # TODO(glen): Make this regex not match src="" text that is not inside a tag + flat_text = re.sub('src="(?P<filename>[^"\']*)"', + SrcReplace, + ReadFile(input_filename)) + + # TODO(glen): Make this regex not match url('') that is not inside a style + flat_text = re.sub('background:[ ]*url\(\'(?P<filename>[^"\']*)\'', + SrcReplace, + flat_text) + + out_file = open(output_filename, 'wb') + out_file.writelines(flat_text) + out_file.close() + +def main(): + if len(sys.argv) <= 2: + print "Flattens a HTML file by inlining its external resources.\n" + print "html_inline.py inputfile outputfile" + else: + InlineFile(sys.argv[1], sys.argv[2]) + +if __name__ == '__main__': + main() diff --git a/chrome/tools/build/win/inspector_copy.rules b/chrome/tools/build/win/inspector_copy.rules new file mode 100644 index 0000000..475b5b1 --- /dev/null +++ b/chrome/tools/build/win/inspector_copy.rules @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<VisualStudioToolFile + Name="Inspector file copy" + Version="8.00" + > + <Rules> + <CustomBuildRule + Name="Inspector file copy" + CommandLine="xcopy /Y /D /Q $(InputPath) $(OutDir)\Resources\Inspector\" + Outputs="$(OutDir)\Resources\Inspector\$(InputFileName)" + FileExtensions="*.html;*.js;*.gif;*.css" + ExecutionDescription="Copying resource file..." + > + <Properties> + </Properties> + </CustomBuildRule> + <CustomBuildRule + Name="Inspector image file copy" + CommandLine="xcopy /Y /D /Q $(InputPath) $(OutDir)\Resources\Inspector\Images\" + Outputs="$(OutDir)\Resources\Inspector\Images\$(InputFileName)" + FileExtensions="*.png" + ExecutionDescription="Copying resource file..." + > + <Properties> + </Properties> + </CustomBuildRule> + </Rules> +</VisualStudioToolFile> diff --git a/chrome/tools/build/win/js_engine.vsprops b/chrome/tools/build/win/js_engine.vsprops new file mode 100644 index 0000000..c329d6e --- /dev/null +++ b/chrome/tools/build/win/js_engine.vsprops @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="js_engine" + InheritedPropertySheets="js_engine_impl$(JS_ENGINE_TYPE).vsprops" +> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/js_engine_impl.vsprops b/chrome/tools/build/win/js_engine_impl.vsprops new file mode 100644 index 0000000..a4f1996 --- /dev/null +++ b/chrome/tools/build/win/js_engine_impl.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="js_engine_impl" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="CHROME_V8" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/js_engine_impl_kjs.vsprops b/chrome/tools/build/win/js_engine_impl_kjs.vsprops new file mode 100644 index 0000000..20b24da --- /dev/null +++ b/chrome/tools/build/win/js_engine_impl_kjs.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="js_engine_impl_kjs" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="CHROME_KJS" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/language_dll.vsprops b/chrome/tools/build/win/language_dll.vsprops new file mode 100644 index 0000000..6da7f8e --- /dev/null +++ b/chrome/tools/build/win/language_dll.vsprops @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="language_dll" + > + <Tool + Name="VCLinkerTool" + BaseAddress="0x3CF00000" + OutputFile="$(OutDir)\locales\$(ProjectName).dll" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/make_zip.sh b/chrome/tools/build/win/make_zip.sh new file mode 100755 index 0000000..2fe8af12 --- /dev/null +++ b/chrome/tools/build/win/make_zip.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# A simple shell script for creating a chrome zip from an output directory. +# Pass the path to the output directory you wish to package. + +if [ $# = 0 ]; then + echo "usage: make_zip.sh path/to/release/dir [output-name]" + exit 1 +fi + +tools_dir=$(dirname "$0") +release_dir="$1" + +files=$(cat "$tools_dir/FILES") + +output=${2:-chrome-win32} +rm -fr $output $output.zip +mkdir $output + +# Get the absolute path of the output directory. We need it when copying +# files. +output_abs=`cygpath -a $output` + +# Use cp --parents to copy full relative directory. Since we need the +# relative directory for the zip, change into the release dir. +pushd "$release_dir" +# The file names in FILES may contain whitespace, e.g. 'First Run'. +# Change IFS setting so we only split words with '\n' +IFS_Default=$IFS +IFS=$'\n' +for f in ${files[@]}; do + cp -r --parents "$f" "$output_abs" +done +IFS=$IFS_Default +popd + +zip -r $output.zip $output diff --git a/chrome/tools/build/win/map_drive.bat b/chrome/tools/build/win/map_drive.bat new file mode 100644 index 0000000..c415d1e --- /dev/null +++ b/chrome/tools/build/win/map_drive.bat @@ -0,0 +1,30 @@ +@echo off + +set SHARE_NAME=\\chrome-dev\chrome +set DRIVE_LETTER=%1 +set PATH=%SystemRoot%;%SystemRoot%\system32 + +net use %DRIVE_LETTER% +if errorlevel 1 goto DRIVE_NOT_MAPPED + +net use %DRIVE_LETTER% | find "%SHARE_NAME%" > nul +if not errorlevel 1 goto DRIVE_ALREADY_MAPPED + +:WRONG_DRIVE_MAPPED +echo %DRIVE_LETTER% Drive mapped to wrong share, disconnecting.. +net use %DRIVE_LETTER% /DELETE +goto MAPDRIVE + +:DRIVE_ALREADY_MAPPED +echo %DRIVE_LETTER% Drive already mapped.. +goto END + +:DRIVE_NOT_MAPPED +echo %DRIVE_LETTER% Drive not mapped.. +goto MAPDRIVE + +:MAPDRIVE +echo Mapping %DRIVE_LETTER% to %SHARE_NAME% +net use %DRIVE_LETTER% %SHARE_NAME% + +:END
\ No newline at end of file diff --git a/chrome/tools/build/win/precompiled.cc b/chrome/tools/build/win/precompiled.cc new file mode 100644 index 0000000..b09ed13 --- /dev/null +++ b/chrome/tools/build/win/precompiled.cc @@ -0,0 +1,2 @@ +// This file exists purely as a means to generate precompiled.pch +#include "precompiled.h" diff --git a/chrome/tools/build/win/precompiled.h b/chrome/tools/build/win/precompiled.h new file mode 100644 index 0000000..50ff863 --- /dev/null +++ b/chrome/tools/build/win/precompiled.h @@ -0,0 +1,66 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +// This header file is pre-compiled and added to the cl.exe command line for +// each source file. You should not include it explicitly. Instead, you +// should ensure that your source files specify all of their include files +// explicitly so they may be used without this pre-compiled header. +// +// To make use of this header file in a vcproj, just add precompiled.cc as a +// build target, and modify its build properties to enable /Yc for that file +// only. Then add the precompiled.vsprops property sheet to your vcproj. +// + +// windows headers +// TODO: when used, winsock2.h must be included before windows.h or +// the build blows up. The best fix is to define WIN32_LEAN_AND_MEAN. +// The best workaround is to define _WINSOCKAPI_. That's what winsock2.h does. +#include <winsock2.h> +#include <windows.h> +#include <shellapi.h> +#include <shlobj.h> +#include <tchar.h> + +// runtime headers +#include <cassert> +#include <climits> +#include <cstddef> +#include <cstdlib> +#include <cstring> +#include <memory.h> + +// Usual STL +#include <algorithm> +#include <list> +#include <map> +#include <string> +#include <strstream> +#include <vector> + diff --git a/chrome/tools/build/win/precompiled.vsprops b/chrome/tools/build/win/precompiled.vsprops new file mode 100644 index 0000000..464ea32 --- /dev/null +++ b/chrome/tools/build/win/precompiled.vsprops @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="precompiled" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(SolutionDir)tools\build\win"" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="precompiled.h" + PrecompiledHeaderFile="$(IntDir)\precompiled.pch" + ForcedIncludeFiles="precompiled.h" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/precompiled_wtl.cc b/chrome/tools/build/win/precompiled_wtl.cc new file mode 100644 index 0000000..0f6272d --- /dev/null +++ b/chrome/tools/build/win/precompiled_wtl.cc @@ -0,0 +1,2 @@ +// This file exists purely as a means to generate precompiled.pch +#include "precompiled_wtl.h" diff --git a/chrome/tools/build/win/precompiled_wtl.h b/chrome/tools/build/win/precompiled_wtl.h new file mode 100644 index 0000000..a44408a --- /dev/null +++ b/chrome/tools/build/win/precompiled_wtl.h @@ -0,0 +1,44 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See precompiled.h for info on using this file, substituting references to +// "precompiled" with "precompiled_wtl" + +#include "chrome/tools/build/win/precompiled.h" + +// ATL/WTL headers +#include <atlbase.h> +#include <atlapp.h> +#include <atlwin.h> +#include <atldlgs.h> +#include <atlframe.h> +#include <atlmisc.h> +#include <atlctrls.h> +#include <atlcrack.h> +#include <atltheme.h> diff --git a/chrome/tools/build/win/precompiled_wtl.vsprops b/chrome/tools/build/win/precompiled_wtl.vsprops new file mode 100644 index 0000000..1e9a915 --- /dev/null +++ b/chrome/tools/build/win/precompiled_wtl.vsprops @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="precompiled_wtl" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(SolutionDir)tools\build\win"" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="precompiled_wtl.h" + PrecompiledHeaderFile="$(IntDir)\precompiled_wtl.pch" + ForcedIncludeFiles="precompiled_wtl.h" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/release.rules b/chrome/tools/build/win/release.rules new file mode 100644 index 0000000..2b2f683 --- /dev/null +++ b/chrome/tools/build/win/release.rules @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<VisualStudioToolFile + Name="installer archive" + Version="8.00" + > + <Rules> + <CustomBuildRule + Name="create installer archive" + DisplayName="create installer archive" + CommandLine="$(SolutionDir)..\third_party\python_24\python.exe $(SolutionDir)tools\build\win\create_installer_archive.py --output_dir="$(OutDir)" --input_file="$(InputPath)" [LastChromeInstaller] [LastChromeVersion] [RebuildArchive]" + Outputs="$(OutDir)/$(InputName).7z;$(OutDir)/packed_files.txt;" + AdditionalDependencies="$(SolutionDir)\tools\build\win\create_installer_archive.py;$(OutDir)\chrome.exe;$(OutDir)\crash_reporter.exe;$(OutDir)\chrome.dll;$(OutDir)\locales\en-US.dll;$(OutDir)\icudt38.dll" + FileExtensions="*.release" + ExecutionDescription="create installer archive" + > + <Properties> + <StringProperty + Name="LastChromeInstaller" + DisplayName="Last Chrome Installer Directory" + Description="Directory where old version of installer is present (setup.exe and chrome.7z)" + Switch="--last_chrome_installer="[value]"" + /> + <StringProperty + Name="LastChromeVersion" + DisplayName="Last Chrome Version" + Description="Last released version of Chrome (used to name the patch file)" + Switch="--last_chrome_version="[value]"" + /> + <BooleanProperty + Name="RebuildArchive" + DisplayName="Rebuild Archive" + Description="Rebuilds chrome.7z even if already exists" + Switch="--rebuild_archive" + /> + </Properties> + </CustomBuildRule> + </Rules> +</VisualStudioToolFile> diff --git a/chrome/tools/build/win/reliability_test.vsprops b/chrome/tools/build/win/reliability_test.vsprops new file mode 100644 index 0000000..e3a76bf --- /dev/null +++ b/chrome/tools/build/win/reliability_test.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="reliability_test" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="RELIABILITY_TEST" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/resource_text_file_copy.rules b/chrome/tools/build/win/resource_text_file_copy.rules new file mode 100644 index 0000000..eb468f8 --- /dev/null +++ b/chrome/tools/build/win/resource_text_file_copy.rules @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<VisualStudioToolFile + Name="Resource text file copy" + Version="8.00" + > + <Rules> + <CustomBuildRule + Name="Resource text file copy" + CommandLine="xcopy /Y /D /Q $(InputPath) $(OutDir)\resources" + Outputs="$(OutDir)\Resources\$(InputFileName)" + FileExtensions="*.html;*.js;*.gif" + ExecutionDescription="Copying resource file..." + > + <Properties> + </Properties> + </CustomBuildRule> + </Rules> +</VisualStudioToolFile> diff --git a/chrome/tools/build/win/sort_sln.py b/chrome/tools/build/win/sort_sln.py new file mode 100644 index 0000000..f679c1b --- /dev/null +++ b/chrome/tools/build/win/sort_sln.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# Copyright 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import sys + +if len(sys.argv) != 2: + print """Usage: sort_sln.py <SOLUTIONNAME>.sln +to sort the solution file to a normalized scheme. Do this before checking in +changes to a solution file to avoid having a lot of unnecessary diffs.""" + sys.exit(1) + +filename = sys.argv[1] +print "Sorting " + filename; + +try: + sln = open(filename, "r"); +except IOError: + print "Unable to open " + filename + " for reading." + sys.exit(1) + +output = "" +seclines = None +while 1: + line = sln.readline() + if not line: + break + + if seclines is not None: + # Process the end of a section, dump the sorted lines + if line.lstrip().startswith('End'): + output = output + ''.join(sorted(seclines)) + seclines = None + # Process within a section + else: + seclines.append(line) + continue + + # Process the start of a section + if (line.lstrip().startswith('GlobalSection') or + line.lstrip().startswith('ProjectSection')): + if seclines: raise Exception('Already in a section') + seclines = [] + + output = output + line + +sln.close() +try: + sln = open(filename, "w") + sln.write(output) +except IOError: + print "Unable to write to " + filename + sys.exit(1); +print "Done." diff --git a/chrome/tools/build/win/test_memory_usage.vsprops b/chrome/tools/build/win/test_memory_usage.vsprops new file mode 100644 index 0000000..93c34cc --- /dev/null +++ b/chrome/tools/build/win/test_memory_usage.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="test_memory_usage" + > + <Tool + Name="VCLinkerTool" + AdditionalDependencies="psapi.lib" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/test_shell_tests.vsprops b/chrome/tools/build/win/test_shell_tests.vsprops new file mode 100644 index 0000000..d008862 --- /dev/null +++ b/chrome/tools/build/win/test_shell_tests.vsprops @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="test_shell_tests" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="..\..\..\v8\public;" + PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="winmm.lib" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/ui_test.vsprops b/chrome/tools/build/win/ui_test.vsprops new file mode 100644 index 0000000..4a41137 --- /dev/null +++ b/chrome/tools/build/win/ui_test.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="ui_test" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="UI_TEST" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/unit_test.vsprops b/chrome/tools/build/win/unit_test.vsprops new file mode 100644 index 0000000..893ef30 --- /dev/null +++ b/chrome/tools/build/win/unit_test.vsprops @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="unit_test" + InheritedPropertySheets="$(SolutionDir)third_party\wtl\using_wtl.vsprops" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="$(SolutionDir).." + PreprocessorDefinitions="UNIT_TEST" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="rpcrt4.lib oleacc.lib comsupp.lib" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/using_generated_strings.vsprops b/chrome/tools/build/win/using_generated_strings.vsprops new file mode 100644 index 0000000..da11cb0 --- /dev/null +++ b/chrome/tools/build/win/using_generated_strings.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="using_generated_strings" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(OutDir)\obj\generated_resources";"$(OutDir)\obj\localized_strings"" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/using_javascriptcore.vsprops b/chrome/tools/build/win/using_javascriptcore.vsprops new file mode 100644 index 0000000..139d6f7 --- /dev/null +++ b/chrome/tools/build/win/using_javascriptcore.vsprops @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="using_javascriptcore" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(SolutionDir)\third_party\webkit\src\JavaScriptCore\bindings";"$(SolutionDir)\third_party\webkit\src\JavaScriptCore";"$(SolutionDir)\third_party\webkit\src\JavaScriptCore\os-win32";"$(SolutionDir)webkit\pending";"$(SolutionDir)webkit\pending\wtf"" + /> +</VisualStudioPropertySheet> diff --git a/chrome/tools/build/win/version.bat b/chrome/tools/build/win/version.bat new file mode 100644 index 0000000..0cda045 --- /dev/null +++ b/chrome/tools/build/win/version.bat @@ -0,0 +1,44 @@ +:: Batch file run as build command for vers.vcproj +@echo off + +setlocal + +set InFile=%~1 +set SolutionDir=%~2 +set IntDir=%~3 +set OutFile=%~4 +set VarsBat=%IntDir%/vers-vars.bat + +:: Use GNU tools +call %SolutionDir%\..\third_party\gnu\setup_env.bat + +:: Load version digits as environment variables +cat %SolutionDir%\VERSION | sed "s/\(.*\)/set \1/" > %VarsBat% + +:: Load branding strings as environment variables +cat %SolutionDir%\BRANDING | sed "s/\(.*\)/set \1/" >> %VarsBat% + +if not "%OFFICIAL_BUILD%" == "1" set OFFICIAL_BUILD=0 + +:: Determine the current repository revision number +set PATH=%~dp0..\..\..\..\third_party\svn;%PATH% +svn.exe info | grep.exe "Revision:" | cut -d" " -f2- | sed "s/\(.*\)/set LASTCHANGE=\1/" >> %VarsBat% +call %VarsBat% + +::echo LastChange: %LASTCHANGE% + +:: output file +cat %InFile% | sed "s/@MAJOR@/%MAJOR%/" ^ + | sed "s/@MINOR@/%MINOR%/" ^ + | sed "s/@BUILD@/%BUILD%/" ^ + | sed "s/@PATCH@/%PATCH%/" ^ + | sed "s/@COMPANY_FULLNAME@/%COMPANY_FULLNAME%/" ^ + | sed "s/@COMPANY_SHORTNAME@/%COMPANY_SHORTNAME%/" ^ + | sed "s/@PRODUCT_FULLNAME@/%PRODUCT_FULLNAME%/" ^ + | sed "s/@PRODUCT_SHORTNAME@/%PRODUCT_SHORTNAME%/" ^ + | sed "s/@PRODUCT_EXE@/%PRODUCT_EXE%/" ^ + | sed "s/@COPYRIGHT@/%COPYRIGHT%/" ^ + | sed "s/@OFFICIAL_BUILD@/%OFFICIAL_BUILD%/" ^ + | sed "s/@LASTCHANGE@/%LASTCHANGE%/" > %OutFile% + +endlocal diff --git a/chrome/tools/build/win/version.rules b/chrome/tools/build/win/version.rules new file mode 100644 index 0000000..244de21 --- /dev/null +++ b/chrome/tools/build/win/version.rules @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<VisualStudioToolFile + Name="Version Template" + Version="8.00" + > + <Rules> + <CustomBuildRule + Name="Version" + DisplayName="Version" + CommandLine="$(SolutionDir)/tools/build/win/version.bat [inputs] "$(SolutionDir)" "$(IntDir)" "$(IntDir)/$(InputName)"" + Outputs="$(IntDir)/$(InputName)" + AdditionalDependencies="$(SolutionDir)/VERSION;$(SolutionDir)/BRANDING;$(SolutionDir)/tools/build/win/version.bat" + FileExtensions="*.version" + ExecutionDescription="Generating version template file" + > + <Properties> + </Properties> + </CustomBuildRule> + </Rules> +</VisualStudioToolFile> |