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/build_settings.h" | 5 #include "tools/gn/build_settings.h" |
6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
7 #include "tools/gn/ninja_helper.h" | 7 #include "tools/gn/ninja_helper.h" |
8 #include "tools/gn/parse_tree.h" | 8 #include "tools/gn/parse_tree.h" |
9 #include "tools/gn/settings.h" | 9 #include "tools/gn/settings.h" |
10 #include "tools/gn/substitution_writer.h" | 10 #include "tools/gn/substitution_writer.h" |
11 #include "tools/gn/target.h" | 11 #include "tools/gn/target.h" |
12 #include "tools/gn/value.h" | 12 #include "tools/gn/value.h" |
13 | 13 |
14 namespace functions { | 14 namespace functions { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 void GetOutputsForTarget(const Settings* settings, | 18 void GetOutputsForTarget(const Settings* settings, |
19 const Target* target, | 19 const Target* target, |
20 std::vector<SourceFile>* ret) { | 20 std::vector<SourceFile>* ret) { |
21 switch (target->output_type()) { | 21 switch (target->output_type()) { |
22 case Target::ACTION: { | 22 case Target::ACTION: { |
23 // Actions just use the output list with no substitution. To keep things | 23 // Actions just use the output list with no substitution. |
24 // simple, pass an empty "source file" in to use the same code path for | |
25 // computing substitution outputs. | |
26 std::vector<SourceFile> sources; | 24 std::vector<SourceFile> sources; |
27 sources.push_back(SourceFile()); | 25 sources.push_back(SourceFile()); |
28 SubstitutionWriter::ApplyListToSources( | 26 SubstitutionWriter::GetListAsSourceFiles( |
29 settings, target->action_values().outputs(), sources, ret); | 27 settings, target->action_values().outputs(), ret); |
30 break; | 28 break; |
31 } | 29 } |
32 | 30 |
33 case Target::COPY_FILES: | 31 case Target::COPY_FILES: |
34 case Target::ACTION_FOREACH: | 32 case Target::ACTION_FOREACH: |
35 SubstitutionWriter::ApplyListToSources( | 33 SubstitutionWriter::ApplyListToSources( |
36 settings, target->action_values().outputs(), target->sources(), ret); | 34 settings, target->action_values().outputs(), target->sources(), ret); |
37 break; | 35 break; |
38 | 36 |
39 case Target::EXECUTABLE: | 37 case Target::EXECUTABLE: |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 167 |
170 Value ret(function, Value::LIST); | 168 Value ret(function, Value::LIST); |
171 ret.list_value().reserve(files.size()); | 169 ret.list_value().reserve(files.size()); |
172 for (size_t i = 0; i < files.size(); i++) | 170 for (size_t i = 0; i < files.size(); i++) |
173 ret.list_value().push_back(Value(function, files[i].value())); | 171 ret.list_value().push_back(Value(function, files[i].value())); |
174 | 172 |
175 return ret; | 173 return ret; |
176 } | 174 } |
177 | 175 |
178 } // namespace functions | 176 } // namespace functions |
OLD | NEW |