OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/runtime_deps.h" | 5 #include "tools/gn/runtime_deps.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (is_target_data_dep && | 97 if (is_target_data_dep && |
98 (target->output_type() == Target::ACTION || | 98 (target->output_type() == Target::ACTION || |
99 target->output_type() == Target::ACTION_FOREACH || | 99 target->output_type() == Target::ACTION_FOREACH || |
100 target->output_type() == Target::COPY_FILES)) { | 100 target->output_type() == Target::COPY_FILES)) { |
101 std::vector<SourceFile> outputs; | 101 std::vector<SourceFile> outputs; |
102 target->action_values().GetOutputsAsSourceFiles(target, &outputs); | 102 target->action_values().GetOutputsAsSourceFiles(target, &outputs); |
103 for (const auto& output_file : outputs) | 103 for (const auto& output_file : outputs) |
104 AddIfNew(output_file.value(), target, deps, found_files); | 104 AddIfNew(output_file.value(), target, deps, found_files); |
105 } | 105 } |
106 | 106 |
| 107 // Data dependencies. |
| 108 for (const auto& dep_pair : target->data_deps()) { |
| 109 RecursiveCollectRuntimeDeps(dep_pair.ptr, true, |
| 110 deps, seen_targets, found_files); |
| 111 } |
| 112 |
107 // Do not recurse into bundle targets. A bundle's dependencies should be | 113 // Do not recurse into bundle targets. A bundle's dependencies should be |
108 // copied into the bundle itself for run-time access. | 114 // copied into the bundle itself for run-time access. |
109 if (target->output_type() == Target::CREATE_BUNDLE) { | 115 if (target->output_type() == Target::CREATE_BUNDLE) { |
110 SourceDir bundle_root_dir = | 116 SourceDir bundle_root_dir = |
111 target->bundle_data().GetBundleRootDirOutputAsDir(target->settings()); | 117 target->bundle_data().GetBundleRootDirOutputAsDir(target->settings()); |
112 AddIfNew(bundle_root_dir.value(), target, deps, found_files); | 118 AddIfNew(bundle_root_dir.value(), target, deps, found_files); |
113 return; | 119 return; |
114 } | 120 } |
115 | 121 |
116 // Non-data dependencies (both public and private). | 122 // Non-data dependencies (both public and private). |
117 for (const auto& dep_pair : target->GetDeps(Target::DEPS_LINKED)) { | 123 for (const auto& dep_pair : target->GetDeps(Target::DEPS_LINKED)) { |
118 if (dep_pair.ptr->output_type() == Target::EXECUTABLE) | 124 if (dep_pair.ptr->output_type() == Target::EXECUTABLE) |
119 continue; // Skip executables that aren't data deps. | 125 continue; // Skip executables that aren't data deps. |
120 RecursiveCollectRuntimeDeps(dep_pair.ptr, false, | 126 RecursiveCollectRuntimeDeps(dep_pair.ptr, false, |
121 deps, seen_targets, found_files); | 127 deps, seen_targets, found_files); |
122 } | 128 } |
123 | |
124 // Data dependencies. | |
125 for (const auto& dep_pair : target->data_deps()) { | |
126 RecursiveCollectRuntimeDeps(dep_pair.ptr, true, | |
127 deps, seen_targets, found_files); | |
128 } | |
129 } | 129 } |
130 | 130 |
131 bool CollectRuntimeDepsFromFlag(const Builder& builder, | 131 bool CollectRuntimeDepsFromFlag(const Builder& builder, |
132 RuntimeDepsVector* files_to_write, | 132 RuntimeDepsVector* files_to_write, |
133 Err* err) { | 133 Err* err) { |
134 std::string deps_target_list_file = | 134 std::string deps_target_list_file = |
135 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 135 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
136 switches::kRuntimeDepsListFile); | 136 switches::kRuntimeDepsListFile); |
137 | 137 |
138 if (deps_target_list_file.empty()) | 138 if (deps_target_list_file.empty()) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 for (const auto& entry : files_to_write) { | 295 for (const auto& entry : files_to_write) { |
296 // Currently this writes all runtime deps files sequentially. We generally | 296 // Currently this writes all runtime deps files sequentially. We generally |
297 // expect few of these. We can run this on the worker pool if it looks | 297 // expect few of these. We can run this on the worker pool if it looks |
298 // like it's talking a long time. | 298 // like it's talking a long time. |
299 if (!WriteRuntimeDepsFile(entry.first, entry.second, err)) | 299 if (!WriteRuntimeDepsFile(entry.first, entry.second, err)) |
300 return false; | 300 return false; |
301 } | 301 } |
302 return true; | 302 return true; |
303 } | 303 } |
OLD | NEW |