diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-12 01:15:32 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-12 01:15:32 +0000 |
commit | ee550e1f837209fdfdfdfdcf5384d6fb7c49608b (patch) | |
tree | 83f389b280e28751a7487b7e289f0138c96a0db2 /tools | |
parent | ec25ef6654f8811266fc5fb19fd3e1bac5cd5f24 (diff) | |
download | chromium_src-ee550e1f837209fdfdfdfdcf5384d6fb7c49608b.zip chromium_src-ee550e1f837209fdfdfdfdcf5384d6fb7c49608b.tar.gz chromium_src-ee550e1f837209fdfdfdfdcf5384d6fb7c49608b.tar.bz2 |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/grit/build/grit_resource_file.bat | 15 | ||||
-rw-r--r-- | tools/grit/build/grit_resources.rules | 10 | ||||
-rw-r--r-- | tools/grit/grit/tool/build.py | 15 |
3 files changed, 38 insertions, 2 deletions
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 @@ <CustomBuildRule Name="GRIT Generated Resources" DisplayName="GRIT Generated Resources" - CommandLine="$(SolutionDir)..\tools\grit\build\grit_resource_file.bat [inputs] "$(SolutionDir)" "$(OutDir)\grit_derived_sources"" + CommandLine="$(SolutionDir)..\tools\grit\build\grit_resource_file.bat [inputs] "$(SolutionDir)" "$(OutDir)\grit_derived_sources" [AllOptions]" Outputs="$(OutDir)\grit_derived_sources\$(InputName).h" AdditionalDependencies="$(SolutionDir)..\tools\grit\build\grit_resource_file.bat;$(SolutionDir)..\tools\grit\grit.py" FileExtensions="*.grd" ExecutionDescription="Generating resources..." > <Properties> + <StringProperty + Name="PreprocessorDefinitions" + DisplayName="Preprocessor Definitions" + Description="Defines a text macro with the given name." + Switch=""[value]"" + Delimited="true" + Inheritable="true" + /> </Properties> </CustomBuildRule> </Rules> 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. |