Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools,gyp: don't force build actions with multiple outputs #23982

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tools/gyp/pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,8 +1758,15 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
self.WriteLn('\t%s' % '@:')
self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate))
self.WriteLn('%s: %s%s' %
(intermediate, ' '.join(inputs), force_append))
# Don't add `force_append` (FORCE_DO_CMD) to the intermediate sentinal.
# Adding it makes the action run alway, even when there are no changes.
# Excluding macOS which has a different way of resolving dependancies
# which can lead to deadlocks.
# (refack): AFAICT because `*.intermediate` files don't have build rules.
if self.flavor == 'mac':
self.WriteLn('%s: %s%s' % (intermediate, ' '.join(inputs), force_append))
else:
self.WriteLn('%s: %s' % (intermediate, ' '.join(inputs)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong way of doing it. You're effectively ignoring the value of the force argument to WriteMakeRule() here.

The call comes from WriteDoCmd(). Forcing the action to run when it's a command is correct; commands are imperatives. You should try to come up with another way of solving this.

Copy link
Contributor Author

@refack refack Oct 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know this is a hack. But the soup GYP generates for make is hard to reason about, and empirically this works (it also works on macOS, but might lead to deadlocks when run -jN with N > 1). Works as in rebuilds iff action's file inputs are touched.

I'll give it more thought...

actions.insert(0, '$(call do_cmd,touch)')

if actions:
Expand Down