| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 " \"args\" variable.\n" | 62 " \"args\" variable.\n" |
| 63 " \"//foo/bar/baz.txt\" => \"../../foo/bar/baz.txt\"\n" | 63 " \"//foo/bar/baz.txt\" => \"../../foo/bar/baz.txt\"\n" |
| 64 "\n" | 64 "\n" |
| 65 " {{source_file_part}}\n" | 65 " {{source_file_part}}\n" |
| 66 " The file part of the source including the extension.\n" | 66 " The file part of the source including the extension.\n" |
| 67 " \"//foo/bar/baz.txt\" => \"baz.txt\"\n" | 67 " \"//foo/bar/baz.txt\" => \"baz.txt\"\n" |
| 68 "\n" | 68 "\n" |
| 69 " {{source_name_part}}\n" | 69 " {{source_name_part}}\n" |
| 70 " The filename part of the source file with no directory or\n" | 70 " The filename part of the source file with no directory or\n" |
| 71 " extension. This will generally be used for specifying a\n" | 71 " extension. This will generally be used for specifying a\n" |
| 72 " transformation from a soruce file to a destination file with the\n" | 72 " transformation from a source file to a destination file with the\n" |
| 73 " same name but different extension.\n" | 73 " same name but different extension.\n" |
| 74 " \"//foo/bar/baz.txt\" => \"baz\"\n" | 74 " \"//foo/bar/baz.txt\" => \"baz\"\n" |
| 75 "\n" | 75 "\n" |
| 76 " {{source_dir}}\n" | 76 " {{source_dir}}\n" |
| 77 " The directory (*) containing the source file with no\n" | 77 " The directory (*) containing the source file with no\n" |
| 78 " trailing slash.\n" | 78 " trailing slash.\n" |
| 79 " \"//foo/bar/baz.txt\" => \"../../foo/bar\"\n" | 79 " \"//foo/bar/baz.txt\" => \"../../foo/bar\"\n" |
| 80 "\n" | 80 "\n" |
| 81 " {{source_root_relative_dir}}\n" | 81 " {{source_root_relative_dir}}\n" |
| 82 " The path to the source file's directory relative to the source\n" | 82 " The path to the source file's directory relative to the source\n" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 out << result; | 167 out << result; |
| 168 } | 168 } |
| 169 | 169 |
| 170 // static | 170 // static |
| 171 void SubstitutionWriter::GetListAsSourceFiles( | 171 void SubstitutionWriter::GetListAsSourceFiles( |
| 172 const SubstitutionList& list, | 172 const SubstitutionList& list, |
| 173 std::vector<SourceFile>* output) { | 173 std::vector<SourceFile>* output) { |
| 174 for (const auto& pattern : list.list()) { | 174 for (const auto& pattern : list.list()) { |
| 175 CHECK(pattern.ranges().size() == 1 && | 175 CHECK(pattern.ranges().size() == 1 && |
| 176 pattern.ranges()[0].type == SUBSTITUTION_LITERAL) | 176 pattern.ranges()[0].type == SUBSTITUTION_LITERAL) |
| 177 << "The substitution patterm \"" | 177 << "The substitution pattern \"" |
| 178 << pattern.AsString() | 178 << pattern.AsString() |
| 179 << "\" was expected to be a literal with no {{substitutions}}."; | 179 << "\" was expected to be a literal with no {{substitutions}}."; |
| 180 const std::string& literal = pattern.ranges()[0].literal; | 180 const std::string& literal = pattern.ranges()[0].literal; |
| 181 CHECK(literal.size() >= 1 && literal[0] == '/') | 181 CHECK(literal.size() >= 1 && literal[0] == '/') |
| 182 << "The result of the pattern \"" | 182 << "The result of the pattern \"" |
| 183 << pattern.AsString() | 183 << pattern.AsString() |
| 184 << "\" was not an absolute path."; | 184 << "\" was not an absolute path."; |
| 185 output->push_back(SourceFile(literal)); | 185 output->push_back(SourceFile(literal)); |
| 186 } | 186 } |
| 187 } | 187 } |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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().empty()) | 553 if (target->output_extension().empty()) |
| 554 return tool->default_output_extension(); | 554 return tool->default_output_extension(); |
| 555 return std::string(".") + target->output_extension(); | 555 return std::string(".") + target->output_extension(); |
| 556 | 556 |
| 557 default: | 557 default: |
| 558 NOTREACHED(); | 558 NOTREACHED(); |
| 559 return std::string(); | 559 return std::string(); |
| 560 } | 560 } |
| 561 } | 561 } |
| OLD | NEW |