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

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

Issue 216903004: Add optional public header checking to GN build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unit test Created 6 years, 8 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
« no previous file with comments | « tools/gn/header_checker_unittest.cc ('k') | tools/gn/secondary/testing/gmock/BUILD.gn » ('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 (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_binary_target_writer.h" 5 #include "tools/gn/ninja_binary_target_writer.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "tools/gn/config_values_extractors.h" 10 #include "tools/gn/config_values_extractors.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void NinjaBinaryTargetWriter::WriteSources( 144 void NinjaBinaryTargetWriter::WriteSources(
145 std::vector<OutputFile>* object_files) { 145 std::vector<OutputFile>* object_files) {
146 const Target::FileList& sources = target_->sources(); 146 const Target::FileList& sources = target_->sources();
147 object_files->reserve(sources.size()); 147 object_files->reserve(sources.size());
148 148
149 std::string implicit_deps = GetSourcesImplicitDeps(); 149 std::string implicit_deps = GetSourcesImplicitDeps();
150 150
151 for (size_t i = 0; i < sources.size(); i++) { 151 for (size_t i = 0; i < sources.size(); i++) {
152 const SourceFile& input_file = sources[i]; 152 const SourceFile& input_file = sources[i];
153 153
154 SourceFileType input_file_type = GetSourceFileType(input_file, 154 SourceFileType input_file_type = GetSourceFileType(input_file);
155 settings_->target_os());
156 if (input_file_type == SOURCE_UNKNOWN) 155 if (input_file_type == SOURCE_UNKNOWN)
157 continue; // Skip unknown file types. 156 continue; // Skip unknown file types.
158 std::string command = 157 std::string command =
159 helper_.GetRuleForSourceType(settings_, input_file_type); 158 helper_.GetRuleForSourceType(settings_, input_file_type);
160 if (command.empty()) 159 if (command.empty())
161 continue; // Skip files not needing compilation. 160 continue; // Skip files not needing compilation.
162 161
163 OutputFile output_file = helper_.GetOutputFileForSource( 162 OutputFile output_file = helper_.GetOutputFileForSource(
164 target_, input_file, input_file_type); 163 target_, input_file, input_file_type);
165 object_files->push_back(output_file); 164 object_files->push_back(output_file);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 if (dep->output_type() == Target::SOURCE_SET) { 421 if (dep->output_type() == Target::SOURCE_SET) {
423 if (target_->output_type() == Target::SOURCE_SET) { 422 if (target_->output_type() == Target::SOURCE_SET) {
424 // When a source set depends on another source set, add it as a data 423 // When a source set depends on another source set, add it as a data
425 // dependency so if the user says "ninja second_source_set" it will 424 // dependency so if the user says "ninja second_source_set" it will
426 // also compile the first (what you would expect) even though we'll 425 // also compile the first (what you would expect) even though we'll
427 // never do anything with the first one's files. 426 // never do anything with the first one's files.
428 non_linkable_deps->push_back(dep); 427 non_linkable_deps->push_back(dep);
429 } else { 428 } else {
430 // Linking in a source set, copy its object files. 429 // Linking in a source set, copy its object files.
431 for (size_t i = 0; i < dep->sources().size(); i++) { 430 for (size_t i = 0; i < dep->sources().size(); i++) {
432 SourceFileType input_file_type = GetSourceFileType( 431 SourceFileType input_file_type = GetSourceFileType(dep->sources()[i]);
433 dep->sources()[i], dep->settings()->target_os());
434 if (input_file_type != SOURCE_UNKNOWN && 432 if (input_file_type != SOURCE_UNKNOWN &&
435 input_file_type != SOURCE_H) { 433 input_file_type != SOURCE_H) {
436 // Note we need to specify the target as the source_set target 434 // Note we need to specify the target as the source_set target
437 // itself, since this is used to prefix the object file name. 435 // itself, since this is used to prefix the object file name.
438 extra_object_files->insert(helper_.GetOutputFileForSource( 436 extra_object_files->insert(helper_.GetOutputFileForSource(
439 dep, dep->sources()[i], input_file_type)); 437 dep, dep->sources()[i], input_file_type));
440 } 438 }
441 } 439 }
442 } 440 }
443 } else if (can_link_libs && dep->IsLinkable()) { 441 } else if (can_link_libs && dep->IsLinkable()) {
(...skipping 17 matching lines...) Expand all
461 } 459 }
462 460
463 // Data files. 461 // Data files.
464 const std::vector<SourceFile>& data = target_->data(); 462 const std::vector<SourceFile>& data = target_->data();
465 for (size_t i = 0; i < data.size(); i++) { 463 for (size_t i = 0; i < data.size(); i++) {
466 out_ << " "; 464 out_ << " ";
467 path_output_.WriteFile(out_, data[i]); 465 path_output_.WriteFile(out_, data[i]);
468 } 466 }
469 } 467 }
470 } 468 }
OLDNEW
« no previous file with comments | « tools/gn/header_checker_unittest.cc ('k') | tools/gn/secondary/testing/gmock/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698