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