I recently had a GN bootstrap fail this way when executed from extracted tarball as opposed to git checkout:
FAILED: python ../../tools/gn/last_commit_position.py ../../ gen/tools/gn/last_commit_position.h TOOLS_GN_LAST_COMMIT_POSITION_H_
Could not get last commit position.
I'm just wondering, would there be some way to make this optional or non-fatal? One way I can see could be last_commit_position.py outputting "UNKNOWN" instead of failing.
I can totally write patches for this, just wanted to discuss first.
For reference, this seems to be related to the following code in src/tools/gn/gn_main.cc :
// Only the GN-generated build makes this header for now.
// TODO(brettw) consider adding this if we need it in GYP.
#if defined(GN_BUILD)
#include "tools/gn/last_commit_position.h"
#else
#define LAST_COMMIT_POSITION "UNKNOWN"
#endif
and src/tools/gn/BUILD.gn:
action("last_commit_position") {
script = "last_commit_position.py"
# This dependency forces a re-run when the code is synced.
inputs = [
"//build/util/LASTCHANGE",
]
outfile = "$target_gen_dir/last_commit_position.h"
outputs = [
outfile,
]
args = [
rebase_path("//", root_build_dir),
rebase_path(outfile, root_build_dir),
"TOOLS_GN_LAST_COMMIT_POSITION_H_",
]
}
# Note for Windows debugging: GN is super-multithreaded and uses a lot of STL.
# Iterator debugging on Windows does locking for every access, which ends up
# slowing down debug runtime from 0:36 to 9:40. If you want to run debug builds
# of GN over the large Chrome build, you will want to set the arg:
# enable_iterator_debugging = false
executable("gn") {
sources = [
"gn_main.cc",
]
deps = [
":gn_lib",
":last_commit_position",
"//base",
"//build/config/sanitizers:deps",
]
}
Paweł