Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: tools/gn/runtime_deps.cc

Issue 2010173004: [Mac/GN] Collect a bundle's data_deps when using `gn desc runtime_deps`. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/gn/runtime_deps_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/runtime_deps_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698