Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: grit/tool/build.py

Issue 997813004: Allow depfile to depend on a Stamp file instead of the default first input. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Add unittest + nit in comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | grit/tool/build_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/tool/build.py
diff --git a/grit/tool/build.py b/grit/tool/build.py
index 68245a343476faa07441fca7fa163a15d33a48e5..f6cc4bbcfc7bb02775b0476ec73df35ee99693c4 100644
--- a/grit/tool/build.py
+++ b/grit/tool/build.py
@@ -116,7 +116,12 @@ Options:
systems to realize that dependent build steps might be
unnecessary, at the cost of comparing the output data at
grit time.
-
+
+ --depend-on-stamp
+ If specified along with --depfile and --depdir, the depfile
+ generated will depend on the depfile itself instead of the
Nico 2015/03/12 21:34:24 this is kinda weird
cjhopman 2015/03/12 21:38:35 Yeah, and it'll need to be changed if we change gn
+ first output in the input .grd file. Thus the depfile also
+ plays the role of an implicit stamp file.
Conditional inclusion of resources only affects the output of files which
control which resources get linked into a binary, e.g. it affects .rc files
@@ -139,10 +144,12 @@ are exported to translation interchange files (e.g. XMB files), etc.
rc_header_format = None
output_all_resource_defines = None
write_only_new = False
+ depend_on_stamp = False
(own_opts, args) = getopt.getopt(args, 'a:o:D:E:f:w:t:h:',
('depdir=','depfile=','assert-file-list=',
'output-all-resource-defines',
'no-output-all-resource-defines',
+ 'depend-on-stamp',
'write-only-new='))
for (key, val) in own_opts:
if key == '-a':
@@ -179,6 +186,8 @@ are exported to translation interchange files (e.g. XMB files), etc.
depfile = val
elif key == '--write-only-new':
write_only_new = val != '0'
+ elif key == '--depend-on-stamp':
+ depend_on_stamp = True
if len(args):
print 'This tool takes no tool-specific arguments.'
@@ -225,7 +234,7 @@ are exported to translation interchange files (e.g. XMB files), etc.
return 2
if depfile and depdir:
- self.GenerateDepfile(depfile, depdir, first_ids_file)
+ self.GenerateDepfile(depfile, depdir, first_ids_file, depend_on_stamp)
return 0
@@ -424,7 +433,7 @@ Extra output files:
return True
- def GenerateDepfile(self, depfile, depdir, first_ids_file):
+ def GenerateDepfile(self, depfile, depdir, first_ids_file, depend_on_stamp):
'''Generate a depfile that contains the imlicit dependencies of the input
grd. The depfile will be in the same format as a makefile, and will contain
references to files relative to |depdir|. It will be put in |depfile|.
@@ -446,7 +455,9 @@ Extra output files:
gen/blah.h: ../src/input1.xtb ../src/input2.xtb
Where "gen/blah.h" is the first output (Ninja expects the .d file to list
- the first output in cases where there is more than one).
+ the first output in cases where there is more than one). If the flag
+ --depend-on-stamp is specified, it is "gen/blah.rd.d" instead which is also
+ playing the role of a dummy stamp output now.
Note that all paths in the depfile are relative to ../out, the depdir.
'''
@@ -458,11 +469,15 @@ Extra output files:
if first_ids_file is not None:
infiles.append(first_ids_file)
- # Get the first output file relative to the depdir.
- outputs = self.res.GetOutputFiles()
- output_file = os.path.relpath(os.path.join(
- self.output_directory, outputs[0].GetFilename()), depdir)
+ if (depend_on_stamp):
+ output_file = depfile
+ else:
+ # Get the first output file relative to the depdir.
+ outputs = self.res.GetOutputFiles()
+ output_file = os.path.join(self.output_directory,
+ outputs[0].GetFilename())
+ output_file = os.path.relpath(output_file, depdir)
# The path prefix to prepend to dependencies in the depfile.
prefix = os.path.relpath(os.getcwd(), depdir)
deps_text = ' '.join([os.path.join(prefix, i) for i in infiles])
« no previous file with comments | « no previous file | grit/tool/build_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698