13551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 23551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 33551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// found in the LICENSE file. 43551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#ifndef TOOLS_GN_ACTION_VALUES_H_ 623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#define TOOLS_GN_ACTION_VALUES_H_ 73551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 83551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include <string> 93551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include <vector> 103551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 113551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "base/basictypes.h" 123551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "tools/gn/source_file.h" 135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "tools/gn/substitution_list.h" 143551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass Target; 161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)// Holds the values (outputs, args, script name, etc.) for either an action or 1823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)// an action_foreach target. 1923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)class ActionValues { 203551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) public: 2123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) ActionValues(); 2223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) ~ActionValues(); 233551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 243551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // Filename of the script to execute. 253551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) const SourceFile& script() const { return script_; } 263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) void set_script(const SourceFile& s) { script_ = s; } 273551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 283551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // Arguments to the script. 295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) SubstitutionList& args() { return args_; } 305f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) const SubstitutionList& args() const { return args_; } 313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 32116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Files created by the script. These are strings rather than SourceFiles 33116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // since they will often contain {{source expansions}}. 345f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) SubstitutionList& outputs() { return outputs_; } 355f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) const SubstitutionList& outputs() const { return outputs_; } 363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // Expands the outputs() above to the final SourceFile list. 381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci void GetOutputsAsSourceFiles(const Target* target, 391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci std::vector<SourceFile>* result) const; 401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Depfile generated by the script. 425f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) const SubstitutionPattern& depfile() const { return depfile_; } 435f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) bool has_depfile() const { return !depfile_.ranges().empty(); } 445f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) void set_depfile(const SubstitutionPattern& depfile) { depfile_ = depfile; } 45f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 463551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) private: 473551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) SourceFile script_; 485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) SubstitutionList args_; 495f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) SubstitutionList outputs_; 505f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) SubstitutionPattern depfile_; 513551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 5223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ActionValues); 533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}; 543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 5523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#endif // TOOLS_GN_ACTION_VALUES_H_ 56