New issue
Advanced search Search tips

Issue 814816 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Working directory not maintained on gn ninja regeneration

Project Member Reported by scottmg@chromium.org, Feb 22 2018

Issue description

When regenerating the the build files, the working directory isn't saved. This means that relative paths in the command line that were correct on initial generation are incorrect on regeneration.

Repro in Chromium:

[scottmg:~/work/cr/src ((0023f0453fc0...))]$ cat x.txt
//base:base_unittests
[scottmg:~/work/cr/src ((0023f0453fc0...))]$ gn gen out/test --runtime-deps-list-file=x.txt
Done. Made 8401 targets from 1466 files in 3706ms
[scottmg:~/work/cr/src ((0023f0453fc0...))]$ touch base/BUILD.gn
[scottmg:~/work/cr/src ((0023f0453fc0...))]$ ninja -C out/test
ninja: Entering directory `out/test'
[0->1/1 ~1] Regenerating ninja files
FAILED: build.ninja
../../buildtools/mac/gn --root=../.. -q --runtime-deps-list-file=x.txt gen .
ERROR File for --runtime-deps-list-file doesn't exist.
The file given was "x.txt"
ninja: error: rebuilding 'build.ninja': subcommand failed
 
Project Member

Comment 1 by bugdroid1@chromium.org, Feb 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/crashpad/crashpad.git/+/3030ae54171aa20f316bc35c7603ef4ac2b6cb86

commit 3030ae54171aa20f316bc35c7603ef4ac2b6cb86
Author: Scott Graham <scottmg@chromium.org>
Date: Thu Feb 22 18:05:55 2018

fuchsia: Fix ninja auto-regen after run

After the avoidance of abspath(), automatic regeneration of ninja files
was broken following a test run. The problem is that the
--runtime-deps-list-file argument gets saved into the regeneration rule,
but it's relative to the cwd. The cwd is CRASHPAD_DIR on the first run,
but the binary_dir on regenerations, so either way it doesn't work (this
should probably fixed in either GN or ninja).

We could abspath the path the runtime deps targets file to avoid this.
However, it's a bit cluttery to have that --runtime-deps-list-file in
the regeneration rule anyway, when really it's only required to extract
runtime deps at test-running time. (Also, if you happened to delete only
targets.txt from the out dir, the regeneration would mysteriously fail.)
So since generation only takes tens of milliseconds, the best thing to
do is just remove it from the regeneration rule by re-running gn gen
without the flag after we've extracted the .runtime_deps to prepare for
the run.

Bug: crashpad:196, chromium:814816
Change-Id: I009851d8b821fef5c953d463ba9c4880e5cc082a
Reviewed-on: https://chromium-review.googlesource.com/929887
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>

[modify] https://crrev.com/3030ae54171aa20f316bc35c7603ef4ac2b6cb86/build/run_tests.py

Cc: thomasanderson@chromium.org
Labels: -OS-Linux -OS-Android -OS-Windows -OS-iOS -OS-Chrome -OS-Mac -OS-Fuchsia
+thomasanderson, who's poked at similar path-related issues recently.

Sign in to add a comment