| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return this; | 95 return this; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void Target::OnResolved() { | 98 void Target::OnResolved() { |
| 99 DCHECK(output_type_ != UNKNOWN); | 99 DCHECK(output_type_ != UNKNOWN); |
| 100 | 100 |
| 101 // Convert any groups we depend on to just direct dependencies on that | 101 // Convert any groups we depend on to just direct dependencies on that |
| 102 // group's deps. We insert the new deps immediately after the group so that | 102 // group's deps. We insert the new deps immediately after the group so that |
| 103 // the ordering is preserved. We need to keep the original group so that any | 103 // the ordering is preserved. We need to keep the original group so that any |
| 104 // flags, etc. that it specifies itself are applied to us. | 104 // flags, etc. that it specifies itself are applied to us. |
| 105 size_t original_deps_size = deps_.size(); | 105 for (size_t i = 0; i < deps_.size(); i++) { |
| 106 for (size_t i = 0; i < original_deps_size; i++) { | |
| 107 const Target* dep = deps_[i].ptr; | 106 const Target* dep = deps_[i].ptr; |
| 108 if (dep->output_type_ == GROUP) { | 107 if (dep->output_type_ == GROUP) { |
| 109 deps_.insert(deps_.begin() + i + 1, dep->deps_.begin(), dep->deps_.end()); | 108 deps_.insert(deps_.begin() + i + 1, dep->deps_.begin(), dep->deps_.end()); |
| 110 i += dep->deps_.size(); | 109 i += dep->deps_.size(); |
| 111 } | 110 } |
| 112 } | 111 } |
| 113 | 112 |
| 114 // Only add each config once. First remember the target's configs. | 113 // Only add each config once. First remember the target's configs. |
| 115 ConfigSet unique_configs; | 114 ConfigSet unique_configs; |
| 116 for (size_t i = 0; i < configs_.size(); i++) | 115 for (size_t i = 0; i < configs_.size(); i++) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 215 |
| 217 // Android STL doesn't like insert(begin, end) so do it manually. | 216 // Android STL doesn't like insert(begin, end) so do it manually. |
| 218 // TODO(brettw) this can be changed to insert(dep->begin(), dep->end()) when | 217 // TODO(brettw) this can be changed to insert(dep->begin(), dep->end()) when |
| 219 // Android uses a better STL. | 218 // Android uses a better STL. |
| 220 for (std::set<const Target*>::const_iterator cur = | 219 for (std::set<const Target*>::const_iterator cur = |
| 221 dep->recursive_hard_deps().begin(); | 220 dep->recursive_hard_deps().begin(); |
| 222 cur != dep->recursive_hard_deps().end(); ++cur) | 221 cur != dep->recursive_hard_deps().end(); ++cur) |
| 223 recursive_hard_deps_.insert(*cur); | 222 recursive_hard_deps_.insert(*cur); |
| 224 } | 223 } |
| 225 } | 224 } |
| OLD | NEW |