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_SCRIPT_VALUES_H_
6#define TOOLS_GN_SCRIPT_VALUES_H_
7
8#include <string>
9#include <vector>
10
11#include "base/basictypes.h"
12#include "tools/gn/source_file.h"
13
14// Holds the values (outputs, args, script name, etc.) for a script-based
15// target.
16class ScriptValues {
17 public:
18  ScriptValues();
19  ~ScriptValues();
20
21  // Filename of the script to execute.
22  const SourceFile& script() const { return script_; }
23  void set_script(const SourceFile& s) { script_ = s; }
24
25  // Arguments to the script.
26  std::vector<std::string>& args() { 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
30  // Files created by the script.
31  std::vector<SourceFile>& outputs() { return outputs_; }
32  const std::vector<SourceFile>& outputs() const { return outputs_; }
33  void swap_in_outputs(std::vector<SourceFile>* op) { outputs_.swap(*op); }
34
35  // Depfile generated by the script.
36  const SourceFile& depfile() const { return depfile_; }
37  bool has_depfile() const { return !depfile_.is_null(); }
38  void set_depfile(const SourceFile& depfile) { depfile_ = depfile; }
39
40 private:
41  SourceFile script_;
42  std::vector<std::string> args_;
43  std::vector<SourceFile> outputs_;
44  SourceFile depfile_;
45
46  DISALLOW_COPY_AND_ASSIGN(ScriptValues);
47};
48
49#endif  // TOOLS_GN_SCRIPT_VALUES_H_
50