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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (found_seen_target->second || !is_target_data_dep) { | 74 if (found_seen_target->second || !is_target_data_dep) { |
75 // Already visited as a data dep, or the current dep is not a data | 75 // Already visited as a data dep, or the current dep is not a data |
76 // dep so visiting again will be a no-op. | 76 // dep so visiting again will be a no-op. |
77 return; | 77 return; |
78 } | 78 } |
79 // In the else case, the previously seen target was a regular dependency | 79 // In the else case, the previously seen target was a regular dependency |
80 // and we'll now process it as a data dependency. | 80 // and we'll now process it as a data dependency. |
81 } | 81 } |
82 (*seen_targets)[target] = is_target_data_dep; | 82 (*seen_targets)[target] = is_target_data_dep; |
83 | 83 |
84 // Add the main output file for executables and shared libraries. | 84 // Add the main output file for executables, shared libraries, and |
| 85 // loadable modules. |
85 if (target->output_type() == Target::EXECUTABLE || | 86 if (target->output_type() == Target::EXECUTABLE || |
| 87 target->output_type() == Target::LOADABLE_MODULE || |
86 target->output_type() == Target::SHARED_LIBRARY) | 88 target->output_type() == Target::SHARED_LIBRARY) |
87 AddIfNew(GetMainOutput(target), target, deps, found_files); | 89 AddIfNew(GetMainOutput(target), target, deps, found_files); |
88 | 90 |
89 // Add all data files. | 91 // Add all data files. |
90 for (const auto& file : target->data()) | 92 for (const auto& file : target->data()) |
91 AddIfNew(file, target, deps, found_files); | 93 AddIfNew(file, target, deps, found_files); |
92 | 94 |
93 // Actions/copy have all outputs considered when the're a data dep. | 95 // Actions/copy have all outputs considered when the're a data dep. |
94 if (is_target_data_dep && | 96 if (is_target_data_dep && |
95 (target->output_type() == Target::ACTION || | 97 (target->output_type() == Target::ACTION || |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 const char kRuntimeDeps_Help[] = | 144 const char kRuntimeDeps_Help[] = |
143 "Runtime dependencies\n" | 145 "Runtime dependencies\n" |
144 "\n" | 146 "\n" |
145 " Runtime dependencies of a target are exposed via the \"runtime_deps\"\n" | 147 " Runtime dependencies of a target are exposed via the \"runtime_deps\"\n" |
146 " category of \"gn desc\" (see \"gn help desc\") or they can be written\n" | 148 " category of \"gn desc\" (see \"gn help desc\") or they can be written\n" |
147 " at build generation time via \"--runtime-deps-list-file\"\n" | 149 " at build generation time via \"--runtime-deps-list-file\"\n" |
148 " (see \"gn help --runtime-deps-list-file\").\n" | 150 " (see \"gn help --runtime-deps-list-file\").\n" |
149 "\n" | 151 "\n" |
150 " To a first approximation, the runtime dependencies of a target are\n" | 152 " To a first approximation, the runtime dependencies of a target are\n" |
151 " the set of \"data\" files, data directories, and the shared libraries\n" | 153 " the set of \"data\" files, data directories, and the shared libraries\n" |
152 " from all transitive dependencies. Executables and shared libraries are\n" | 154 " from all transitive dependencies. Executables, shared libraries, and\n" |
153 " considered runtime dependencies of themselves.\n" | 155 " loadable modules are considered runtime dependencies of themselves.\n" |
154 "\n" | 156 "\n" |
155 "Executables\n" | 157 "Executables\n" |
156 "\n" | 158 "\n" |
157 " Executable targets and those executable targets' transitive\n" | 159 " Executable targets and those executable targets' transitive\n" |
158 " dependencies are not considered unless that executable is listed in\n" | 160 " dependencies are not considered unless that executable is listed in\n" |
159 " \"data_deps\". Otherwise, GN assumes that the executable (and\n" | 161 " \"data_deps\". Otherwise, GN assumes that the executable (and\n" |
160 " everything it requires) is a build-time dependency only.\n" | 162 " everything it requires) is a build-time dependency only.\n" |
161 "\n" | 163 "\n" |
162 "Actions and copies\n" | 164 "Actions and copies\n" |
163 "\n" | 165 "\n" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return false; | 265 return false; |
264 } | 266 } |
265 | 267 |
266 // Currently this writes all runtime deps files sequentially. We generally | 268 // Currently this writes all runtime deps files sequentially. We generally |
267 // expect few of these. We can run this on the worker pool if it looks | 269 // expect few of these. We can run this on the worker pool if it looks |
268 // like it's talking a long time. | 270 // like it's talking a long time. |
269 WriteRuntimeDepsFile(target); | 271 WriteRuntimeDepsFile(target); |
270 } | 272 } |
271 return true; | 273 return true; |
272 } | 274 } |
OLD | NEW |