Commit eceed2e7 authored by brettw's avatar brettw Committed by Commit bot

GN: use the correct directory for self-invocation.

GN writes a Ninja command to re-invoke GN when a build file changes. Previously
this hardcoded the build directory. But if the user renames the build
directory, Ninja will think the files are out of date but GN will keep
regenerating files in another directory.

This changes the directory to "." because Ninja will invoke all commands with
the build directory as the current one.

BUG=639965

Review-Url: https://codereview.chromium.org/2389133003
Cr-Commit-Position: refs/heads/master@{#422995}
parent 0caeced0
......@@ -52,8 +52,13 @@ std::string GetSelfInvocationCommand(const BuildSettings* build_settings) {
PathService::Get(base::FILE_EXE, &executable);
base::CommandLine cmdline(executable.NormalizePathSeparatorsTo('/'));
// Use "." for the directory to generate. When Ninja runs the command it
// will have the build directory as the current one. Coding it explicitly
// will cause everything to get confused if the user renames the directory.
cmdline.AppendArg("gen");
cmdline.AppendArg(build_settings->build_dir().value());
cmdline.AppendArg(".");
cmdline.AppendSwitchPath(std::string("--") + switches::kRoot,
build_settings->root_path());
// Successful automatic invocations shouldn't print output.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment