Skip to content

Commit afdf81e

Browse files
committed
Delete XcodeGraphTesting
1 parent 634fd42 commit afdf81e

File tree

67 files changed

+1235
-1268
lines changed

Some content is hidden

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

67 files changed

+1235
-1268
lines changed

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

Sources/XcodeGraph/Graph/GraphDependency.swift

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,114 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda
282282
lhs.description < rhs.description
283283
}
284284
}
285+
286+
#if DEBUG
287+
// swiftlint:disable force_try
288+
289+
extension GraphDependency {
290+
public static func testFramework(
291+
path: AbsolutePath = AbsolutePath.root.appending(component: "Test.framework"),
292+
binaryPath: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "Test.framework/Test")),
293+
dsymPath: AbsolutePath? = nil,
294+
bcsymbolmapPaths: [AbsolutePath] = [],
295+
linking: BinaryLinking = .dynamic,
296+
architectures: [BinaryArchitecture] = [.armv7],
297+
status: FrameworkStatus = .required
298+
) -> GraphDependency {
299+
GraphDependency.framework(
300+
path: path,
301+
binaryPath: binaryPath,
302+
dsymPath: dsymPath,
303+
bcsymbolmapPaths: bcsymbolmapPaths,
304+
linking: linking,
305+
architectures: architectures,
306+
status: status
307+
)
308+
}
309+
310+
public static func testMacro(
311+
path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "macro"))
312+
) -> GraphDependency {
313+
.macro(path: path)
314+
}
315+
316+
public static func testXCFramework(
317+
path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "Test.xcframework")),
318+
infoPlist: XCFrameworkInfoPlist = .test(),
319+
primaryBinaryPath: AbsolutePath = AbsolutePath.root
320+
.appending(try! RelativePath(validating: "Test.xcframework/Test")),
321+
linking: BinaryLinking = .dynamic,
322+
status: FrameworkStatus = .required,
323+
macroPath: AbsolutePath? = nil
324+
) -> GraphDependency {
325+
.xcframework(
326+
GraphDependency.XCFramework(
327+
path: path,
328+
infoPlist: infoPlist,
329+
primaryBinaryPath: primaryBinaryPath,
330+
linking: linking,
331+
mergeable: false,
332+
status: status,
333+
macroPath: macroPath
334+
)
335+
)
336+
}
337+
338+
public static func testTarget(
339+
name: String = "Test",
340+
path: AbsolutePath = .root
341+
) -> GraphDependency {
342+
.target(
343+
name: name,
344+
path: path
345+
)
346+
}
347+
348+
public static func testSDK(
349+
name: String = "XCTest.framework",
350+
path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "XCTest.framework")),
351+
status: SDKStatus = .required,
352+
source: SDKSource = .system
353+
) -> GraphDependency {
354+
.sdk(
355+
name: name,
356+
path: path,
357+
status: status,
358+
source: source
359+
)
360+
}
361+
362+
public static func testLibrary(
363+
path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "libTuist.a")),
364+
publicHeaders: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "headers")),
365+
linking: BinaryLinking = .dynamic,
366+
architectures: [BinaryArchitecture] = [.armv7],
367+
swiftModuleMap: AbsolutePath? = nil
368+
) -> GraphDependency {
369+
.library(
370+
path: path,
371+
publicHeaders: publicHeaders,
372+
linking: linking,
373+
architectures: architectures,
374+
swiftModuleMap: swiftModuleMap
375+
)
376+
}
377+
378+
public static func testBundle(path: AbsolutePath = .root.appending(component: "test.bundle")) -> GraphDependency {
379+
.bundle(path: path)
380+
}
381+
382+
public static func testPackageProduct(
383+
path: AbsolutePath = .root,
384+
product: String = "Tuist"
385+
) -> GraphDependency {
386+
.packageProduct(
387+
path: path,
388+
product: product,
389+
type: .runtime
390+
)
391+
}
392+
}
393+
394+
// swiftlint:enable force_try
395+
#endif

Sources/XcodeGraph/Graph/GraphTarget.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,19 @@ public struct GraphTarget: Equatable, Hashable, Comparable, CustomDebugStringCon
3131
"Target '\(target.name)' at path '\(project.path)'"
3232
}
3333
}
34+
35+
#if DEBUG
36+
extension GraphTarget {
37+
public static func test(
38+
path: AbsolutePath = .root,
39+
target: Target = .test(),
40+
project: Project = .test()
41+
) -> GraphTarget {
42+
GraphTarget(
43+
path: path,
44+
target: target,
45+
project: project
46+
)
47+
}
48+
}
49+
#endif

Sources/XcodeGraph/Models/AnalyzeAction.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ public struct AnalyzeAction: Equatable, Codable {
1111
self.configurationName = configurationName
1212
}
1313
}
14+
15+
#if DEBUG
16+
extension AnalyzeAction {
17+
public static func test(configurationName: String = "Beta Release") -> AnalyzeAction {
18+
AnalyzeAction(configurationName: configurationName)
19+
}
20+
}
21+
#endif

Sources/XcodeGraph/Models/ArchiveAction.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,23 @@ public struct ArchiveAction: Equatable, Codable {
2626
self.postActions = postActions
2727
}
2828
}
29+
30+
#if DEBUG
31+
extension ArchiveAction {
32+
public static func test(
33+
configurationName: String = "Beta Release",
34+
revealArchiveInOrganizer: Bool = true,
35+
customArchiveName: String? = nil,
36+
preActions: [ExecutionAction] = [],
37+
postActions: [ExecutionAction] = []
38+
) -> ArchiveAction {
39+
ArchiveAction(
40+
configurationName: configurationName,
41+
revealArchiveInOrganizer: revealArchiveInOrganizer,
42+
customArchiveName: customArchiveName,
43+
preActions: preActions,
44+
postActions: postActions
45+
)
46+
}
47+
}
48+
#endif

Sources/XcodeGraph/Models/Arguments.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,17 @@ extension Arguments: Equatable {
2828
== rhs.launchArguments.sorted { $0.name == $1.name }
2929
}
3030
}
31+
32+
#if DEBUG
33+
extension Arguments {
34+
public static func test(
35+
environmentVariables: [String: EnvironmentVariable] = [:],
36+
launchArguments: [LaunchArgument] = []
37+
) -> Arguments {
38+
Arguments(
39+
environmentVariables: environmentVariables,
40+
launchArguments: launchArguments
41+
)
42+
}
43+
}
44+
#endif

0 commit comments

Comments
 (0)