File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,14 @@ public struct ModulesGraph {
74
74
/// Returns all the targets in the graph, regardless if they are reachable from the root targets or not.
75
75
public let allTargets : IdentifiableSet < ResolvedTarget >
76
76
77
+ /// Returns all targets within the module graph in topological order, starting with low-level targets (that have no
78
+ /// dependencies).
79
+ package var allTargetsInTopologicalOrder : [ ResolvedTarget ] {
80
+ get throws {
81
+ try topologicalSort ( Array ( allTargets) ) { $0. dependencies. compactMap { $0. target } } . reversed ( )
82
+ }
83
+ }
84
+
77
85
/// Returns all the products in the graph, regardless if they are reachable from the root targets or not.
78
86
79
87
public let allProducts : IdentifiableSet < ResolvedProduct >
Original file line number Diff line number Diff line change @@ -121,4 +121,12 @@ public struct BuildDescription {
121
121
return nil
122
122
}
123
123
}
124
+
125
+ /// Returns all targets within the module graph in topological order, starting with low-level targets (that have no
126
+ /// dependencies).
127
+ public func allTargetsInTopologicalOrder( in modulesGraph: ModulesGraph ) throws -> [ BuildTarget ] {
128
+ try modulesGraph. allTargetsInTopologicalOrder. compactMap {
129
+ getBuildTarget ( for: $0, in: modulesGraph)
130
+ }
131
+ }
124
132
}
You can’t perform that action at this time.
0 commit comments