Chromium Code Reviews| Index: tools/gn/ninja_binary_target_writer.cc |
| diff --git a/tools/gn/ninja_binary_target_writer.cc b/tools/gn/ninja_binary_target_writer.cc |
| index 98c6f1d40771c65d8d1214e9c572a379ffc5e7da..d0d89b41260f686995ecd7b08005a47f50a0ea3e 100644 |
| --- a/tools/gn/ninja_binary_target_writer.cc |
| +++ b/tools/gn/ninja_binary_target_writer.cc |
| @@ -752,6 +752,14 @@ void NinjaBinaryTargetWriter::WriteLinkerStuff( |
| path_output_.WriteFiles(out_, object_files); |
| path_output_.WriteFiles(out_, extra_object_files); |
| + // Libraries specified by paths. |
|
brettw
2015/12/18 00:04:55
We should get a test for this new behavior.
agrieve
2015/12/18 15:39:07
Done.
|
| + const OrderedSet<LibFile>& libs = target_->all_libs(); |
| + for (size_t i = 0; i < libs.size(); i++) { |
| + if (libs[i].is_source_file()) { |
|
brettw
2015/12/18 00:04:55
No {} for single-line ones (file style).
agrieve
2015/12/18 15:39:07
Done.
|
| + path_output_.WriteFile(out_, libs[i].source_file()); |
| + } |
| + } |
| + |
| // Dependencies. |
| std::vector<OutputFile> implicit_deps; |
| std::vector<OutputFile> solibs; |
| @@ -857,20 +865,25 @@ void NinjaBinaryTargetWriter::WriteLibs() { |
| // Libraries that have been recursively pushed through the dependency tree. |
| EscapeOptions lib_escape_opts; |
| lib_escape_opts.mode = ESCAPE_NINJA_COMMAND; |
| - const OrderedSet<std::string> all_libs = target_->all_libs(); |
| + const OrderedSet<LibFile> all_libs = target_->all_libs(); |
| const std::string framework_ending(".framework"); |
| for (size_t i = 0; i < all_libs.size(); i++) { |
| - if (base::EndsWith(all_libs[i], framework_ending, |
| - base::CompareCase::INSENSITIVE_ASCII)) { |
| + const LibFile& lib_file = all_libs[i]; |
| + std::string value = lib_file.value(); |
|
brettw
2015/12/18 00:04:55
Can this be a const ref? I think it would also be
agrieve
2015/12/18 15:39:08
Done.
|
| + if (lib_file.is_source_file()) { |
| + out_ << " "; |
| + path_output_.WriteFile(out_, lib_file.source_file()); |
| + } else if (base::EndsWith(value, framework_ending, |
| + base::CompareCase::INSENSITIVE_ASCII)) { |
| // Special-case libraries ending in ".framework" to support Mac: Add the |
| // -framework switch and don't add the extension to the output. |
| out_ << " -framework "; |
| - EscapeStringToStream(out_, |
| - all_libs[i].substr(0, all_libs[i].size() - framework_ending.size()), |
| + EscapeStringToStream( |
| + out_, value.substr(0, value.size() - framework_ending.size()), |
| lib_escape_opts); |
| } else { |
| out_ << " " << tool_->lib_switch(); |
| - EscapeStringToStream(out_, all_libs[i], lib_escape_opts); |
| + EscapeStringToStream(out_, value, lib_escape_opts); |
| } |
| } |
| out_ << std::endl; |