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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 bool SubstitutionWriter::GetTargetSubstitution( | 415 bool SubstitutionWriter::GetTargetSubstitution( |
416 const Target* target, | 416 const Target* target, |
417 SubstitutionType type, | 417 SubstitutionType type, |
418 std::string* result) { | 418 std::string* result) { |
419 switch (type) { | 419 switch (type) { |
420 case SUBSTITUTION_LABEL: | 420 case SUBSTITUTION_LABEL: |
421 // Only include the toolchain for non-default toolchains. | 421 // Only include the toolchain for non-default toolchains. |
422 *result = target->label().GetUserVisibleName( | 422 *result = target->label().GetUserVisibleName( |
423 !target->settings()->is_default()); | 423 !target->settings()->is_default()); |
424 break; | 424 break; |
| 425 case SUBSTITUTION_LABEL_NAME: |
| 426 *result = target->label().name(); |
| 427 break; |
425 case SUBSTITUTION_ROOT_GEN_DIR: | 428 case SUBSTITUTION_ROOT_GEN_DIR: |
426 SetDirOrDotWithNoSlash( | 429 SetDirOrDotWithNoSlash( |
427 GetToolchainGenDirAsOutputFile(target->settings()).value(), | 430 GetToolchainGenDirAsOutputFile(target->settings()).value(), |
428 result); | 431 result); |
429 break; | 432 break; |
430 case SUBSTITUTION_ROOT_OUT_DIR: | 433 case SUBSTITUTION_ROOT_OUT_DIR: |
431 SetDirOrDotWithNoSlash( | 434 SetDirOrDotWithNoSlash( |
432 target->settings()->toolchain_output_subdir().value(), | 435 target->settings()->toolchain_output_subdir().value(), |
433 result); | 436 result); |
434 break; | 437 break; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 // does not include the dot but the tool's does. | 550 // does not include the dot but the tool's does. |
548 if (target->output_extension().empty()) | 551 if (target->output_extension().empty()) |
549 return tool->default_output_extension(); | 552 return tool->default_output_extension(); |
550 return std::string(".") + target->output_extension(); | 553 return std::string(".") + target->output_extension(); |
551 | 554 |
552 default: | 555 default: |
553 NOTREACHED(); | 556 NOTREACHED(); |
554 return std::string(); | 557 return std::string(); |
555 } | 558 } |
556 } | 559 } |
OLD | NEW |