OLD | NEW |
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 #ifndef TOOLS_GN_ACTION_VALUES_H_ | 5 #ifndef TOOLS_GN_ACTION_VALUES_H_ |
6 #define TOOLS_GN_ACTION_VALUES_H_ | 6 #define TOOLS_GN_ACTION_VALUES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "tools/gn/source_file.h" | 12 #include "tools/gn/source_file.h" |
| 13 #include "tools/gn/substitution_list.h" |
13 | 14 |
14 // Holds the values (outputs, args, script name, etc.) for either an action or | 15 // Holds the values (outputs, args, script name, etc.) for either an action or |
15 // an action_foreach target. | 16 // an action_foreach target. |
16 class ActionValues { | 17 class ActionValues { |
17 public: | 18 public: |
18 ActionValues(); | 19 ActionValues(); |
19 ~ActionValues(); | 20 ~ActionValues(); |
20 | 21 |
21 // Filename of the script to execute. | 22 // Filename of the script to execute. |
22 const SourceFile& script() const { return script_; } | 23 const SourceFile& script() const { return script_; } |
23 void set_script(const SourceFile& s) { script_ = s; } | 24 void set_script(const SourceFile& s) { script_ = s; } |
24 | 25 |
25 // Arguments to the script. | 26 // Arguments to the script. |
26 std::vector<std::string>& args() { return args_; } | 27 SubstitutionList& args() { return args_; } |
27 const std::vector<std::string>& args() const { return args_; } | 28 const SubstitutionList& args() const { return args_; } |
28 | 29 |
29 // Files created by the script. These are strings rather than SourceFiles | 30 // Files created by the script. These are strings rather than SourceFiles |
30 // since they will often contain {{source expansions}}. | 31 // since they will often contain {{source expansions}}. |
31 std::vector<std::string>& outputs() { return outputs_; } | 32 SubstitutionList& outputs() { return outputs_; } |
32 const std::vector<std::string>& outputs() const { return outputs_; } | 33 const SubstitutionList& outputs() const { return outputs_; } |
33 | 34 |
34 // Depfile generated by the script. | 35 // Depfile generated by the script. |
35 const SourceFile& depfile() const { return depfile_; } | 36 const SubstitutionPattern& depfile() const { return depfile_; } |
36 bool has_depfile() const { return !depfile_.is_null(); } | 37 bool has_depfile() const { return !depfile_.ranges().empty(); } |
37 void set_depfile(const SourceFile& depfile) { depfile_ = depfile; } | 38 void set_depfile(const SubstitutionPattern& depfile) { depfile_ = depfile; } |
38 | 39 |
39 private: | 40 private: |
40 SourceFile script_; | 41 SourceFile script_; |
41 std::vector<std::string> args_; | 42 SubstitutionList args_; |
42 std::vector<std::string> outputs_; | 43 SubstitutionList outputs_; |
43 SourceFile depfile_; | 44 SubstitutionPattern depfile_; |
44 | 45 |
45 DISALLOW_COPY_AND_ASSIGN(ActionValues); | 46 DISALLOW_COPY_AND_ASSIGN(ActionValues); |
46 }; | 47 }; |
47 | 48 |
48 #endif // TOOLS_GN_ACTION_VALUES_H_ | 49 #endif // TOOLS_GN_ACTION_VALUES_H_ |
OLD | NEW |