Revert 264226 "Reduce dependency of TiclInvalidationService on P..."
[chromium-blink-merge.git] / tools / gn / binary_target_generator.cc
blob0eba531568231ef322e94d6928d46d151def8d6f
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
3 // found in the LICENSE file.
5 #include "tools/gn/binary_target_generator.h"
7 #include "tools/gn/config_values_generator.h"
8 #include "tools/gn/err.h"
9 #include "tools/gn/scope.h"
10 #include "tools/gn/variables.h"
12 BinaryTargetGenerator::BinaryTargetGenerator(
13 Target* target,
14 Scope* scope,
15 const FunctionCallNode* function_call,
16 Target::OutputType type,
17 Err* err)
18 : TargetGenerator(target, scope, function_call, err),
19 output_type_(type) {
22 BinaryTargetGenerator::~BinaryTargetGenerator() {
25 void BinaryTargetGenerator::DoRun() {
26 target_->set_output_type(output_type_);
28 FillOutputName();
29 if (err_->has_error())
30 return;
32 FillOutputExtension();
33 if (err_->has_error())
34 return;
36 FillSources();
37 if (err_->has_error())
38 return;
40 FillPublic();
41 if (err_->has_error())
42 return;
44 FillSourcePrereqs();
45 if (err_->has_error())
46 return;
48 FillConfigs();
49 if (err_->has_error())
50 return;
52 // Config values (compiler flags, etc.) set directly on this target.
53 ConfigValuesGenerator gen(&target_->config_values(), scope_,
54 scope_->GetSourceDir(), err_);
55 gen.Run();
56 if (err_->has_error())
57 return;
60 void BinaryTargetGenerator::FillOutputName() {
61 const Value* value = scope_->GetValue(variables::kOutputName, true);
62 if (!value)
63 return;
64 if (!value->VerifyTypeIs(Value::STRING, err_))
65 return;
66 target_->set_output_name(value->string_value());
69 void BinaryTargetGenerator::FillOutputExtension() {
70 const Value* value = scope_->GetValue(variables::kOutputExtension, true);
71 if (!value)
72 return;
73 if (!value->VerifyTypeIs(Value::STRING, err_))
74 return;
75 target_->set_output_extension(value->string_value());