Index: tools/gn/substitution_writer.cc |
diff --git a/tools/gn/substitution_writer.cc b/tools/gn/substitution_writer.cc |
index 0738b6f7e0a070fa23092ea6049fb65e26e85e36..2b6245d5051ded9643b22fab00610fcf622be955 100644 |
--- a/tools/gn/substitution_writer.cc |
+++ b/tools/gn/substitution_writer.cc |
@@ -125,6 +125,40 @@ SubstitutionWriter::~SubstitutionWriter() { |
} |
// static |
+void SubstitutionWriter::GetListAsSourceFiles( |
+ const Settings* settings, |
+ const SubstitutionList& list, |
+ std::vector<SourceFile>* output) { |
+ for (size_t i = 0; i < list.list().size(); i++) { |
+ const SubstitutionPattern& pattern = list.list()[i]; |
+ CHECK(pattern.ranges().size() == 1 && |
+ pattern.ranges()[0].type == SUBSTITUTION_LITERAL) |
+ << "The substitution patterm \"" |
+ << pattern.AsString() |
+ << "\" was expected to be a literal with no {{substitutions}}."; |
+ const std::string& literal = pattern.ranges()[0].literal; |
+ CHECK(literal.size() >= 1 && literal[0] == '/') |
+ << "The result of the pattern \"" |
+ << pattern.AsString() |
+ << "\" was not an absolute path."; |
+ output->push_back(SourceFile(literal)); |
+ } |
+} |
+ |
+void SubstitutionWriter::GetListAsOutputFiles( |
+ const Settings* settings, |
+ const SubstitutionList& list, |
+ std::vector<OutputFile>* output) { |
+ std::vector<SourceFile> output_as_sources; |
+ GetListAsSourceFiles(settings, list, &output_as_sources); |
+ for (size_t i = 0; i < output_as_sources.size(); i++) { |
+ output->push_back(OutputFile( |
+ RebaseSourceAbsolutePath(output_as_sources[i].value(), |
+ settings->build_settings()->build_dir()))); |
+ } |
+} |
+ |
+// static |
SourceFile SubstitutionWriter::ApplyPatternToSource( |
const Settings* settings, |
const SubstitutionPattern& pattern, |