Why does the build have an action that updates files in the source tree?

3 views
Skip to first unread message

Mark Mentovai

unread,
Feb 7, 2011, 4:06:02 PM2/7/11
to n...@chromium.org, Alok Priyadarshi, Evan Martin, Elliot Glaysher (Chromium), chromium-dev
Neb and Alok-

We found a file in the source tree that’s both checked in AND
something that’s potentially touched during the build process:
webkit/plugins/ppapi/ppb_opengles_impl.cc. This file is generated by
the generate_ppapi_gles_implementation action in
webkit/glue/webkit_glue.gypi, which specifies:

{
'action_name': 'generate_ppapi_gles_implementation',
'variables': {
'gles_script':
'<(DEPTH)/gpu/command_buffer/build_gles2_cmd_buffer.py',
},
'inputs': [
'<(gles_script)',
],
'outputs': [
'<(DEPTH)/webkit/plugins/ppapi/ppb_opengles_impl.cc',
],
'action': [
'python',
'<(gles_script)',
'--alternate-mode=chrome_ppapi'
],
'message': 'Generating Pepper OpenGL ES implementation',
}

This is bad. ppb_opengles_impl.cc shouldn’t be in the source tree
(where you’ve placed it now). It should be somewhere in
<(INTERMEDIATE_DIR) or <(SHARED_INTERMEDIATE_DIR).

It looks like at some point (r73222) this file transitioned from being
checked-in to being generated during the build. That would have been
the right time to move the location of the file.

Having a generated file checked in is bad for all sorts of reasons.
It’ll add a nuisance file to developers’ changelists. It’ll interfere
with the “pristine state” of a source tree. It can confuse build
environments that need to track dependencies.

Please restructure your action to not dump its output into the source tree.

Evan Martin

unread,
Feb 7, 2011, 4:36:51 PM2/7/11
to Mark Mentovai, n...@chromium.org, Alok Priyadarshi, Elliot Glaysher (Chromium), chromium-dev
On Mon, Feb 7, 2011 at 1:06 PM, Mark Mentovai <ma...@chromium.org> wrote:
>              'outputs': [
>                '<(DEPTH)/webkit/plugins/ppapi/ppb_opengles_impl.cc',
>              ],

Should we consider some sort of gyp lint check that prevents output
paths that don't use one of the intermediate dirs?
I think getting this right is kind of subtle.

Gavin Peters (蓋文彼德斯)

unread,
Feb 8, 2011, 3:21:56 PM2/8/11
to ma...@chromium.org, n...@chromium.org, Alok Priyadarshi, Evan Martin, Elliot Glaysher (Chromium), chromium-dev
I have now reverted this change: http://codereview.chromium.org/6461001 , landed as r74161.

A few times a day, these automated build products (which were built during common build targets like "chrome" and "unit_tests") were causing me merge conflicts.

Happy merging, everyone!

- Gavin


--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
   http://groups.google.com/a/chromium.org/group/chromium-dev

Mark Mentovai

unread,
Feb 8, 2011, 3:37:39 PM2/8/11
to Nebojsa Sabovic, Gavin Peters (蓋文彼德斯), Alok Priyadarshi, Evan Martin, Elliot Glaysher (Chromium), chromium-dev
Nebojsa Sabovic wrote:
> This CL was originally producing the generated sources in the intermediate
> dir, but then we've decided to keep the generated files checked in the
> source tree so that we can notice when they change, and to have a make
> target that can be triggered manually.
> I've added suppress_wildcard: 1, I thought that would do it. No?
> I'll re-land the .py part, at least. Is there a way of making a build target
> that won't run as part of any build?

suppress_wildcard only excludes * from depending on the target. It
doesn’t prevent anyone else from writing an explicit dependency on
your target.

If there’s a GYP target for it, someone might depend on it, and then
it becomes part of the build.

Mark Mentovai

unread,
Feb 8, 2011, 3:45:52 PM2/8/11
to Nebojsa Sabovic, Gavin Peters (蓋文彼德斯), Alok Priyadarshi, Evan Martin, Elliot Glaysher (Chromium), chromium-dev
Nebojsa Sabovic wrote:
> No rule explicitly depends on it. Why was it getting built then?

I suspect that this is a by-product of how make works. The makefiles
wind up with a rule to produce that file, so any time something
depends on that file (for example, to compile it), make will run the
rule if the file appears out of date. make doesn’t quite offer
target-level granularity, it’s allows file-to-file dependency
relationships, and effectively puts them into the same dependency
graph as target-to-target relationships.

Elliot Glaysher (Chromium)

unread,
Feb 8, 2011, 3:47:01 PM2/8/11
to Nebojsa Sabovic, Mark Mentovai, Gavin Peters (蓋文彼德斯), Alok Priyadarshi, Evan Martin, chromium-dev
On Tue, Feb 8, 2011 at 12:42 PM, Nebojsa Sabovic <n...@chromium.org> wrote:
> No rule explicitly depends on it. Why was it getting built then?

If you just type "make", it will implicitly build all targets. Could that be it?

-- Elliot

Reply all
Reply to author
Forward
0 new messages