Skip to content

Commit

Permalink
Update name of edges to be more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
waltflanagan committed Nov 14, 2023
1 parent fd995c2 commit 2282fa8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Sources/TuistCore/Graph/GraphLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public final class GraphLoader: GraphLoading {
packages: cache.packages,
targets: cache.loadedTargets,
dependencies: cache.dependencies,
edges: cache.edges
dependencyPlatformFilters: cache.dependencyPlatformFilters
)
return graph
}
Expand Down Expand Up @@ -312,7 +312,7 @@ public final class GraphLoader: GraphLoading {
var loadedProjects: [AbsolutePath: Project] = [:]
var loadedTargets: [AbsolutePath: [String: Target]] = [:]
var dependencies: [GraphDependency: Set<GraphDependency>] = [:]
var edges: [GraphEdge: PlatformFilters] = [:]
var dependencyPlatformFilters: [GraphEdge: PlatformFilters] = [:]
var frameworks: [AbsolutePath: GraphDependency] = [:]
var libraries: [AbsolutePath: GraphDependency] = [:]
var xcframeworks: [AbsolutePath: GraphDependency] = [:]
Expand Down
4 changes: 2 additions & 2 deletions Sources/TuistCore/Graph/GraphTraverser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,12 @@ public class GraphTraverser: GraphTraversing {
if dependencies.contains(other) {
// If we reach the end and there's no filters,
// return empty to signify the dependency has no filters
return graph.edges[(root, other)] ?? []
return graph.dependencyPlatformFilters[(root, other)] ?? []
} else {
let filters = dependencies.map { node -> PlatformFilters? in

// If an intervening dependency has filters, we need to constrain downstream filters to a subset of those.
if let currentDependencyPlatformFilters = graph.edges[(root, node)] {
if let currentDependencyPlatformFilters = graph.dependencyPlatformFilters[(root, node)] {
guard let transitive = find(from: node, to: other) else {
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/TuistGraph/Graph/Graph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public struct Graph: Equatable, Codable {
public var dependencies: [GraphDependency: Set<GraphDependency>]

/// A dictionary that contains the platform filters to apply to a dependency relationship
public var edges: [GraphEdge: PlatformFilters]
public var dependencyPlatformFilters: [GraphEdge: PlatformFilters]

public init(
name: String,
Expand All @@ -59,7 +59,7 @@ public struct Graph: Equatable, Codable {
packages: [AbsolutePath: [String: Package]],
targets: [AbsolutePath: [String: Target]],
dependencies: [GraphDependency: Set<GraphDependency>],
edges: [GraphEdge: PlatformFilters]
dependencyPlatformFilters: [GraphEdge: PlatformFilters]
) {
self.name = name
self.path = path
Expand All @@ -68,6 +68,6 @@ public struct Graph: Equatable, Codable {
self.packages = packages
self.targets = targets
self.dependencies = dependencies
self.edges = edges
self.dependencyPlatformFilters = dependencyPlatformFilters
}
}
4 changes: 2 additions & 2 deletions Sources/TuistGraphTesting/Graph/Graph+TestData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension Graph {
packages: [AbsolutePath: [String: Package]] = [:],
targets: [AbsolutePath: [String: Target]] = [:],
dependencies: [GraphDependency: Set<GraphDependency>] = [:],
edges: [GraphEdge: PlatformFilters] = [:]
dependencyPlatformFilters: [GraphEdge: PlatformFilters] = [:]
) -> Graph {
Graph(
name: name,
Expand All @@ -21,7 +21,7 @@ extension Graph {
packages: packages,
targets: targets,
dependencies: dependencies,
edges: edges
dependencyPlatformFilters: dependencyPlatformFilters
)
}
}
2 changes: 1 addition & 1 deletion Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ final class ProjectEditorMapper: ProjectEditorMapping {
packages: [:],
targets: Dictionary(uniqueKeysWithValues: graphTargets),
dependencies: Dictionary(uniqueKeysWithValues: graphDependencies),
edges: [:] // What goes here?
dependencyPlatformFilters: [:] // What goes here?
)
}

Expand Down
14 changes: 7 additions & 7 deletions Tests/TuistCoreTests/Graph/GraphTraverserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3092,14 +3092,14 @@ final class GraphTraverserTests: TuistUnitTestCase {
sdkDependency,
],
]
var edges: [GraphEdge: PlatformFilters] = [:]
edges[(.target(name: target.name, path: project.path), sdkDependency)] = [.ios]
var dependencyPlatformFilters: [GraphEdge: PlatformFilters] = [:]
dependencyPlatformFilters[(.target(name: target.name, path: project.path), sdkDependency)] = [.ios]

let graph = Graph.test(
projects: [project.path: project],
targets: [project.path: [target.name: target]],
dependencies: dependencies,
edges: edges
dependencyPlatformFilters: dependencyPlatformFilters
)

let subject = GraphTraverser(graph: graph)
Expand Down Expand Up @@ -4216,7 +4216,7 @@ final class GraphTraverserTests: TuistUnitTestCase {
macFramework.name: macFramework,
]],
dependencies: dependencies,
edges: [
dependencyPlatformFilters: [
multiPlatformToMacEdge: [.macos],
]
)
Expand Down Expand Up @@ -4268,7 +4268,7 @@ final class GraphTraverserTests: TuistUnitTestCase {
sdkGraphDependency,
],
],
edges: [
dependencyPlatformFilters: [
GraphEdge(from: appkGraphDependency, to: staticFrameworkGraphDependency): [.ios],
]
)
Expand Down Expand Up @@ -4317,7 +4317,7 @@ final class GraphTraverserTests: TuistUnitTestCase {
sdkGraphDependency,
],
],
edges: [
dependencyPlatformFilters: [
GraphEdge(from: appkGraphDependency, to: staticFrameworkGraphDependency): [.macos],
GraphEdge(from: staticFrameworkGraphDependency, to: sdkGraphDependency): [.ios],
]
Expand Down Expand Up @@ -4363,7 +4363,7 @@ final class GraphTraverserTests: TuistUnitTestCase {
sdkGraphDependency,
],
],
edges: [
dependencyPlatformFilters: [
GraphEdge(from: staticFrameworkGraphDependency, to: sdkGraphDependency): [.ios],
]
)
Expand Down

0 comments on commit 2282fa8

Please sign in to comment.