New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 611633 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit 26 days ago
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

ninja build file regeneration doesn't work in some cases w/ GN built after r392491

Project Member Reported by dpranke@chromium.org, May 13 2016

Issue description

regenerating build files is currently broken with a tip-of-tree GN (one containing r392491).

do this:

% gn gen out/foo
% ninja -C out/foo gn
% mkdir out/bar
% echo "is_debug=false" > out/bar/args.gn
% out/foo/gn gen out/bar
% touch out/bar/args.gn
% ninja -C out/bar -d explain build.ninja
ninja: Entering directory `out/bar'
ninja explain: output build.ninja older than most recent input /media/src/src/c/src/out/bar/args.gn (1463108607 vs 1463108615)
[1/1] Regenerating ninja files
ninja explain: output build.ninja older than most recent input /media/src/src/c/src/out/bar/args.gn (1463108607 vs 1463108615)
[1/1] Regenerating ninja files
ninja explain: output build.ninja older than most recent input /media/src/src/c/src/out/bar/args.gn (1463108607 vs 1463108615)
[1/1] Regenerating ninja files
^C
%

(or some such ... the ninja regeneration loops indefinitely until it gives up).

The problem is in 

https://code.google.com/p/chromium/codesearch?q=ninja_build_writer.cc#chromium/src/tools/gn/ninja_build_writer.cc&l=176

By changing from unconditionally writing build.ninja to WriteFileIfChanged(), we don't update build.ninja when one of the dependencies is out of date. this means that build.ninja will always be out of date (args.gn doesn't actually matter in the example above, it could be any build file).

This is the reason the roll failed in 

https://codereview.chromium.org/1966613002/

Since nothing is using ToT GN yet, I'll leave the faulty CL in for now and leave the fix as an exercise to the reader, but we should fix this tomorrow so we're not blocked and can get the other fixes rolled.
 

Comment 1 by brettw@chromium.org, May 13 2016

Status: Started (was: Assigned)
Project Member

Comment 2 by bugdroid1@chromium.org, May 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/94b0b56868bb971253dc8f30b0b6aa3a846e70a4

commit 94b0b56868bb971253dc8f30b0b6aa3a846e70a4
Author: brettw <brettw@chromium.org>
Date: Fri May 13 18:41:03 2016

GN: Unconditionally write build.ninja.

I previously changed this to WriteFileIfChanged which tends to be faster,
especially on Windows. But Ninja's build dependency tracking expects the
timestamp of this file to be updated whenever any build input has been
modified.

BUG= 611633 

Review-Url: https://codereview.chromium.org/1981443002
Cr-Commit-Position: refs/heads/master@{#393591}

[modify] https://crrev.com/94b0b56868bb971253dc8f30b0b6aa3a846e70a4/tools/gn/ninja_build_writer.cc

Status: Fixed (was: Started)

Sign in to add a comment