Chromium Code Reviews| 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]) |