summaryrefslogtreecommitdiffstats
path: root/tools/gn/commands.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-19 21:11:05 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-19 21:11:05 +0000
commit60749e1c3bc06c226a427f82363acc71ec976d03 (patch)
tree63c337a1665ef511d0ee7f624079badd8205c6c6 /tools/gn/commands.cc
parent3624f729459ccda7125fe003e10ef53845e64286 (diff)
downloadchromium_src-60749e1c3bc06c226a427f82363acc71ec976d03.zip
chromium_src-60749e1c3bc06c226a427f82363acc71ec976d03.tar.gz
chromium_src-60749e1c3bc06c226a427f82363acc71ec976d03.tar.bz2
This hooks up build flags from the command-line and the toolchain (for re-invoking the build).
Using this, I was able to make the NaCl build of base compile (if the correct NaCl toolchain is extracted in advance to the right location). This is the first time I actually ran a cross-compile, and Ninja complained about duplicate rule definitions, so I now prefix rules in the non-default toolchain with the toolchain name. There were also some files that went in the wrong directory. I moved the toolchain definitions from the other platforms into a new directory tree in build/toolchains to be more clear. To make the toolchain args get passed to the build configuration, I had to add another state to the toolchain_manager's state machine, since we need to see those flags before starting that part of the build. This is described in more detail at the top of the .cc file. Since I was moving stuff around, I wanted to find references to the thing I was moving, so wrote a new command to find places that reference a given target "gn refs". I added new help for patterns since I used these for the new "refs" command. I removed the requirement that declare_args only be called once in a given scope. It now can be used anywhere to facilitate module-specific arguments. Because build arguments can now be declared anywhere, I added a "gn args" command-line command that will find and print all of the command line arguments passed into the build. It also prints the comment above the argument as a way to document it. The code to extract the comment is a but unfortunate. I think if/when we write an autoformatter, we'll need to incorporate comments into the parse tree more and this can be simplified greatly. Fixes up build.ninja dependencies if you remove a buildfile. Because I specified all input buildfiles in build.ninja, it would fail if you removed any of them. I now write out the build deps (for regenerating the build) in a .d file which will tolerate missing files. BUG= R=scottmg@chromium.org Review URL: https://codereview.chromium.org/22998003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/commands.cc')
-rw-r--r--tools/gn/commands.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/gn/commands.cc b/tools/gn/commands.cc
index cfa55cb..b0eaae8 100644
--- a/tools/gn/commands.cc
+++ b/tools/gn/commands.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "tools/gn/commands.h"
-
#include "tools/gn/item.h"
#include "tools/gn/item_node.h"
#include "tools/gn/label.h"
@@ -35,9 +34,11 @@ const CommandInfoMap& GetCommands() {
k##cmd##_Help, \
&Run##cmd);
+ INSERT_COMMAND(Args)
INSERT_COMMAND(Desc)
INSERT_COMMAND(Gen)
INSERT_COMMAND(Help)
+ INSERT_COMMAND(Refs)
#undef INSERT_COMMAND
}