summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/chrome_resources.vcproj10
-rw-r--r--chrome/app/chrome_strings.vcproj8
-rw-r--r--tools/grit/build/grit_resources.rules2
-rw-r--r--tools/grit/grit/format/rc_header.py4
-rw-r--r--tools/grit/grit/tool/build.py25
5 files changed, 33 insertions, 16 deletions
diff --git a/chrome/app/chrome_resources.vcproj b/chrome/app/chrome_resources.vcproj
index 11d1dc1..96efc65 100644
--- a/chrome/app/chrome_resources.vcproj
+++ b/chrome/app/chrome_resources.vcproj
@@ -70,23 +70,23 @@
Name="Generated Files"
>
<File
- RelativePath="$(OutDir)\grit_derived_sources\browser_resources.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\browser_resources.h"
>
</File>
<File
- RelativePath="$(OutDir)\grit_derived_sources\common_resources.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\common_resources.h"
>
</File>
<File
- RelativePath="$(OutDir)\grit_derived_sources\debugger_resources.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\debugger_resources.h"
>
</File>
<File
- RelativePath="$(OutDir)\grit_derived_sources\renderer_resources.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\renderer_resources.h"
>
</File>
<File
- RelativePath="$(OutDir)\grit_derived_sources\theme_resources.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\theme_resources.h"
>
</File>
</Filter>
diff --git a/chrome/app/chrome_strings.vcproj b/chrome/app/chrome_strings.vcproj
index a4d063b..aa2b987 100644
--- a/chrome/app/chrome_strings.vcproj
+++ b/chrome/app/chrome_strings.vcproj
@@ -45,7 +45,7 @@
>
</File>
<File
- RelativePath="$(IntDir)\chromium_strings.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\chromium_strings.h"
>
</File>
<File
@@ -53,7 +53,7 @@
>
</File>
<File
- RelativePath="$(IntDir)\generated_resources.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\generated_resources.h"
>
</File>
<File
@@ -61,7 +61,7 @@
>
</File>
<File
- RelativePath="$(IntDir)\google_chrome_strings.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\google_chrome_strings.h"
>
</File>
<File
@@ -69,7 +69,7 @@
>
</File>
<File
- RelativePath="$(IntDir)\locale_settings.h"
+ RelativePath="$(OutDir)\grit_derived_sources\grit\locale_settings.h"
>
</File>
</Files>
diff --git a/tools/grit/build/grit_resources.rules b/tools/grit/build/grit_resources.rules
index e81f87e..8dd7c3f 100644
--- a/tools/grit/build/grit_resources.rules
+++ b/tools/grit/build/grit_resources.rules
@@ -8,7 +8,7 @@
Name="GRIT Generated Resources"
DisplayName="GRIT Generated Resources"
CommandLine="$(SolutionDir)..\tools\grit\build\grit_resource_file.bat [inputs] &quot;$(SolutionDir)&quot; &quot;$(OutDir)\grit_derived_sources&quot; [AllOptions]"
- Outputs="$(OutDir)\grit_derived_sources\grit\$(InputName).h"
+ Outputs="$(OutDir)\grit_derived_sources\$(InputName).rc"
AdditionalDependencies="$(SolutionDir)..\tools\grit\build\grit_resource_file.bat;$(SolutionDir)..\tools\grit\grit.py"
FileExtensions="*.grd"
ExecutionDescription="Generating resources..."
diff --git a/tools/grit/grit/format/rc_header.py b/tools/grit/grit/format/rc_header.py
index 4da974a..849bf14 100644
--- a/tools/grit/grit/format/rc_header.py
+++ b/tools/grit/grit/format/rc_header.py
@@ -7,7 +7,6 @@
'''
import re
-import time
from grit.format import interface
from grit import exception
@@ -26,10 +25,9 @@ class TopLevel(interface.ItemFormatter):
header_string = '''// Copyright (c) Google Inc. %d
// All rights reserved.
// This file is automatically generated by GRIT. Do not edit.
-// Built on %s
#pragma once
-''' % (util.GetCurrentYear(), time.asctime())
+''' % (util.GetCurrentYear())
# Check for emit nodes under the rc_header. If any emit node
# is present, we assume it means the GRD file wants to override
# the default header, with no includes.
diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py
index a2683fd..5fe2348 100644
--- a/tools/grit/grit/tool/build.py
+++ b/tools/grit/grit/tool/build.py
@@ -7,10 +7,12 @@
SCons build system.
'''
-import os
+import filecmp
import getopt
-import types
+import os
+import shutil
import sys
+import types
from grit import grd_reader
from grit import util
@@ -169,7 +171,9 @@ are exported to translation interchange files (e.g. XMB files), etc.
outdir = os.path.split(output.GetOutputFilename())[0]
if not os.path.exists(outdir):
os.makedirs(outdir)
- outfile = self.fo_create(output.GetOutputFilename(), 'wb')
+ # Write the results to a temporary file and only overwrite the original
+ # if the file changed. This avoids unnecessary rebuilds.
+ outfile = self.fo_create(output.GetOutputFilename() + '.tmp', 'wb')
if output.GetType() != 'data_package':
outfile = util.WrapOutputStream(outfile, encoding)
@@ -186,6 +190,21 @@ are exported to translation interchange files (e.g. XMB files), etc.
self.ProcessNode(self.res, output, outfile)
outfile.close()
+ # Now copy from the temp file back to the real output, but only if the
+ # real output doesn't exist or the contents of the file changed. This
+ # prevents identical headers from being written and .cc files from
+ # recompiling.
+ if not os.path.exists(output.GetOutputFilename()):
+ os.rename(output.GetOutputFilename() + '.tmp',
+ output.GetOutputFilename())
+ else:
+ files_match = filecmp.cmp(output.GetOutputFilename(),
+ output.GetOutputFilename() + '.tmp')
+ if output.GetType() != 'rc_header' or not files_match:
+ shutil.copy2(output.GetOutputFilename() + '.tmp',
+ output.GetOutputFilename())
+ os.remove(output.GetOutputFilename() + '.tmp')
+
self.VerboseOut(' done.\n')
# Print warnings if there are any duplicate shortcuts.