OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/substitution_writer.h" | 5 #include "tools/gn/substitution_writer.h" |
6 | 6 |
7 #include "tools/gn/build_settings.h" | 7 #include "tools/gn/build_settings.h" |
8 #include "tools/gn/escape.h" | 8 #include "tools/gn/escape.h" |
9 #include "tools/gn/filesystem_utils.h" | 9 #include "tools/gn/filesystem_utils.h" |
10 #include "tools/gn/output_file.h" | 10 #include "tools/gn/output_file.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 const Tool* tool, | 540 const Tool* tool, |
541 SubstitutionType type) { | 541 SubstitutionType type) { |
542 // First try the common tool ones. | 542 // First try the common tool ones. |
543 std::string result; | 543 std::string result; |
544 if (GetTargetSubstitution(target, type, &result)) | 544 if (GetTargetSubstitution(target, type, &result)) |
545 return result; | 545 return result; |
546 | 546 |
547 // Fall-through to the linker-specific ones. | 547 // Fall-through to the linker-specific ones. |
548 switch (type) { | 548 switch (type) { |
549 case SUBSTITUTION_OUTPUT_EXTENSION: | 549 case SUBSTITUTION_OUTPUT_EXTENSION: |
550 // Use the extension provided on the target if nonempty, otherwise | 550 // Use the extension provided on the target if specified, otherwise |
551 // fall back on the default. Note that the target's output extension | 551 // fall back on the default. Note that the target's output extension |
552 // does not include the dot but the tool's does. | 552 // does not include the dot but the tool's does. |
| 553 if (!target->output_extension_set()) |
| 554 return tool->default_output_extension(); |
553 if (target->output_extension().empty()) | 555 if (target->output_extension().empty()) |
554 return tool->default_output_extension(); | 556 return std::string(); // Explicitly set to no extension. |
555 return std::string(".") + target->output_extension(); | 557 return std::string(".") + target->output_extension(); |
556 | 558 |
557 default: | 559 default: |
558 NOTREACHED(); | 560 NOTREACHED(); |
559 return std::string(); | 561 return std::string(); |
560 } | 562 } |
561 } | 563 } |
OLD | NEW |