Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: tools/gn/function_process_file_template.cc

Issue 2387763002: Support for source_target_relative expansion in GN (Closed)
Patch Set: Rebased Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/ninja_action_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/functions.h" 5 #include "tools/gn/functions.h"
6 #include "tools/gn/parse_tree.h" 6 #include "tools/gn/parse_tree.h"
7 #include "tools/gn/scope.h" 7 #include "tools/gn/scope.h"
8 #include "tools/gn/settings.h" 8 #include "tools/gn/settings.h"
9 #include "tools/gn/substitution_list.h" 9 #include "tools/gn/substitution_list.h"
10 #include "tools/gn/substitution_writer.h" 10 #include "tools/gn/substitution_writer.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (!subst.Parse(list, template_arg.origin(), err)) 86 if (!subst.Parse(list, template_arg.origin(), err))
87 return Value(); 87 return Value();
88 } else if (template_arg.type() == Value::LIST) { 88 } else if (template_arg.type() == Value::LIST) {
89 if (!subst.Parse(template_arg, err)) 89 if (!subst.Parse(template_arg, err))
90 return Value(); 90 return Value();
91 } else { 91 } else {
92 *err = Err(template_arg, "Not a string or a list."); 92 *err = Err(template_arg, "Not a string or a list.");
93 return Value(); 93 return Value();
94 } 94 }
95 95
96 auto& types = subst.required_types();
97 if (std::find(types.begin(), types.end(),
98 SUBSTITUTION_SOURCE_TARGET_RELATIVE) != types.end()) {
99 *err = Err(template_arg, "Not a valid substitution type for the function.");
100 return Value();
101 }
102
96 SubstitutionWriter::ApplyListToSourcesAsString( 103 SubstitutionWriter::ApplyListToSourcesAsString(
97 scope->settings(), subst, input_files, &result_files); 104 nullptr, scope->settings(), subst, input_files, &result_files);
98 105
99 // Convert the list of strings to the return Value. 106 // Convert the list of strings to the return Value.
100 Value ret(function, Value::LIST); 107 Value ret(function, Value::LIST);
101 ret.list_value().reserve(result_files.size()); 108 ret.list_value().reserve(result_files.size());
102 for (const auto& file : result_files) 109 for (const auto& file : result_files)
103 ret.list_value().push_back(Value(function, file)); 110 ret.list_value().push_back(Value(function, file));
104 111
105 return ret; 112 return ret;
106 } 113 }
107 114
108 } // namespace functions 115 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/ninja_action_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698