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> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "tools/gn/action_values.h" | 15 #include "tools/gn/action_values.h" |
16 #include "tools/gn/config_values.h" | 16 #include "tools/gn/config_values.h" |
17 #include "tools/gn/inherited_libraries.h" | 17 #include "tools/gn/inherited_libraries.h" |
18 #include "tools/gn/item.h" | 18 #include "tools/gn/item.h" |
| 19 #include "tools/gn/label_pattern.h" |
19 #include "tools/gn/label_ptr.h" | 20 #include "tools/gn/label_ptr.h" |
20 #include "tools/gn/lib_file.h" | 21 #include "tools/gn/lib_file.h" |
21 #include "tools/gn/ordered_set.h" | 22 #include "tools/gn/ordered_set.h" |
22 #include "tools/gn/output_file.h" | 23 #include "tools/gn/output_file.h" |
23 #include "tools/gn/source_file.h" | 24 #include "tools/gn/source_file.h" |
24 #include "tools/gn/toolchain.h" | 25 #include "tools/gn/toolchain.h" |
25 #include "tools/gn/unique_vector.h" | 26 #include "tools/gn/unique_vector.h" |
26 | 27 |
27 class DepsIteratorRange; | 28 class DepsIteratorRange; |
28 class InputFile; | 29 class InputFile; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ActionValues& action_values() { return action_values_; } | 203 ActionValues& action_values() { return action_values_; } |
203 const ActionValues& action_values() const { return action_values_; } | 204 const ActionValues& action_values() const { return action_values_; } |
204 | 205 |
205 const OrderedSet<SourceDir>& all_lib_dirs() const { return all_lib_dirs_; } | 206 const OrderedSet<SourceDir>& all_lib_dirs() const { return all_lib_dirs_; } |
206 const OrderedSet<LibFile>& all_libs() const { return all_libs_; } | 207 const OrderedSet<LibFile>& all_libs() const { return all_libs_; } |
207 | 208 |
208 const std::set<const Target*>& recursive_hard_deps() const { | 209 const std::set<const Target*>& recursive_hard_deps() const { |
209 return recursive_hard_deps_; | 210 return recursive_hard_deps_; |
210 } | 211 } |
211 | 212 |
| 213 std::vector<LabelPattern>& assert_no_deps() { |
| 214 return assert_no_deps_; |
| 215 } |
| 216 const std::vector<LabelPattern>& assert_no_deps() const { |
| 217 return assert_no_deps_; |
| 218 } |
| 219 |
212 // The toolchain is only known once this target is resolved (all if its | 220 // The toolchain is only known once this target is resolved (all if its |
213 // dependencies are known). They will be null until then. Generally, this can | 221 // dependencies are known). They will be null until then. Generally, this can |
214 // only be used during target writing. | 222 // only be used during target writing. |
215 const Toolchain* toolchain() const { return toolchain_; } | 223 const Toolchain* toolchain() const { return toolchain_; } |
216 | 224 |
217 // Sets the toolchain. The toolchain must include a tool for this target | 225 // Sets the toolchain. The toolchain must include a tool for this target |
218 // or the error will be set and the function will return false. Unusually, | 226 // or the error will be set and the function will return false. Unusually, |
219 // this function's "err" output is optional since this is commonly used | 227 // this function's "err" output is optional since this is commonly used |
220 // frequently by unit tests which become needlessly verbose. | 228 // frequently by unit tests which become needlessly verbose. |
221 bool SetToolchain(const Toolchain* toolchain, Err* err = nullptr); | 229 bool SetToolchain(const Toolchain* toolchain, Err* err = nullptr); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 void FillOutputFiles(); | 285 void FillOutputFiles(); |
278 | 286 |
279 // Checks precompiled headers from configs and makes sure the resulting | 287 // Checks precompiled headers from configs and makes sure the resulting |
280 // values are in config_values_. | 288 // values are in config_values_. |
281 bool ResolvePrecompiledHeaders(Err* err); | 289 bool ResolvePrecompiledHeaders(Err* err); |
282 | 290 |
283 // Validates the given thing when a target is resolved. | 291 // Validates the given thing when a target is resolved. |
284 bool CheckVisibility(Err* err) const; | 292 bool CheckVisibility(Err* err) const; |
285 bool CheckTestonly(Err* err) const; | 293 bool CheckTestonly(Err* err) const; |
286 bool CheckNoNestedStaticLibs(Err* err) const; | 294 bool CheckNoNestedStaticLibs(Err* err) const; |
| 295 bool CheckAssertNoDeps(Err* err) const; |
287 void CheckSourcesGenerated() const; | 296 void CheckSourcesGenerated() const; |
288 void CheckSourceGenerated(const SourceFile& source) const; | 297 void CheckSourceGenerated(const SourceFile& source) const; |
289 | 298 |
290 OutputType output_type_; | 299 OutputType output_type_; |
291 std::string output_name_; | 300 std::string output_name_; |
292 std::string output_extension_; | 301 std::string output_extension_; |
293 | 302 |
294 FileList sources_; | 303 FileList sources_; |
295 bool all_headers_public_; | 304 bool all_headers_public_; |
296 FileList public_headers_; | 305 FileList public_headers_; |
(...skipping 20 matching lines...) Expand all Loading... |
317 | 326 |
318 // These libs and dirs are inherited from statically linked deps and all | 327 // These libs and dirs are inherited from statically linked deps and all |
319 // configs applying to this target. | 328 // configs applying to this target. |
320 OrderedSet<SourceDir> all_lib_dirs_; | 329 OrderedSet<SourceDir> all_lib_dirs_; |
321 OrderedSet<LibFile> all_libs_; | 330 OrderedSet<LibFile> all_libs_; |
322 | 331 |
323 // All hard deps from this target and all dependencies. Filled in when this | 332 // All hard deps from this target and all dependencies. Filled in when this |
324 // target is marked resolved. This will not include the current target. | 333 // target is marked resolved. This will not include the current target. |
325 std::set<const Target*> recursive_hard_deps_; | 334 std::set<const Target*> recursive_hard_deps_; |
326 | 335 |
| 336 std::vector<LabelPattern> assert_no_deps_; |
| 337 |
327 // Used for all binary targets. The precompiled header values in this struct | 338 // Used for all binary targets. The precompiled header values in this struct |
328 // will be resolved to the ones to use for this target, if precompiled | 339 // will be resolved to the ones to use for this target, if precompiled |
329 // headers are used. | 340 // headers are used. |
330 ConfigValues config_values_; | 341 ConfigValues config_values_; |
331 | 342 |
332 // Used for action[_foreach] targets. | 343 // Used for action[_foreach] targets. |
333 ActionValues action_values_; | 344 ActionValues action_values_; |
334 | 345 |
335 // Toolchain used by this target. Null until target is resolved. | 346 // Toolchain used by this target. Null until target is resolved. |
336 const Toolchain* toolchain_; | 347 const Toolchain* toolchain_; |
337 | 348 |
338 // Output files. Empty until the target is resolved. | 349 // Output files. Empty until the target is resolved. |
339 std::vector<OutputFile> computed_outputs_; | 350 std::vector<OutputFile> computed_outputs_; |
340 OutputFile link_output_file_; | 351 OutputFile link_output_file_; |
341 OutputFile dependency_output_file_; | 352 OutputFile dependency_output_file_; |
342 | 353 |
343 DISALLOW_COPY_AND_ASSIGN(Target); | 354 DISALLOW_COPY_AND_ASSIGN(Target); |
344 }; | 355 }; |
345 | 356 |
346 #endif // TOOLS_GN_TARGET_H_ | 357 #endif // TOOLS_GN_TARGET_H_ |
OLD | NEW |