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

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

Issue 524623005: Add testonly flag to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « tools/gn/target_generator.h ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »
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/target_generator.h" 5 #include "tools/gn/target_generator.h"
6 6
7 #include "tools/gn/action_target_generator.h" 7 #include "tools/gn/action_target_generator.h"
8 #include "tools/gn/binary_target_generator.h" 8 #include "tools/gn/binary_target_generator.h"
9 #include "tools/gn/build_settings.h" 9 #include "tools/gn/build_settings.h"
10 #include "tools/gn/config.h" 10 #include "tools/gn/config.h"
(...skipping 30 matching lines...) Expand all
41 return; 41 return;
42 42
43 FillData(); 43 FillData();
44 if (err_->has_error()) 44 if (err_->has_error())
45 return; 45 return;
46 46
47 FillDependencies(); 47 FillDependencies();
48 if (err_->has_error()) 48 if (err_->has_error())
49 return; 49 return;
50 50
51 FillTestonly();
52 if (err_->has_error())
53 return;
54
51 if (!Visibility::FillItemVisibility(target_, scope_, err_)) 55 if (!Visibility::FillItemVisibility(target_, scope_, err_))
52 return; 56 return;
53 57
54 // Do type-specific generation. 58 // Do type-specific generation.
55 DoRun(); 59 DoRun();
56 } 60 }
57 61
58 // static 62 // static
59 void TargetGenerator::GenerateTarget(Scope* scope, 63 void TargetGenerator::GenerateTarget(Scope* scope,
60 const FunctionCallNode* function_call, 64 const FunctionCallNode* function_call,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (err_->has_error()) 214 if (err_->has_error())
211 return; 215 return;
212 216
213 // This is a list of dependent targets to have their configs fowarded, so 217 // This is a list of dependent targets to have their configs fowarded, so
214 // it goes here rather than in FillConfigs. 218 // it goes here rather than in FillConfigs.
215 FillForwardDependentConfigs(); 219 FillForwardDependentConfigs();
216 if (err_->has_error()) 220 if (err_->has_error())
217 return; 221 return;
218 } 222 }
219 223
224 void TargetGenerator::FillTestonly() {
225 const Value* value = scope_->GetValue(variables::kTestonly, true);
226 if (value) {
227 if (!value->VerifyTypeIs(Value::BOOLEAN, err_))
228 return;
229 target_->set_testonly(value->boolean_value());
230 }
231 }
232
220 void TargetGenerator::FillOutputs(bool allow_substitutions) { 233 void TargetGenerator::FillOutputs(bool allow_substitutions) {
221 const Value* value = scope_->GetValue(variables::kOutputs, true); 234 const Value* value = scope_->GetValue(variables::kOutputs, true);
222 if (!value) 235 if (!value)
223 return; 236 return;
224 237
225 SubstitutionList& outputs = target_->action_values().outputs(); 238 SubstitutionList& outputs = target_->action_values().outputs();
226 if (!outputs.Parse(*value, err_)) 239 if (!outputs.Parse(*value, err_))
227 return; 240 return;
228 241
229 if (!allow_substitutions) { 242 if (!allow_substitutions) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 315
303 void TargetGenerator::FillForwardDependentConfigs() { 316 void TargetGenerator::FillForwardDependentConfigs() {
304 const Value* value = scope_->GetValue( 317 const Value* value = scope_->GetValue(
305 variables::kForwardDependentConfigsFrom, true); 318 variables::kForwardDependentConfigsFrom, true);
306 if (value) { 319 if (value) {
307 ExtractListOfUniqueLabels(*value, scope_->GetSourceDir(), 320 ExtractListOfUniqueLabels(*value, scope_->GetSourceDir(),
308 ToolchainLabelForScope(scope_), 321 ToolchainLabelForScope(scope_),
309 &target_->forward_dependent_configs(), err_); 322 &target_->forward_dependent_configs(), err_);
310 } 323 }
311 } 324 }
OLDNEW
« no previous file with comments | « tools/gn/target_generator.h ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698