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