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

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

Issue 334333005: Add directory extraction to GN path handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/ninja_copy_target_writer.h" 5 #include "tools/gn/ninja_copy_target_writer.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "tools/gn/file_template.h" 8 #include "tools/gn/file_template.h"
9 #include "tools/gn/string_utils.h" 9 #include "tools/gn/string_utils.h"
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 std::vector<OutputFile> output_files; 24 std::vector<OutputFile> output_files;
25 25
26 std::string rule_prefix = helper_.GetRulePrefix(target_->settings()); 26 std::string rule_prefix = helper_.GetRulePrefix(target_->settings());
27 27
28 for (size_t i = 0; i < target_->sources().size(); i++) { 28 for (size_t i = 0; i < target_->sources().size(); i++) {
29 const SourceFile& input_file = target_->sources()[i]; 29 const SourceFile& input_file = target_->sources()[i];
30 30
31 // Make the output file from the template. 31 // Make the output file from the template.
32 std::vector<std::string> template_result; 32 std::vector<std::string> template_result;
33 output_template.ApplyString(input_file.value(), &template_result); 33 output_template.Apply(input_file, &template_result);
34 CHECK(template_result.size() == 1); 34 CHECK(template_result.size() == 1);
35 OutputFile output_file(template_result[0]); 35 OutputFile output_file(template_result[0]);
36 36
37 output_files.push_back(output_file); 37 output_files.push_back(output_file);
38 38
39 out_ << "build "; 39 out_ << "build ";
40 path_output_.WriteFile(out_, output_file); 40 path_output_.WriteFile(out_, output_file);
41 out_ << ": " << rule_prefix << "copy "; 41 out_ << ": " << rule_prefix << "copy ";
42 path_output_.WriteFile(out_, input_file); 42 path_output_.WriteFile(out_, input_file);
43 out_ << std::endl; 43 out_ << std::endl;
44 } 44 }
45 45
46 // Write out the rule for the target to copy all of them. 46 // Write out the rule for the target to copy all of them.
47 out_ << std::endl << "build "; 47 out_ << std::endl << "build ";
48 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(target_)); 48 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(target_));
49 out_ << ": " << rule_prefix << "stamp"; 49 out_ << ": " << rule_prefix << "stamp";
50 for (size_t i = 0; i < output_files.size(); i++) { 50 for (size_t i = 0; i < output_files.size(); i++) {
51 out_ << " "; 51 out_ << " ";
52 path_output_.WriteFile(out_, output_files[i]); 52 path_output_.WriteFile(out_, output_files[i]);
53 } 53 }
54 out_ << std::endl; 54 out_ << std::endl;
55 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698