OLD | NEW |
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.h" | 5 #include "tools/gn/target.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "tools/gn/config_values_extractors.h" | 8 #include "tools/gn/config_values_extractors.h" |
9 #include "tools/gn/scheduler.h" | 9 #include "tools/gn/scheduler.h" |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // One we haven't seen yet, also apply it to ourselves. | 50 // One we haven't seen yet, also apply it to ourselves. |
51 dest->push_back(all[i]); | 51 dest->push_back(all[i]); |
52 unique_configs->insert(all[i].ptr); | 52 unique_configs->insert(all[i].ptr); |
53 } | 53 } |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 Target::Target(const Settings* settings, const Label& label) | 59 Target::Target(const Settings* settings, const Label& label) |
60 : Item(label), | 60 : Item(settings, label), |
61 settings_(settings), | |
62 output_type_(UNKNOWN), | 61 output_type_(UNKNOWN), |
63 hard_dep_(false), | 62 hard_dep_(false), |
64 external_(false), | 63 external_(false), |
65 generated_(false), | 64 generated_(false), |
66 generator_function_(NULL) { | 65 generator_function_(NULL) { |
67 } | 66 } |
68 | 67 |
69 Target::~Target() { | 68 Target::~Target() { |
70 } | 69 } |
71 | 70 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (output_type_ != GROUP) { | 147 if (output_type_ != GROUP) { |
149 // Don't pull target info like libraries and configs from dependencies into | 148 // Don't pull target info like libraries and configs from dependencies into |
150 // a group target. When A depends on a group G, the G's dependents will | 149 // a group target. When A depends on a group G, the G's dependents will |
151 // be treated as direct dependencies of A, so this is unnecessary and will | 150 // be treated as direct dependencies of A, so this is unnecessary and will |
152 // actually result in duplicated settings (since settings will also be | 151 // actually result in duplicated settings (since settings will also be |
153 // pulled from G to A in case G has configs directly on it). | 152 // pulled from G to A in case G has configs directly on it). |
154 PullDependentTargetInfo(&unique_configs); | 153 PullDependentTargetInfo(&unique_configs); |
155 } | 154 } |
156 | 155 |
157 // Mark as resolved. | 156 // Mark as resolved. |
158 if (!settings_->build_settings()->target_resolved_callback().is_null()) { | 157 if (!settings()->build_settings()->target_resolved_callback().is_null()) { |
159 g_scheduler->ScheduleWork(base::Bind(&TargetResolvedThunk, | 158 g_scheduler->ScheduleWork(base::Bind(&TargetResolvedThunk, |
160 settings_->build_settings()->target_resolved_callback(), | 159 settings()->build_settings()->target_resolved_callback(), |
161 this)); | 160 this)); |
162 } | 161 } |
163 } | 162 } |
164 | 163 |
165 bool Target::HasBeenGenerated() const { | 164 bool Target::HasBeenGenerated() const { |
166 return generated_; | 165 return generated_; |
167 } | 166 } |
168 | 167 |
169 void Target::SetGenerated(const Token* token) { | 168 void Target::SetGenerated(const Token* token) { |
170 DCHECK(!generated_); | 169 DCHECK(!generated_); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // don't need to bother copying to our configs, only forwarding. | 215 // don't need to bother copying to our configs, only forwarding. |
217 DCHECK(std::find_if(deps_.begin(), deps_.end(), | 216 DCHECK(std::find_if(deps_.begin(), deps_.end(), |
218 LabelPtrPtrEquals<Target>(from_target)) != | 217 LabelPtrPtrEquals<Target>(from_target)) != |
219 deps_.end()); | 218 deps_.end()); |
220 direct_dependent_configs_.insert( | 219 direct_dependent_configs_.insert( |
221 direct_dependent_configs_.end(), | 220 direct_dependent_configs_.end(), |
222 from_target->direct_dependent_configs().begin(), | 221 from_target->direct_dependent_configs().begin(), |
223 from_target->direct_dependent_configs().end()); | 222 from_target->direct_dependent_configs().end()); |
224 } | 223 } |
225 } | 224 } |
OLD | NEW |