Skip to content

Commit ea54083

Browse files
authored
Merge pull request #7 from tuist/remove-testing
Breaking - Delete XcodeGraphTesting
2 parents 7caca71 + 357e18e commit ea54083

File tree

62 files changed

+1109
-1289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1109
-1289
lines changed

Package.resolved

Lines changed: 2 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ var targets: [Target] = [
1010
"Path",
1111
]
1212
),
13-
.target(
14-
name: "XcodeGraphTesting",
15-
dependencies: [
16-
"XcodeGraph",
17-
"AnyCodable",
18-
],
19-
linkerSettings: [.linkedFramework("XCTest")]
20-
),
2113
]
2214

2315
let package = Package(
@@ -28,11 +20,6 @@ let package = Package(
2820
name: "XcodeGraph",
2921
targets: ["XcodeGraph"]
3022
),
31-
.library(
32-
name: "XcodeGraphTesting",
33-
targets: ["XcodeGraphTesting"]
34-
),
35-
3623
],
3724
dependencies: [
3825
.package(url: "https://github.com/Flight-School/AnyCodable", .upToNextMajor(from: "0.6.7")),

Project.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,6 @@ func schemes() -> [Scheme] {
4848
)
4949
)
5050
),
51-
.scheme(
52-
name: "TuistUnitTests",
53-
buildAction: .buildAction(
54-
targets: Module.allCases.flatMap(\.unitTestTargets).map(\.name).sorted()
55-
.map { .target($0) }
56-
),
57-
testAction: .targets(
58-
Module.allCases.flatMap(\.unitTestTargets).map { .testableTarget(target: .target($0.name)) }
59-
),
60-
runAction: .runAction(
61-
arguments: .arguments(
62-
environmentVariables: [
63-
"TUIST_CONFIG_SRCROOT": "$(SRCROOT)",
64-
"TUIST_FRAMEWORK_SEARCH_PATHS": "$(FRAMEWORK_SEARCH_PATHS)",
65-
]
66-
)
67-
)
68-
),
6951
]
7052
schemes.append(contentsOf: Module.allCases.filter(\.isRunnable).map {
7153
.scheme(

Sources/XcodeGraph/DependenciesGraph/DependenciesGraph.swift

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,178 @@ public struct DependenciesGraph: Equatable, Codable {
1919
/// An empty `DependenciesGraph`.
2020
public static let none: DependenciesGraph = .init(externalDependencies: [:], externalProjects: [:])
2121
}
22+
23+
#if DEBUG
24+
extension DependenciesGraph {
25+
public static func test(
26+
externalDependencies: [String: [TargetDependency]] = [:],
27+
externalProjects: [AbsolutePath: Project] = [:]
28+
) -> Self {
29+
.init(externalDependencies: externalDependencies, externalProjects: externalProjects)
30+
}
31+
32+
public static func testXCFramework(
33+
name: String = "Test",
34+
// swiftlint:disable:next force_try
35+
path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "Test.xcframework")),
36+
status: FrameworkStatus = .required
37+
) -> DependenciesGraph {
38+
let externalDependencies = [name: [TargetDependency.xcframework(path: path, status: status)]]
39+
40+
return .init(
41+
externalDependencies: externalDependencies,
42+
externalProjects: [:]
43+
)
44+
}
45+
46+
public static func test(
47+
packageFolder: AbsolutePath
48+
) -> Self {
49+
let externalDependencies = [
50+
"Tuist": [
51+
TargetDependency.project(
52+
target: "Tuist",
53+
path: packageFolder
54+
),
55+
],
56+
]
57+
58+
return .init(
59+
externalDependencies: externalDependencies,
60+
externalProjects: [:]
61+
)
62+
}
63+
64+
public static func aDependency(
65+
packageFolder: AbsolutePath
66+
) -> Self {
67+
let externalDependencies = [
68+
"ALibrary": [
69+
TargetDependency.project(
70+
target: "ALibrary",
71+
path: packageFolder
72+
),
73+
],
74+
]
75+
76+
return .init(
77+
externalDependencies: externalDependencies,
78+
externalProjects: [:]
79+
)
80+
}
81+
82+
public static func anotherDependency(
83+
packageFolder: AbsolutePath
84+
) -> Self {
85+
let externalDependencies = [
86+
"AnotherLibrary": [
87+
TargetDependency.project(
88+
target: "AnotherLibrary",
89+
path: packageFolder
90+
),
91+
],
92+
]
93+
94+
return .init(
95+
externalDependencies: externalDependencies,
96+
externalProjects: [:]
97+
)
98+
}
99+
100+
public static func alamofire(
101+
packageFolder: AbsolutePath
102+
) -> Self {
103+
let externalDependencies = [
104+
"Alamofire": [
105+
TargetDependency.project(
106+
target: "Alamofire",
107+
path: packageFolder
108+
),
109+
],
110+
]
111+
112+
return .init(
113+
externalDependencies: externalDependencies,
114+
externalProjects: [:]
115+
)
116+
}
117+
118+
public static func googleAppMeasurement(
119+
packageFolder: AbsolutePath
120+
) -> Self {
121+
let externalDependencies = [
122+
"GoogleAppMeasurement": [
123+
TargetDependency.project(
124+
target: "GoogleAppMeasurementTarget",
125+
path: packageFolder
126+
),
127+
],
128+
"GoogleAppMeasurementWithoutAdIdSupport": [
129+
TargetDependency.project(
130+
target: "GoogleAppMeasurementWithoutAdIdSupportTarget",
131+
path: packageFolder
132+
),
133+
],
134+
]
135+
136+
return .init(
137+
externalDependencies: externalDependencies,
138+
externalProjects: [:]
139+
)
140+
}
141+
142+
public static func googleUtilities(
143+
packageFolder: AbsolutePath
144+
) -> Self {
145+
let externalDependencies = [
146+
"GULAppDelegateSwizzler": [
147+
TargetDependency.project(
148+
target: "GULAppDelegateSwizzler",
149+
path: packageFolder
150+
),
151+
],
152+
"GULMethodSwizzler": [
153+
TargetDependency.project(
154+
target: "GULMethodSwizzler",
155+
path: packageFolder
156+
),
157+
],
158+
"GULNSData": [
159+
TargetDependency.project(
160+
target: "GULNSData",
161+
path: packageFolder
162+
),
163+
],
164+
"GULNetwork": [
165+
TargetDependency.project(
166+
target: "GULNetwork",
167+
path: packageFolder
168+
),
169+
],
170+
]
171+
172+
return .init(
173+
externalDependencies: externalDependencies,
174+
externalProjects: [:]
175+
)
176+
}
177+
178+
public static func nanopb(
179+
packageFolder: AbsolutePath
180+
) -> Self {
181+
let externalDependencies = [
182+
"nanopb": [
183+
TargetDependency.project(
184+
target: "nanopb",
185+
path: packageFolder
186+
),
187+
],
188+
]
189+
190+
return .init(
191+
externalDependencies: externalDependencies,
192+
externalProjects: [:]
193+
)
194+
}
195+
}
196+
#endif

Sources/XcodeGraph/Graph/Graph.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,27 @@ extension [GraphEdge: PlatformCondition] {
6565
}
6666
}
6767
}
68+
69+
#if DEBUG
70+
extension Graph {
71+
public static func test(
72+
name: String = "graph",
73+
path: AbsolutePath = .root,
74+
workspace: Workspace = .test(),
75+
projects: [AbsolutePath: Project] = [:],
76+
packages: [AbsolutePath: [String: Package]] = [:],
77+
dependencies: [GraphDependency: Set<GraphDependency>] = [:],
78+
dependencyConditions: [GraphEdge: PlatformCondition] = [:]
79+
) -> Graph {
80+
Graph(
81+
name: name,
82+
path: path,
83+
workspace: workspace,
84+
projects: projects,
85+
packages: packages,
86+
dependencies: dependencies,
87+
dependencyConditions: dependencyConditions
88+
)
89+
}
90+
}
91+
#endif

0 commit comments

Comments
 (0)