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

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

Issue 1413573006: Make GN --as=output relative to the root build directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « tools/gn/commands.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/commands.h" 5 #include "tools/gn/commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "tools/gn/builder.h" 8 #include "tools/gn/builder.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/item.h" 10 #include "tools/gn/item.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 void PrintTargetsAsOutputs(bool indent, 317 void PrintTargetsAsOutputs(bool indent,
318 const std::vector<const Target*>& targets) { 318 const std::vector<const Target*>& targets) {
319 if (targets.empty()) 319 if (targets.empty())
320 return; 320 return;
321 321
322 // Grab the build settings from a random target. 322 // Grab the build settings from a random target.
323 const BuildSettings* build_settings = 323 const BuildSettings* build_settings =
324 targets[0]->settings()->build_settings(); 324 targets[0]->settings()->build_settings();
325 325
326 SourceDir current_dir = SourceDirForCurrentDirectory(
327 build_settings->root_path());
328 for (const Target* target : targets) { 326 for (const Target* target : targets) {
329 // Use the link output file if there is one, otherwise fall back to the 327 // Use the link output file if there is one, otherwise fall back to the
330 // dependency output file (for actions, for example). 328 // dependency output file (for actions, for example).
331 OutputFile output_file = target->link_output_file(); 329 OutputFile output_file = target->link_output_file();
332 if (output_file.value().empty()) 330 if (output_file.value().empty())
333 output_file = target->dependency_output_file(); 331 output_file = target->dependency_output_file();
334 332
335 SourceFile output_as_source = 333 SourceFile output_as_source =
336 output_file.AsSourceFile(build_settings); 334 output_file.AsSourceFile(build_settings);
337 std::string result = RebasePath(output_as_source.value(), current_dir, 335 std::string result = RebasePath(output_as_source.value(),
336 build_settings->build_dir(),
338 build_settings->root_path_utf8()); 337 build_settings->root_path_utf8());
339 if (indent) 338 if (indent)
340 OutputString(" "); 339 OutputString(" ");
341 OutputString(result); 340 OutputString(result);
342 OutputString("\n"); 341 OutputString("\n");
343 } 342 }
344 } 343 }
345 344
346 } // namespace 345 } // namespace
347 346
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 493 }
495 } 494 }
496 495
497 void FilterAndPrintTargetSet(bool indent, 496 void FilterAndPrintTargetSet(bool indent,
498 const std::set<const Target*>& targets) { 497 const std::set<const Target*>& targets) {
499 std::vector<const Target*> target_vector(targets.begin(), targets.end()); 498 std::vector<const Target*> target_vector(targets.begin(), targets.end());
500 FilterAndPrintTargets(indent, &target_vector); 499 FilterAndPrintTargets(indent, &target_vector);
501 } 500 }
502 501
503 } // namespace commands 502 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/commands.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698