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

Unified Diff: tools/gn/test_with_scope.cc

Issue 1892393002: 🐜 GN: Make write_runtime_deps take effect only a target is resolved (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 4 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
« no previous file with comments | « tools/gn/test_with_scope.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/test_with_scope.cc
diff --git a/tools/gn/test_with_scope.cc b/tools/gn/test_with_scope.cc
index 32d5dd675850bcf54886b0289b086360306a655b..0ddd4636be4299de4a1972edf7214bbdc45f7046 100644
--- a/tools/gn/test_with_scope.cc
+++ b/tools/gn/test_with_scope.cc
@@ -24,6 +24,7 @@ TestWithScope::TestWithScope()
settings_.set_default_toolchain_label(toolchain_.label());
SetupToolchain(&toolchain_);
+ scope_.set_item_collector(&items_);
}
TestWithScope::~TestWithScope() {
@@ -37,6 +38,28 @@ Label TestWithScope::ParseLabel(const std::string& str) const {
return result;
}
+bool TestWithScope::ExecuteSnippet(const std::string& str, Err* err) {
+ TestParseInput input(str);
+ if (input.has_error()) {
+ *err = input.parse_err();
+ return false;
+ }
+
+ size_t first_item = items_.size();
+ input.parsed()->Execute(&scope_, err);
+ if (err->has_error())
+ return false;
+
+ for (size_t i = first_item; i < items_.size(); ++i) {
+ CHECK(items_[i]->AsTarget() != nullptr)
+ << "Only targets are supported in ExecuteSnippet()";
+ items_[i]->AsTarget()->SetToolchain(&toolchain_);
+ if (!items_[i]->OnResolved(err))
+ return false;
+ }
+ return true;
+}
+
// static
void TestWithScope::SetupToolchain(Toolchain* toolchain) {
Err err;
« no previous file with comments | « tools/gn/test_with_scope.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698