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