diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-05 20:27:53 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-05 20:27:53 +0000 |
commit | e1bd79f30d777a17411bf0efd54d90b59c00f600 (patch) | |
tree | 8ec4d5560c1df26a3c655ce98ae8586c23eaf096 /tools/gn/target_generator.cc | |
parent | da22c3c95242b05675da6b5e452c5dad8c5db1ee (diff) | |
download | chromium_src-e1bd79f30d777a17411bf0efd54d90b59c00f600.zip chromium_src-e1bd79f30d777a17411bf0efd54d90b59c00f600.tar.gz chromium_src-e1bd79f30d777a17411bf0efd54d90b59c00f600.tar.bz2 |
Add get_target_outputs function to GN
This function returns the outputs for a target that appeared previously in the same file. This is frequently needed for getting the files resulting from an action.
The main operational change is that targets that are generated are stashed in a vector as we process a file and then dispatched once that file is finished, rather than being dispatched as-we-go. This way we can ask questions about the targets that appeared previously in the file.
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/269723006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/target_generator.cc')
-rw-r--r-- | tools/gn/target_generator.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/gn/target_generator.cc b/tools/gn/target_generator.cc index 2820298..cf6bc1f 100644 --- a/tools/gn/target_generator.cc +++ b/tools/gn/target_generator.cc @@ -117,8 +117,16 @@ void TargetGenerator::GenerateTarget(Scope* scope, "I am very confused."); } - if (!err->has_error()) - scope->settings()->build_settings()->ItemDefined(target.PassAs<Item>()); + if (err->has_error()) + return; + + // Save this target for the file. + Scope::ItemVector* collector = scope->GetItemCollector(); + if (!collector) { + *err = Err(function_call, "Can't define a target in this context."); + return; + } + collector->push_back(new scoped_ptr<Item>(target.PassAs<Item>())); } const BuildSettings* TargetGenerator::GetBuildSettings() const { |