diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-19 21:11:05 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-19 21:11:05 +0000 |
commit | 60749e1c3bc06c226a427f82363acc71ec976d03 (patch) | |
tree | 63c337a1665ef511d0ee7f624079badd8205c6c6 /tools/gn/value.cc | |
parent | 3624f729459ccda7125fe003e10ef53845e64286 (diff) | |
download | chromium_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/value.cc')
-rw-r--r-- | tools/gn/value.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/gn/value.cc b/tools/gn/value.cc index cb78faa..5a595d0 100644 --- a/tools/gn/value.cc +++ b/tools/gn/value.cc @@ -65,24 +65,22 @@ int64 Value::InterpretAsInt() const { return 0; } -std::string Value::ToString() const { +std::string Value::ToString(bool quote_string) const { switch (type_) { case NONE: return "<void>"; case INTEGER: return base::Int64ToString(int_value_); case STRING: + if (quote_string) + return "\"" + string_value_ + "\""; return string_value_; case LIST: { std::string result = "["; for (size_t i = 0; i < list_value_.size(); i++) { if (i > 0) result += ", "; - // TODO(brettw) maybe also want to escape quotes in the string. - if (list_value_[i].type() == STRING) - result += std::string("\"") + list_value_[i].ToString() + "\""; - else - result += list_value_[i].ToString(); + result += list_value_[i].ToString(true); } result.push_back(']'); return result; |