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

Side by Side Diff: tools/gn/action_target_generator.cc

Issue 1155713006: GN: Make file/dir resolving return errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/gn/command_format.cc » ('j') | tools/gn/source_dir.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/action_target_generator.h" 5 #include "tools/gn/action_target_generator.h"
6 6
7 #include "tools/gn/build_settings.h" 7 #include "tools/gn/build_settings.h"
8 #include "tools/gn/err.h" 8 #include "tools/gn/err.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/parse_tree.h" 10 #include "tools/gn/parse_tree.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // if it doesn't have one. 69 // if it doesn't have one.
70 const Value* value = scope_->GetValue(variables::kScript, true); 70 const Value* value = scope_->GetValue(variables::kScript, true);
71 if (!value) { 71 if (!value) {
72 *err_ = Err(function_call_, "This target type requires a \"script\"."); 72 *err_ = Err(function_call_, "This target type requires a \"script\".");
73 return false; 73 return false;
74 } 74 }
75 if (!value->VerifyTypeIs(Value::STRING, err_)) 75 if (!value->VerifyTypeIs(Value::STRING, err_))
76 return false; 76 return false;
77 77
78 SourceFile script_file = 78 SourceFile script_file =
79 scope_->GetSourceDir().ResolveRelativeFile(value->string_value(), 79 scope_->GetSourceDir().ResolveRelativeFile(
80 *value, err_,
80 scope_->settings()->build_settings()->root_path_utf8()); 81 scope_->settings()->build_settings()->root_path_utf8());
81 if (script_file.value().empty()) { 82 if (script_file.value().empty())
scottmg 2015/06/03 21:01:58 should this be err_.has_error()?
82 *err_ = Err(*value, "script name is empty");
83 return false; 83 return false;
84 }
85 target_->action_values().set_script(script_file); 84 target_->action_values().set_script(script_file);
86 return true; 85 return true;
87 } 86 }
88 87
89 bool ActionTargetGenerator::FillScriptArgs() { 88 bool ActionTargetGenerator::FillScriptArgs() {
90 const Value* value = scope_->GetValue(variables::kArgs, true); 89 const Value* value = scope_->GetValue(variables::kArgs, true);
91 if (!value) 90 if (!value)
92 return true; 91 return true;
93 return target_->action_values().args().Parse(*value, err_); 92 return target_->action_values().args().Parse(*value, err_);
94 } 93 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 *err_ = Err(function_call_, 130 *err_ = Err(function_call_,
132 "action_foreach should have a pattern in the output.", 131 "action_foreach should have a pattern in the output.",
133 "An action_foreach target should have a source expansion pattern in\n" 132 "An action_foreach target should have a source expansion pattern in\n"
134 "it to map source file to unique output file name. Otherwise, the\n" 133 "it to map source file to unique output file name. Otherwise, the\n"
135 "build system can't determine when your script needs to be run."); 134 "build system can't determine when your script needs to be run.");
136 return false; 135 return false;
137 } 136 }
138 } 137 }
139 return true; 138 return true;
140 } 139 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/command_format.cc » ('j') | tools/gn/source_dir.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698