OLD | NEW |
| (Empty) |
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_TARGET_MANAGER_H_ | |
6 #define TOOLS_GN_TARGET_MANAGER_H_ | |
7 | |
8 #include <set> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/containers/hash_tables.h" | |
13 #include "base/synchronization/lock.h" | |
14 #include "tools/gn/target.h" | |
15 | |
16 class BuildSettings; | |
17 class Err; | |
18 class ItemTree; | |
19 class LocationRange; | |
20 class ToolchainManager; | |
21 class Value; | |
22 | |
23 // Manages all the targets in the system. This integrates with the ItemTree | |
24 // to manage the target-specific rules and creation. | |
25 // | |
26 // This class is threadsafe. | |
27 class TargetManager { | |
28 public: | |
29 explicit TargetManager(const BuildSettings* settings); | |
30 ~TargetManager(); | |
31 | |
32 // Gets a reference to a named target. The given target name is created if | |
33 // it doesn't exist. | |
34 // | |
35 // The label should be fully specified in that it should include an | |
36 // explicit toolchain. | |
37 // | |
38 // |specified_from_here| should indicate the dependency or the target | |
39 // generator causing this access for error message generation. | |
40 // | |
41 // |dep_from| should be set when a target is getting a dep that it depends | |
42 // on. |dep_from| indicates the target that specified the dependency. It | |
43 // will be used to track outstanding dependencies so we can know when the | |
44 // target and all of its dependencies are complete. It should be null when | |
45 // getting a target for other reasons. | |
46 // | |
47 // On failure, |err| will be set. | |
48 // | |
49 // The returned pointer must not be dereferenced until it's generated, since | |
50 // it could be being generated on another thread. | |
51 Target* GetTarget(const Label& label, | |
52 const LocationRange& specified_from_here, | |
53 Target* dep_from, | |
54 Err* err); | |
55 | |
56 // Called by a target when it has been loaded from the .gin file. Its | |
57 // dependencies may or may not be resolved yet. | |
58 bool TargetGenerationComplete(const Label& label, Err* err); | |
59 | |
60 // Returns a list of all targets. | |
61 void GetAllTargets(std::vector<const Target*>* all_targets) const; | |
62 | |
63 private: | |
64 const BuildSettings* build_settings_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(TargetManager); | |
67 }; | |
68 | |
69 #endif // TOOLS_GN_TARGET_MANAGER_H | |
OLD | NEW |