From ee550e1f837209fdfdfdfdcf5384d6fb7c49608b Mon Sep 17 00:00:00 2001 From: "tc@google.com" Date: Thu, 12 Feb 2009 01:15:32 +0000 Subject: Create a chrome_resources.vcproj that holds grd files that hold non-string resources. Put browser_resources.grd into this vcproj. Port theme_resources.rc/theme_resources.h to theme_resources.grd and put it in the vcproj too. I did a find/replace on the theme_resources include line. Modify grit so header files go in grit_generated_resources/grit/ so the include path can be cleaner. I'll migrate the others in follow up patches. theme_resources.rc had a conditional include of distribution_resources.rc so I had to add support for preprocessor defines to visual studio. Review URL: http://codereview.chromium.org/20247 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9631 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/grit/build/grit_resource_file.bat | 15 ++++++++++++++- tools/grit/build/grit_resources.rules | 10 +++++++++- tools/grit/grit/tool/build.py | 15 +++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/grit/build/grit_resource_file.bat b/tools/grit/build/grit_resource_file.bat index 9769bef..bc5af21 100644 --- a/tools/grit/build/grit_resource_file.bat +++ b/tools/grit/build/grit_resource_file.bat @@ -9,11 +9,24 @@ set InFile=%~1 set SolutionDir=%~2 set OutDir=%~3 +:: We treat the next five args as preprocessor defines for grit. +set PreProc1=%~4 +set PreProc2=%~5 +set PreProc3=%~6 +set PreProc4=%~7 +set PreProc5=%~8 + IF NOT EXIST %OutDir% ( mkdir %OutDir% ) +IF NOT (%PreProc1%)==() set PreProc1=-D %PreProc1% +IF NOT (%PreProc2%)==() set PreProc2=-D %PreProc2% +IF NOT (%PreProc3%)==() set PreProc3=-D %PreProc3% +IF NOT (%PreProc4%)==() set PreProc4=-D %PreProc4% +IF NOT (%PreProc5%)==() set PreProc5=-D %PreProc5% + :: Put cygwin in the path call %SolutionDir%\..\third_party\cygwin\setup_env.bat -%SolutionDir%\..\third_party\python_24\python.exe %SolutionDir%\..\tools\grit\grit.py -i %InFile% build -o %OutDir% +%SolutionDir%\..\third_party\python_24\python.exe %SolutionDir%\..\tools\grit\grit.py -i %InFile% build -o %OutDir% %PreProc1% %PreProc2% %PreProc3% %PreProc4% %PreProc5% diff --git a/tools/grit/build/grit_resources.rules b/tools/grit/build/grit_resources.rules index 0f1614c..d686fed 100644 --- a/tools/grit/build/grit_resources.rules +++ b/tools/grit/build/grit_resources.rules @@ -7,13 +7,21 @@ + diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py index ab89809..9e45859 100644 --- a/tools/grit/grit/tool/build.py +++ b/tools/grit/grit/tool/build.py @@ -10,6 +10,7 @@ SCons build system. import os import getopt import types +import shutil import sys from grit import grd_reader @@ -189,6 +190,20 @@ are exported to translation interchange files (e.g. XMB files), etc. self.ProcessNode(self.res, output, outfile) outfile.close() + + # Generate the header and also put a copy in a grit subdir. We do this + # so our include paths can have 'grit' in them. + # TODO(tc): Once we transition all the #include lines to have 'grit' in + # the path, we can only generate one header. + if output.GetType() == 'rc_header': + dir_name, header_name = os.path.split(output.GetOutputFilename()) + dir_name = os.path.join(dir_name, 'grit') + try: + os.makedirs(dir_name) + except OSError, e: + pass + shutil.copy2(output.GetOutputFilename(), + os.path.join(dir_name, header_name)) self.VerboseOut(' done.\n') # Print warnings if there are any duplicate shortcuts. -- cgit v1.1