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

Issue 25683011: Add the ability to generate a depfile when running grit build. (Closed)

Created:
7 years, 2 months ago by koz (OOO until 15th September)
Modified:
6 years, 11 months ago
Reviewers:
Nico, Jói
CC:
grit-developer_googlegroups.com, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/external/grit-i18n.git@master
Visibility:
Public.

Description

Add the ability to generate a depfile when running grit build. This is analogous to the ability of some compilers to generate depfiles that contain the .h files a .cc file depends on when it compiles it. This is useful for speeding up build systems because the input dependencies don't need to be determined before compilation. As there are no pre-determined outputs from a .grd file (all the outputs are determined by the file contents) the depfile refers to itself and acts as a stamp for the generated outputs. BUG=297672

Patch Set 1 #

Total comments: 9

Patch Set 2 : add test, respond to comments #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -4 lines) Patch
M grit/tool/build.py View 1 5 chunks +55 lines, -4 lines 1 comment Download
M grit/tool/build_unittest.py View 1 1 chunk +23 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
koz (OOO until 15th September)
7 years, 2 months ago (2013-10-04 07:06:38 UTC) #1
Jói
Neat. I'd like to see a unit test for this added logic. Also a few ...
7 years, 2 months ago (2013-10-04 09:47:11 UTC) #2
tony
Clever! How is this going to work on Windows when using MSVS? I thought MSVS ...
7 years, 2 months ago (2013-10-04 21:39:46 UTC) #3
brettw
This will be a ninja-only thing.
7 years, 2 months ago (2013-10-04 21:40:45 UTC) #4
Nico
https://codereview.chromium.org/25683011/diff/1/grit/tool/build.py File grit/tool/build.py (right): https://codereview.chromium.org/25683011/diff/1/grit/tool/build.py#newcode155 grit/tool/build.py:155: self.GenerateDepsfile(opts.input, deps_dir) On 2013/10/04 09:47:12, Jói wrote: > I ...
7 years, 2 months ago (2013-10-04 21:42:02 UTC) #5
tony
On 2013/10/04 21:40:45, brettw wrote: > This will be a ninja-only thing. Does that mean ...
7 years, 2 months ago (2013-10-04 21:43:09 UTC) #6
koz (OOO until 15th September)
Thanks for the feedback! I've added a test an responded to comments. https://codereview.chromium.org/25683011/diff/1/grit/tool/build.py File grit/tool/build.py ...
7 years, 2 months ago (2013-10-09 06:01:16 UTC) #7
Jói
LGTM
7 years, 2 months ago (2013-10-10 11:11:32 UTC) #8
koz (OOO until 15th September)
On 2013/10/10 11:11:32, Jói wrote: > LGTM Thanks, Joi. I'm not a committer on grit, ...
7 years, 2 months ago (2013-10-11 04:54:09 UTC) #9
Jói
On 2013/10/11 04:54:09, koz wrote: > On 2013/10/10 11:11:32, Jói wrote: > > LGTM > ...
7 years, 2 months ago (2013-10-11 09:54:19 UTC) #10
Nico
https://codereview.chromium.org/25683011/diff/10001/grit/tool/build.py File grit/tool/build.py (right): https://codereview.chromium.org/25683011/diff/10001/grit/tool/build.py#newcode350 grit/tool/build.py:350: outfile.writelines(depfile_contents) I'm currently looking at using this in gyp, ...
6 years, 11 months ago (2013-12-31 01:07:42 UTC) #11
Nico
On 2013/12/31 01:07:42, Nico wrote: > https://codereview.chromium.org/25683011/diff/10001/grit/tool/build.py > File grit/tool/build.py (right): > > https://codereview.chromium.org/25683011/diff/10001/grit/tool/build.py#newcode350 > ...
6 years, 11 months ago (2013-12-31 01:41:55 UTC) #12
Nico
6 years, 11 months ago (2013-12-31 06:19:52 UTC) #13
Message was sent while issue was closed.
On 2013/12/31 01:41:55, Nico wrote:
> On 2013/12/31 01:07:42, Nico wrote:
> > https://codereview.chromium.org/25683011/diff/10001/grit/tool/build.py
> > File grit/tool/build.py (right):
> > 
> >
>
https://codereview.chromium.org/25683011/diff/10001/grit/tool/build.py#newcod...
> > grit/tool/build.py:350: outfile.writelines(depfile_contents)
> > I'm currently looking at using this in gyp, and I'm wondering: Why does the
> flag
> > take a directory, not a path? As is, the generator or the gyp file will need
> to
> > know that the .d file is in os.path.join(dep_dir_path, grd_filename + '.d').
> > It'd be slightly nicer and simpler everywhere, if grit just got a --depfile
> > parameter instead of --dep-dir, no? Why was this design chosen?
> 
> An example, to make this more concrete:
> 
> Let's say I change this in grit_action.gypi:
> 
> +  'ninja_depfile': '<(grit_out_dir)/<(grit_grd_file).d',
>    'outputs': [
>      '<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines)
'
>          '--outputs \'<(grit_out_dir)\' '
> @@ -35,7 +40,9 @@
>               '-f', '<(grit_resource_ids)',
>               '-o', '<(grit_out_dir)',
>               '<@(grit_defines)',
> -             '<@(grit_additional_defines)' ],
> +             '<@(grit_additional_defines)',
> +             '--dep-dir=<(grit_out_dir)',
> +             ],
> 
> Now, net/net.gyp sets
> 
>             'grit_grd_file': 'base/net_resources.grd',
> 
> so --dep-dir becomes ../out/Release/gen/net (note: no "base") but
ninja_depfile
> evaluates to "gen/net/base/net_resources.grd.d" (note: "base/"). So the gyp
file
> would really have to say ` 'ninja_depfile':
> '<(grit_out_dir)/os.path.basename(<(grit_grd_file)).d',` which is slightly
> annoying to express. With a --depfile  parameter, things would Just Work I
> think.

Oh, I guess the base dir for stuff in the depfile needs to be specified somehow
too…

Powered by Google App Engine
This is Rietveld 408576698