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

Unified Diff: tools/gn/function_toolchain.cc

Issue 350743004: Allow dependencies of toolchains in GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « tools/gn/builder_unittest.cc ('k') | tools/gn/ninja_copy_target_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/function_toolchain.cc
diff --git a/tools/gn/function_toolchain.cc b/tools/gn/function_toolchain.cc
index c930df2f90fa9a6ad5dec9cfb605c2fdba3713d5..b748f363f091ef7b3d3981a74b7858c00519328a 100644
--- a/tools/gn/function_toolchain.cc
+++ b/tools/gn/function_toolchain.cc
@@ -9,6 +9,7 @@
#include "tools/gn/scope.h"
#include "tools/gn/settings.h"
#include "tools/gn/toolchain.h"
+#include "tools/gn/value_extractors.h"
#include "tools/gn/variables.h"
namespace functions {
@@ -51,6 +52,11 @@ const char kToolchain_Help[] =
" arguments to be passed to the toolchain build via the\n"
" \"toolchain_args\" call (see \"gn help toolchain_args\").\n"
"\n"
+ " In addition, a toolchain can specify dependencies via the \"deps\"\n"
+ " variable like a target. These dependencies will be resolved before any\n"
+ " target in the toolchain is compiled. To avoid circular dependencies\n"
+ " these must be targets defined in another toolchain.\n"
+ "\n"
"Invoking targets in toolchains:\n"
"\n"
" By default, when a target depends on another, there is an implicit\n"
@@ -116,10 +122,21 @@ Value RunToolchain(Scope* scope,
if (err->has_error())
return Value();
+ // Read deps (if any).
+ const Value* deps_value = block_scope.GetValue(variables::kDeps, true);
+ if (deps_value) {
+ ExtractListOfLabels(
+ *deps_value, block_scope.GetSourceDir(),
+ ToolchainLabelForScope(&block_scope), &toolchain->deps(), err);
+ if (err->has_error())
+ return Value();
+ }
+
+
if (!block_scope.CheckForUnusedVars(err))
return Value();
- // Save this target for the file.
+ // Save this toolchain.
Scope::ItemVector* collector = scope->GetItemCollector();
if (!collector) {
*err = Err(function, "Can't define a toolchain in this context.");
« no previous file with comments | « tools/gn/builder_unittest.cc ('k') | tools/gn/ninja_copy_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698