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_TARGET_H_ | 5 #ifndef TOOLS_GN_TARGET_H_ |
6 #define TOOLS_GN_TARGET_H_ | 6 #define TOOLS_GN_TARGET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 Target(const Settings* settings, const Label& label); | 47 Target(const Settings* settings, const Label& label); |
48 virtual ~Target(); | 48 virtual ~Target(); |
49 | 49 |
50 // Returns a string naming the output type. | 50 // Returns a string naming the output type. |
51 static const char* GetStringForOutputType(OutputType type); | 51 static const char* GetStringForOutputType(OutputType type); |
52 | 52 |
53 // Item overrides. | 53 // Item overrides. |
54 virtual Target* AsTarget() OVERRIDE; | 54 virtual Target* AsTarget() OVERRIDE; |
55 virtual const Target* AsTarget() const OVERRIDE; | 55 virtual const Target* AsTarget() const OVERRIDE; |
56 virtual void OnResolved() OVERRIDE; | 56 virtual bool OnResolved(Err* err) OVERRIDE; |
57 | 57 |
58 OutputType output_type() const { return output_type_; } | 58 OutputType output_type() const { return output_type_; } |
59 void set_output_type(OutputType t) { output_type_ = t; } | 59 void set_output_type(OutputType t) { output_type_ = t; } |
60 | 60 |
61 bool IsLinkable() const; | 61 bool IsLinkable() const; |
62 | 62 |
63 // Will be the empty string to use the target label as the output name. | 63 // Will be the empty string to use the target label as the output name. |
64 // See GetComputedOutputName(). | 64 // See GetComputedOutputName(). |
65 const std::string& output_name() const { return output_name_; } | 65 const std::string& output_name() const { return output_name_; } |
66 void set_output_name(const std::string& name) { output_name_ = name; } | 66 void set_output_name(const std::string& name) { output_name_ = name; } |
(...skipping 17 matching lines...) Expand all Loading... |
84 // Set to true when all sources are public. This is the default. In this case | 84 // Set to true when all sources are public. This is the default. In this case |
85 // the public headers list should be empty. | 85 // the public headers list should be empty. |
86 bool all_headers_public() const { return all_headers_public_; } | 86 bool all_headers_public() const { return all_headers_public_; } |
87 void set_all_headers_public(bool p) { all_headers_public_ = p; } | 87 void set_all_headers_public(bool p) { all_headers_public_ = p; } |
88 | 88 |
89 // When all_headers_public is false, this is the list of public headers. It | 89 // When all_headers_public is false, this is the list of public headers. It |
90 // could be empty which would mean no headers are public. | 90 // could be empty which would mean no headers are public. |
91 const FileList& public_headers() const { return public_headers_; } | 91 const FileList& public_headers() const { return public_headers_; } |
92 FileList& public_headers() { return public_headers_; } | 92 FileList& public_headers() { return public_headers_; } |
93 | 93 |
| 94 bool testonly() const { return testonly_; } |
| 95 void set_testonly(bool value) { testonly_ = value; } |
| 96 |
94 // Compile-time extra dependencies. | 97 // Compile-time extra dependencies. |
95 const FileList& inputs() const { return inputs_; } | 98 const FileList& inputs() const { return inputs_; } |
96 FileList& inputs() { return inputs_; } | 99 FileList& inputs() { return inputs_; } |
97 | 100 |
98 // Runtime dependencies. | 101 // Runtime dependencies. |
99 const FileList& data() const { return data_; } | 102 const FileList& data() const { return data_; } |
100 FileList& data() { return data_; } | 103 FileList& data() { return data_; } |
101 | 104 |
102 // Returns true if targets depending on this one should have an order | 105 // Returns true if targets depending on this one should have an order |
103 // dependency. | 106 // dependency. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // that. This is a cache of the files to prevent every target that depends on | 194 // that. This is a cache of the files to prevent every target that depends on |
192 // a given library from recomputing the same pattern. | 195 // a given library from recomputing the same pattern. |
193 const OutputFile& link_output_file() const { | 196 const OutputFile& link_output_file() const { |
194 return link_output_file_; | 197 return link_output_file_; |
195 } | 198 } |
196 const OutputFile& dependency_output_file() const { | 199 const OutputFile& dependency_output_file() const { |
197 return dependency_output_file_; | 200 return dependency_output_file_; |
198 } | 201 } |
199 | 202 |
200 private: | 203 private: |
| 204 void ExpandGroups(); |
| 205 |
201 // Pulls necessary information from dependencies to this one when all | 206 // Pulls necessary information from dependencies to this one when all |
202 // dependencies have been resolved. | 207 // dependencies have been resolved. |
203 void PullDependentTargetInfo(); | 208 void PullDependentTargetInfo(); |
204 | 209 |
205 // These each pull specific things from dependencies to this one when all | 210 // These each pull specific things from dependencies to this one when all |
206 // deps have been resolved. | 211 // deps have been resolved. |
207 void PullForwardedDependentConfigs(); | 212 void PullForwardedDependentConfigs(); |
208 void PullRecursiveHardDeps(); | 213 void PullRecursiveHardDeps(); |
209 | 214 |
210 // Fills the link and dependency output files when a target is resolved. | 215 // Fills the link and dependency output files when a target is resolved. |
211 void FillOutputFiles(); | 216 void FillOutputFiles(); |
212 | 217 |
| 218 // Validates the given thing when a target is resolved. |
| 219 bool CheckVisibility(Err* err) const; |
| 220 bool CheckTestonly(Err* err) const; |
| 221 |
213 OutputType output_type_; | 222 OutputType output_type_; |
214 std::string output_name_; | 223 std::string output_name_; |
215 std::string output_extension_; | 224 std::string output_extension_; |
216 | 225 |
217 FileList sources_; | 226 FileList sources_; |
218 bool all_headers_public_; | 227 bool all_headers_public_; |
219 FileList public_headers_; | 228 FileList public_headers_; |
| 229 bool testonly_; |
220 FileList inputs_; | 230 FileList inputs_; |
221 FileList data_; | 231 FileList data_; |
222 | 232 |
223 bool hard_dep_; | 233 bool hard_dep_; |
224 | 234 |
225 // Note that if there are any groups in the deps, once the target is resolved | 235 // Note that if there are any groups in the deps, once the target is resolved |
226 // these vectors will list *both* the groups as well as the groups' deps. | 236 // these vectors will list *both* the groups as well as the groups' deps. |
227 // | 237 // |
228 // This is because, in general, groups should be "transparent" ways to add | 238 // This is because, in general, groups should be "transparent" ways to add |
229 // groups of dependencies, so adding the groups deps make this happen with | 239 // groups of dependencies, so adding the groups deps make this happen with |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 }; | 292 }; |
283 #elif defined(COMPILER_MSVC) | 293 #elif defined(COMPILER_MSVC) |
284 inline size_t hash_value(const Target* t) { | 294 inline size_t hash_value(const Target* t) { |
285 return reinterpret_cast<size_t>(t); | 295 return reinterpret_cast<size_t>(t); |
286 } | 296 } |
287 #endif // COMPILER... | 297 #endif // COMPILER... |
288 | 298 |
289 } // namespace BASE_HASH_NAMESPACE | 299 } // namespace BASE_HASH_NAMESPACE |
290 | 300 |
291 #endif // TOOLS_GN_TARGET_H_ | 301 #endif // TOOLS_GN_TARGET_H_ |
OLD | NEW |