Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: tools/gn/ninja_build_writer.cc

Issue 265693003: Redo GN "args" command (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/gn/ninja_build_writer.cc
diff --git a/tools/gn/ninja_build_writer.cc b/tools/gn/ninja_build_writer.cc
index c0fc7fcfedfd9667c26de0984cf2fca47c7f92d1..f9039046a72aeaec777d9417ef5cf6d1ddbfbda3 100644
--- a/tools/gn/ninja_build_writer.cc
+++ b/tools/gn/ninja_build_writer.cc
@@ -51,7 +51,11 @@ std::string GetSelfInvocationCommand(const BuildSettings* build_settings) {
const CommandLine::SwitchMap& switches = our_cmdline.GetSwitches();
for (CommandLine::SwitchMap::const_iterator i = switches.begin();
i != switches.end(); ++i) {
- if (i->first != "q" && i->first != "root") {
+ // Only write arguments we haven't already written. Always skip "args"
+ // since those will have been written to the file and will be used
+ // implicitly in the future. Keeping --args would mean changes to the file
+ // would be ignored.
+ if (i->first != "q" && i->first != "root" && i->first != "args") {
std::string escaped_value =
EscapeString(FilePathToUTF8(i->second), escape_shell, NULL);
cmdline.AppendSwitchASCII(i->first, escaped_value);
@@ -130,23 +134,6 @@ void NinjaBuildWriter::WriteNinjaRules() {
<< " generator = 1\n"
<< " depfile = build.ninja.d\n";
- // Provide a way to force regenerating ninja files if the user is suspicious
- // something is out-of-date. This will be "ninja refresh".
- out_ << "\nbuild refresh: gn\n";
-
- // Provide a way to see what flags are associated with this build:
- // This will be "ninja show".
- const CommandLine& our_cmdline = *CommandLine::ForCurrentProcess();
- std::string args = our_cmdline.GetSwitchValueASCII("args");
- out_ << "rule echo\n";
- out_ << " command = echo $text\n";
- out_ << " description = ECHO $desc\n";
- out_ << "build show: echo\n";
- out_ << " desc = build arguments:\n";
- out_ << " text = "
- << (args.empty() ? std::string("No build args, using defaults.") : args)
- << "\n";
-
// Input build files. These go in the ".d" file. If we write them as
// dependencies in the .ninja file itself, ninja will expect the files to
// exist and will error if they don't. When files are listed in a depfile,
« tools/gn/command_args.cc ('K') | « tools/gn/gn.gyp ('k') | tools/gn/setup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698