| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TOOL_H_ | 5 #ifndef TOOLS_GN_TOOL_H_ |
| 6 #define TOOLS_GN_TOOL_H_ | 6 #define TOOLS_GN_TOOL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "tools/gn/label.h" |
| 13 #include "tools/gn/label_ptr.h" |
| 12 #include "tools/gn/substitution_list.h" | 14 #include "tools/gn/substitution_list.h" |
| 13 #include "tools/gn/substitution_pattern.h" | 15 #include "tools/gn/substitution_pattern.h" |
| 14 | 16 |
| 17 class Pool; |
| 18 |
| 15 class Tool { | 19 class Tool { |
| 16 public: | 20 public: |
| 17 enum DepsFormat { | 21 enum DepsFormat { |
| 18 DEPS_GCC = 0, | 22 DEPS_GCC = 0, |
| 19 DEPS_MSVC = 1 | 23 DEPS_MSVC = 1 |
| 20 }; | 24 }; |
| 21 | 25 |
| 22 enum PrecompiledHeaderType { | 26 enum PrecompiledHeaderType { |
| 23 PCH_NONE = 0, | 27 PCH_NONE = 0, |
| 24 PCH_GCC = 1, | 28 PCH_GCC = 1, |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 170 } |
| 167 | 171 |
| 168 const SubstitutionPattern& rspfile_content() const { | 172 const SubstitutionPattern& rspfile_content() const { |
| 169 return rspfile_content_; | 173 return rspfile_content_; |
| 170 } | 174 } |
| 171 void set_rspfile_content(const SubstitutionPattern& content) { | 175 void set_rspfile_content(const SubstitutionPattern& content) { |
| 172 DCHECK(!complete_); | 176 DCHECK(!complete_); |
| 173 rspfile_content_ = content; | 177 rspfile_content_ = content; |
| 174 } | 178 } |
| 175 | 179 |
| 180 const LabelPtrPair<Pool>& pool() const { return pool_; } |
| 181 void set_pool(const LabelPtrPair<Pool>& pool) { pool_ = pool; } |
| 182 |
| 176 // Other functions ---------------------------------------------------------- | 183 // Other functions ---------------------------------------------------------- |
| 177 | 184 |
| 178 // Called when the toolchain is saving this tool, after everything is filled | 185 // Called when the toolchain is saving this tool, after everything is filled |
| 179 // in. | 186 // in. |
| 180 void SetComplete(); | 187 void SetComplete(); |
| 181 | 188 |
| 182 // Returns true if this tool has separate outputs for dependency tracking | 189 // Returns true if this tool has separate outputs for dependency tracking |
| 183 // and linking. | 190 // and linking. |
| 184 bool has_separate_solink_files() const { | 191 bool has_separate_solink_files() const { |
| 185 return !link_output_.empty() || !depend_output_.empty(); | 192 return !link_output_.empty() || !depend_output_.empty(); |
| 186 } | 193 } |
| 187 | 194 |
| 188 // Substitutions required by this tool. | 195 // Substitutions required by this tool. |
| 189 const SubstitutionBits& substitution_bits() const { | 196 const SubstitutionBits& substitution_bits() const { |
| 190 DCHECK(complete_); | 197 DCHECK(complete_); |
| 191 return substitution_bits_; | 198 return substitution_bits_; |
| 192 } | 199 } |
| 193 | 200 |
| 201 bool OnResolved(Err* err); |
| 202 |
| 194 private: | 203 private: |
| 195 SubstitutionPattern command_; | 204 SubstitutionPattern command_; |
| 196 std::string default_output_extension_; | 205 std::string default_output_extension_; |
| 197 SubstitutionPattern default_output_dir_; | 206 SubstitutionPattern default_output_dir_; |
| 198 SubstitutionPattern depfile_; | 207 SubstitutionPattern depfile_; |
| 199 DepsFormat depsformat_; | 208 DepsFormat depsformat_; |
| 200 PrecompiledHeaderType precompiled_header_type_; | 209 PrecompiledHeaderType precompiled_header_type_; |
| 201 SubstitutionPattern description_; | 210 SubstitutionPattern description_; |
| 202 std::string lib_switch_; | 211 std::string lib_switch_; |
| 203 std::string lib_dir_switch_; | 212 std::string lib_dir_switch_; |
| 204 SubstitutionList outputs_; | 213 SubstitutionList outputs_; |
| 205 SubstitutionPattern link_output_; | 214 SubstitutionPattern link_output_; |
| 206 SubstitutionPattern depend_output_; | 215 SubstitutionPattern depend_output_; |
| 207 SubstitutionPattern runtime_link_output_; | 216 SubstitutionPattern runtime_link_output_; |
| 208 std::string output_prefix_; | 217 std::string output_prefix_; |
| 209 bool restat_; | 218 bool restat_; |
| 210 SubstitutionPattern rspfile_; | 219 SubstitutionPattern rspfile_; |
| 211 SubstitutionPattern rspfile_content_; | 220 SubstitutionPattern rspfile_content_; |
| 221 LabelPtrPair<Pool> pool_; |
| 212 | 222 |
| 213 bool complete_; | 223 bool complete_; |
| 214 | 224 |
| 215 SubstitutionBits substitution_bits_; | 225 SubstitutionBits substitution_bits_; |
| 216 | 226 |
| 217 DISALLOW_COPY_AND_ASSIGN(Tool); | 227 DISALLOW_COPY_AND_ASSIGN(Tool); |
| 218 }; | 228 }; |
| 219 | 229 |
| 220 #endif // TOOLS_GN_TOOL_H_ | 230 #endif // TOOLS_GN_TOOL_H_ |
| OLD | NEW |