diff --git a/Package.resolved b/Package.resolved index e8a5b425..21e51788 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "cdc9be76aaffeb8dbcd507c75817622558ba401dcfa67cebf405a4c32004fa46", + "originHash" : "e64a631d84155fa1dd47d1dbcfb085ffbdfbc60ee0792fee2a2320579e19f568", "pins" : [ { "identity" : "aexml", @@ -33,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tuist/FileSystem.git", "state" : { - "revision" : "d7f0e65da38b26272b39068d94978363ad64bf9a", - "version" : "0.14.8" + "revision" : "ed76b19034f6a04a266319ed5c460377e8e91fb8", + "version" : "0.14.25" } }, { @@ -42,8 +42,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/p-x9/MachOKit", "state" : { - "revision" : "97a600d7b72cf2538dc0cd77b792f5211c2de055", - "version" : "0.44.0" + "revision" : "a17885f09c038957a7ec70cb3099f4a423af4c40", + "version" : "0.46.1" } }, { @@ -51,8 +51,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Kolos65/Mockable.git", "state" : { - "revision" : "1e0d218b41aef515627a0fa7c98ca2b9d2833213", - "version" : "0.5.0" + "revision" : "e969f8469667382af3cbf6e457b2e771e70745f3", + "version" : "0.6.0" } }, { @@ -91,6 +91,15 @@ "version" : "1.2.0" } }, + { + "identity" : "swift-binary-parse-support", + "kind" : "remoteSourceControl", + "location" : "https://github.com/p-x9/swift-binary-parse-support.git", + "state" : { + "revision" : "5fb96b503672ea4752eded6b4e301fd87214b03b", + "version" : "0.2.1" + } + }, { "identity" : "swift-collections", "kind" : "remoteSourceControl", @@ -123,8 +132,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/p-x9/swift-fileio.git", "state" : { - "revision" : "63daf8e8402789339ccc5a19d198ff0fcafd29d9", - "version" : "0.11.0" + "revision" : "d589ff3966f9f064574780f527449a946736b989", + "version" : "0.13.0" + } + }, + { + "identity" : "swift-fileio-extra", + "kind" : "remoteSourceControl", + "location" : "https://github.com/p-x9/swift-fileio-extra.git", + "state" : { + "revision" : "8d83506dd4dff737807d90dbf2264096ed98c7a7", + "version" : "0.2.2" } }, { @@ -132,8 +150,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log", "state" : { - "revision" : "bc386b95f2a16ccd0150a8235e7c69eab2b866ca", - "version" : "1.8.0" + "revision" : "2778fd4e5a12a8aaa30a3ee8285f4ce54c5f3181", + "version" : "1.9.1" } }, { @@ -168,8 +186,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tuist/XcodeProj", "state" : { - "revision" : "1cf10b32c53e003994f27bb3d37e20dcb941179d", - "version" : "9.7.1" + "revision" : "31712ec42e9cbc46e7fd25ea55c2730cb3476097", + "version" : "9.7.2" } }, { diff --git a/Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift b/Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift index e1322612..413df2f2 100644 --- a/Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift +++ b/Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift @@ -7,7 +7,9 @@ public struct GraphTargetReference: Equatable, Comparable, Hashable, CustomDebug /// Path to the directory that contains the project where the target is defined. public let graphTarget: GraphTarget - public var target: Target { graphTarget.target } + public var target: Target { + graphTarget.target + } /// Platforms the target is conditionally deployed to. public let condition: PlatformCondition? diff --git a/Sources/XcodeGraph/Graph/GraphDependency.swift b/Sources/XcodeGraph/Graph/GraphDependency.swift index 40f35481..5b2195ed 100644 --- a/Sources/XcodeGraph/Graph/GraphDependency.swift +++ b/Sources/XcodeGraph/Graph/GraphDependency.swift @@ -56,6 +56,28 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda } } + public struct ForeignBuildOutput: Hashable, CustomStringConvertible, Comparable, Codable, Sendable { + public var name: String + public var path: AbsolutePath + public var linking: BinaryLinking + + public init(name: String, path: AbsolutePath, linking: BinaryLinking) { + self.name = name + self.path = path + self.linking = linking + } + + public var description: String { + "foreign build output '\(name)'" + } + + public static func < (lhs: ForeignBuildOutput, rhs: ForeignBuildOutput) -> Bool { + lhs.description < rhs.description + } + } + + case foreignBuildOutput(ForeignBuildOutput) + case xcframework(GraphDependency.XCFramework) /// A dependency that represents a pre-compiled framework. @@ -97,6 +119,9 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda switch self { case let .macro(path): hasher.combine(path) + case let .foreignBuildOutput(output): + hasher.combine("foreignBuildOutput") + hasher.combine(output) case let .xcframework(xcframework): hasher.combine(xcframework) case let .framework(path, _, _, _, _, _, _): @@ -129,6 +154,7 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda public var isTarget: Bool { switch self { case .macro: return false + case .foreignBuildOutput: return false case .xcframework: return false case .framework: return false case .library: return false @@ -145,6 +171,7 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda public var isStaticPrecompiled: Bool { switch self { case .macro: return false + case let .foreignBuildOutput(output): return output.linking == .static case let .xcframework(xcframework): return xcframework.linking == .static case let .framework(_, _, _, _, linking, _, _), @@ -162,6 +189,7 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda public var isDynamicPrecompiled: Bool { switch self { case .macro: return false + case let .foreignBuildOutput(output): return output.linking == .dynamic case let .xcframework(xcframework): return xcframework.linking == .dynamic case let .framework(_, _, _, _, linking, _, _), @@ -176,6 +204,7 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda public var isPrecompiled: Bool { switch self { case .macro: return true + case .foreignBuildOutput: return true case .xcframework: return true case .framework: return true case .library: return true @@ -189,6 +218,7 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda public var isLinkable: Bool { switch self { case .macro: return false + case .foreignBuildOutput: return true case .xcframework: return true case .framework: return true case .library: return true @@ -202,6 +232,7 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda public var isPrecompiledMacro: Bool { switch self { case .macro: return true + case .foreignBuildOutput: return false case .xcframework: return false case .framework: return false case .library: return false @@ -215,6 +246,7 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda public var isPrecompiledDynamicAndLinkable: Bool { switch self { case .macro: return false + case let .foreignBuildOutput(output): return output.linking == .dynamic case let .xcframework(xcframework): return xcframework.linking == .dynamic case let .framework(_, _, _, _, linking, _, _), @@ -245,6 +277,8 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda switch self { case .macro: return "macro '\(name)'" + case let .foreignBuildOutput(output): + return output.description case .xcframework: return "xcframework '\(name)'" case .framework: @@ -266,6 +300,8 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda switch self { case let .macro(path): return path.basename + case let .foreignBuildOutput(output): + return output.name case let .xcframework(xcframework): return xcframework.path.basename case let .framework(path, _, _, _, _, _, _): @@ -382,6 +418,18 @@ public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Coda ) } + public static func testForeignBuildOutput( + name: String = "SharedKMP", + path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "SharedKMP.xcframework")), + linking: BinaryLinking = .dynamic + ) -> GraphDependency { + .foreignBuildOutput(GraphDependency.ForeignBuildOutput( + name: name, + path: path, + linking: linking + )) + } + public static func testBundle(path: AbsolutePath = .root.appending(component: "test.bundle")) -> GraphDependency { .bundle(path: path) } diff --git a/Sources/XcodeGraph/Models/ForeignBuild.swift b/Sources/XcodeGraph/Models/ForeignBuild.swift new file mode 100644 index 00000000..13492fce --- /dev/null +++ b/Sources/XcodeGraph/Models/ForeignBuild.swift @@ -0,0 +1,43 @@ +import Path + +public struct ForeignBuild: Equatable, Hashable, Codable, Sendable { + public let script: String + public let inputs: [Input] + public let output: Artifact + + public init( + script: String, + inputs: [Input], + output: Artifact + ) { + self.script = script + self.inputs = inputs + self.output = output + } +} + +extension ForeignBuild { + public enum Input: Equatable, Hashable, Codable, Sendable { + case file(AbsolutePath) + case folder(AbsolutePath) + case script(String) + } +} + +extension ForeignBuild { + public enum Artifact: Equatable, Hashable, Codable, Sendable { + case xcframework(path: AbsolutePath, linking: BinaryLinking) + + public var path: AbsolutePath { + switch self { + case let .xcframework(path, _): return path + } + } + + public var linking: BinaryLinking { + switch self { + case let .xcframework(_, linking): return linking + } + } + } +} diff --git a/Sources/XcodeGraph/Models/Plist.swift b/Sources/XcodeGraph/Models/Plist.swift index 3af5c63a..e6e626fe 100644 --- a/Sources/XcodeGraph/Models/Plist.swift +++ b/Sources/XcodeGraph/Models/Plist.swift @@ -93,21 +93,21 @@ extension Dictionary where Value == Plist.Value { // MARK: - InfoPlist public enum InfoPlist: Equatable, Codable, Sendable { - // Path to a user defined info.plist file (already exists on disk). + /// Path to a user defined info.plist file (already exists on disk). case file(path: AbsolutePath, configuration: BuildConfiguration? = nil) - // Path to a generated info.plist file (may not exist on disk at the time of project generation). - // Data of the generated file + /// Path to a generated info.plist file (may not exist on disk at the time of project generation). + /// Data of the generated file case generatedFile(path: AbsolutePath, data: Data, configuration: BuildConfiguration? = nil) - // User defined dictionary of keys/values for an info.plist file. + /// User defined dictionary of keys/values for an info.plist file. case dictionary([String: Plist.Value], configuration: BuildConfiguration? = nil) - // A user defined xcconfig variable map to .entitlements file + /// A user defined xcconfig variable map to .entitlements file case variable(String, configuration: BuildConfiguration? = nil) - // User defined dictionary of keys/values for an info.plist file extending the default set of keys/values - // for the target type. + /// User defined dictionary of keys/values for an info.plist file extending the default set of keys/values + /// for the target type. case extendingDefault(with: [String: Plist.Value], configuration: BuildConfiguration? = nil) // MARK: - Public @@ -138,17 +138,17 @@ extension InfoPlist: ExpressibleByStringLiteral { // MARK: - Entitlements public enum Entitlements: Equatable, Codable, Sendable { - // Path to a user defined .entitlements file (already exists on disk). + /// Path to a user defined .entitlements file (already exists on disk). case file(path: AbsolutePath, configuration: BuildConfiguration? = nil) - // Path to a generated .entitlements file (may not exist on disk at the time of project generation). - // Data of the generated file + /// Path to a generated .entitlements file (may not exist on disk at the time of project generation). + /// Data of the generated file case generatedFile(path: AbsolutePath, data: Data, configuration: BuildConfiguration? = nil) - // User defined dictionary of keys/values for an .entitlements file. + /// User defined dictionary of keys/values for an .entitlements file. case dictionary([String: Plist.Value], configuration: BuildConfiguration? = nil) - // A user defined xcconfig variable map to .entitlements file + /// A user defined xcconfig variable map to .entitlements file case variable(String, configuration: BuildConfiguration? = nil) // MARK: - Public diff --git a/Sources/XcodeGraph/Models/Product.swift b/Sources/XcodeGraph/Models/Product.swift index d3876861..c6669fe6 100644 --- a/Sources/XcodeGraph/Models/Product.swift +++ b/Sources/XcodeGraph/Models/Product.swift @@ -11,7 +11,7 @@ public enum Product: String, CustomStringConvertible, CaseIterable, Codable, Sen case bundle case commandLineTool case appExtension = "app_extension" - // case watchApp = "watch_app" + /// case watchApp = "watch_app" case watch2App = "watch_2_app" // case watchExtension = "watch_extension" case watch2Extension = "watch_2_extension" diff --git a/Sources/XcodeGraph/Models/ResourceSynthesizer.swift b/Sources/XcodeGraph/Models/ResourceSynthesizer.swift index 23748225..09cb8de3 100644 --- a/Sources/XcodeGraph/Models/ResourceSynthesizer.swift +++ b/Sources/XcodeGraph/Models/ResourceSynthesizer.swift @@ -26,7 +26,10 @@ public struct ResourceSynthesizer: Equatable, Hashable, Codable, Sendable { case files public struct Option: Equatable, Hashable, Codable, Sendable { - public var value: Any { anyCodableValue.value } + public var value: Any { + anyCodableValue.value + } + private let anyCodableValue: AnyCodable public init(value: some Any) { diff --git a/Sources/XcodeGraph/Models/RunActionOptions.swift b/Sources/XcodeGraph/Models/RunActionOptions.swift index 941bdb18..b947bcd1 100644 --- a/Sources/XcodeGraph/Models/RunActionOptions.swift +++ b/Sources/XcodeGraph/Models/RunActionOptions.swift @@ -20,22 +20,22 @@ public struct RunActionOptions: Equatable, Codable, Sendable { /// Configure your project to work with the Metal frame debugger. public let enableGPUFrameCaptureMode: GPUFrameCaptureMode - /// Creates an `RunActionOptions` instance - /// - /// - Parameters: - /// - language: language (e.g. "pl"). - /// - /// - storeKitConfigurationPath: The absolute path of the - /// [StoreKit configuration - /// file](https://developer.apple.com/documentation/xcode/setting_up_storekit_testing_in_xcode#3625700). - /// The default value is `nil`, which results in no - /// configuration defined for the scheme - /// - /// - simulatedLocation: The simulated GPS location to use when running the app. - /// - /// - enableGPUFrameCaptureMode: The Metal Frame Capture mode to use. e.g: .disabled - /// If your target links to the Metal framework, Xcode enables GPU Frame Capture. - /// You can disable it to test your app in best performance. + // Creates an `RunActionOptions` instance + // + // - Parameters: + // - language: language (e.g. "pl"). + // + // - storeKitConfigurationPath: The absolute path of the + // [StoreKit configuration + // file](https://developer.apple.com/documentation/xcode/setting_up_storekit_testing_in_xcode#3625700). + // The default value is `nil`, which results in no + // configuration defined for the scheme + // + // - simulatedLocation: The simulated GPS location to use when running the app. + // + // - enableGPUFrameCaptureMode: The Metal Frame Capture mode to use. e.g: .disabled + // If your target links to the Metal framework, Xcode enables GPU Frame Capture. + // You can disable it to test your app in best performance. public init( language: String? = nil, diff --git a/Sources/XcodeGraph/Models/Target.swift b/Sources/XcodeGraph/Models/Target.swift index bdabad06..c8c6880e 100644 --- a/Sources/XcodeGraph/Models/Target.swift +++ b/Sources/XcodeGraph/Models/Target.swift @@ -5,8 +5,8 @@ import Path public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { // MARK: - Static - // Note: The `.docc` file type is technically both a valid source extension and folder extension - // in order to compile the documentation archive (including Tutorials, Articles, etc.) + /// Note: The `.docc` file type is technically both a valid source extension and folder extension + /// in order to compile the documentation archive (including Tutorials, Articles, etc.) public static let validSourceCompatibleFolderExtensions: [String] = [ "playground", "rcproject", "mlpackage", "docc", ] @@ -71,6 +71,7 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { public let type: TargetType public let packages: [AbsolutePath] public var buildableFolders: [BuildableFolder] + public var foreignBuild: ForeignBuild? // MARK: - Init @@ -105,7 +106,8 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { metadata: TargetMetadata = .metadata(tags: []), type: TargetType = .local, packages: [AbsolutePath] = [], - buildableFolders: [BuildableFolder] = [] + buildableFolders: [BuildableFolder] = [], + foreignBuild: ForeignBuild? = nil ) { self.name = name self.product = product @@ -138,6 +140,7 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { self.type = type self.packages = packages self.buildableFolders = buildableFolders + self.foreignBuild = foreignBuild } /// Given a target name, it obtains the product name by turning "-" characters into "_" and "/" into "_" @@ -148,6 +151,10 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { .replacingOccurrences(of: "/", with: "_") } + public var isAggregate: Bool { + foreignBuild != nil + } + /// Target can be included in the link phase of other targets public func isLinkable() -> Bool { [.dynamicLibrary, .staticLibrary, .framework, .staticFramework].contains(product) @@ -451,7 +458,8 @@ extension Sequence { mergedBinaryType: MergedBinaryType = .disabled, mergeable: Bool = false, metadata: TargetMetadata = .test(), - buildableFolders: [BuildableFolder] = [] + buildableFolders: [BuildableFolder] = [], + foreignBuild: ForeignBuild? = nil ) -> Target { Target( name: name, @@ -480,7 +488,8 @@ extension Sequence { mergedBinaryType: mergedBinaryType, mergeable: mergeable, metadata: metadata, - buildableFolders: buildableFolders + buildableFolders: buildableFolders, + foreignBuild: foreignBuild ) } @@ -513,7 +522,8 @@ extension Sequence { mergedBinaryType: MergedBinaryType = .disabled, mergeable: Bool = false, metadata: TargetMetadata = .test(), - buildableFolders: [BuildableFolder] = [] + buildableFolders: [BuildableFolder] = [], + foreignBuild: ForeignBuild? = nil ) -> Target { Target( name: name, @@ -542,7 +552,8 @@ extension Sequence { mergedBinaryType: mergedBinaryType, mergeable: mergeable, metadata: metadata, - buildableFolders: buildableFolders + buildableFolders: buildableFolders, + foreignBuild: foreignBuild ) } @@ -595,7 +606,7 @@ extension Sequence { ) } - // Maps a platform to a set of Destinations. For migration purposes + /// Maps a platform to a set of Destinations. For migration purposes private static func destinationsFrom(_ platform: Platform) -> Destinations { switch platform { case .iOS: diff --git a/Sources/XcodeGraph/PackageInfo.swift b/Sources/XcodeGraph/PackageInfo.swift index 2f187ea3..7e7b644c 100644 --- a/Sources/XcodeGraph/PackageInfo.swift +++ b/Sources/XcodeGraph/PackageInfo.swift @@ -614,7 +614,7 @@ extension PackageInfo.Target { case tool, name, condition, value, kind } - // Xcode 14 format + /// Xcode 14 format private enum Kind: Codable, Equatable { case swiftLanguageMode(String) case headerSearchPath(String) diff --git a/Sources/XcodeMetadata/Providers/PrecompiledMetadataProvider.swift b/Sources/XcodeMetadata/Providers/PrecompiledMetadataProvider.swift index c5418478..12fca735 100644 --- a/Sources/XcodeMetadata/Providers/PrecompiledMetadataProvider.swift +++ b/Sources/XcodeMetadata/Providers/PrecompiledMetadataProvider.swift @@ -45,7 +45,7 @@ public protocol PrecompiledMetadataProviding { /// Reads Mach-O metadata (arches, linking type, UUIDs) without calling deprecated swap_* APIs. public class PrecompiledMetadataProvider: PrecompiledMetadataProviding { - // A local struct for arch/linking/UUID data + /// A local struct for arch/linking/UUID data typealias Metadata = (BinaryArchitecture, BinaryLinking, UUID?) public func architectures(binaryPath: AbsolutePath) throws -> [BinaryArchitecture] { diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift index 52a8edc0..8d89ec72 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift @@ -45,7 +45,7 @@ struct XcodeGraphMapperTests { .add(to: pbxProj.rootObject) let projectPath = xcodeProj.projectPath - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let mapper = XcodeGraphMapper() // When let graph = try await mapper.buildGraph(from: .project(xcodeProj)) @@ -90,7 +90,7 @@ struct XcodeGraphMapperTests { .add(to: pbxProj) .add(to: pbxProj.rootObject) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let mapper = XcodeGraphMapper( projectMapper: projectMapper ) @@ -141,7 +141,7 @@ struct XcodeGraphMapperTests { .add(to: pbxProj) .add(to: pbxProj.rootObject) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let mapper = XcodeGraphMapper( projectMapper: projectMapper ) @@ -229,8 +229,8 @@ struct XcodeGraphMapperTests { path: .init(projectAPath.appending("/Workspace.xcworkspace")) ) - try projectA.write(path: projectA.path!) - try projectB.write(path: projectB.path!) + try projectA.write(path: try #require(projectA.path)) + try projectB.write(path: try #require(projectB.path)) let mapper = XcodeGraphMapper() // When @@ -308,8 +308,8 @@ struct XcodeGraphMapperTests { path: .init("/tmp/Workspace.xcworkspace") ) - try projectA.write(path: projectA.path!) - try projectB.write(path: projectB.path!) + try projectA.write(path: try #require(projectA.path)) + try projectB.write(path: try #require(projectB.path)) let mapper = XcodeGraphMapper() // When @@ -380,7 +380,7 @@ struct XcodeGraphMapperTests { ) .add(to: pbxProj) appTarget.dependencies.append(dep) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let mapper = XcodeGraphMapper() // When @@ -420,7 +420,7 @@ struct XcodeGraphMapperTests { .add(to: pbxProj) .add(to: pbxProj.rootObject) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let packageMapper = MockPackageMapping() let packageInfoLoader = MockPackageInfoLoading() let projectMapper = MockPBXProjectMapping() diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Package/PackageMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Package/PackageMapperTests.swift index d67ec431..cfa9488b 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Package/PackageMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Package/PackageMapperTests.swift @@ -2,7 +2,6 @@ import FileSystem import Foundation import Testing import XcodeGraph - @testable import XcodeGraphMapper struct PackageMapperTests: Sendable { diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Package/XCPackageMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Package/XCPackageMapperTests.swift index b5e5379e..93fa15f5 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Package/XCPackageMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Package/XCPackageMapperTests.swift @@ -13,7 +13,7 @@ struct XCPackageMapperTests { } @Test("Maps a remote package with a valid URL and up-to-next-major requirement") - func mapPackageWithValidURL() async throws { + func mapPackageWithValidURL() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -34,7 +34,7 @@ struct XCPackageMapperTests { } @Test("Maps an up-to-next-major version requirement correctly") - func mapRequirementUpToNextMajor() async throws { + func mapRequirementUpToNextMajor() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -48,7 +48,7 @@ struct XCPackageMapperTests { } @Test("Maps an up-to-next-minor version requirement correctly") - func mapRequirementUpToNextMinor() async throws { + func mapRequirementUpToNextMinor() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -63,7 +63,7 @@ struct XCPackageMapperTests { } @Test("Maps an exact version requirement correctly") - func mapRequirementExact() async throws { + func mapRequirementExact() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -78,7 +78,7 @@ struct XCPackageMapperTests { } @Test("Maps a range version requirement correctly") - func mapRequirementRange() async throws { + func mapRequirementRange() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -93,7 +93,7 @@ struct XCPackageMapperTests { } @Test("Maps a branch-based version requirement correctly") - func mapRequirementBranch() async throws { + func mapRequirementBranch() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -108,7 +108,7 @@ struct XCPackageMapperTests { } @Test("Maps a revision-based version requirement correctly") - func mapRequirementRevision() async throws { + func mapRequirementRevision() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -123,7 +123,7 @@ struct XCPackageMapperTests { } @Test("Maps a missing version requirement to up-to-next-major(0.0.0)") - func mapRequirementNoVersionRequirement() async throws { + func mapRequirementNoVersionRequirement() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "https://github.com/example/package.git", @@ -154,7 +154,7 @@ struct XCPackageMapperTests { } @Test("Throws an error if remote package has no repository URL") - func mapPackageWithoutURL() async throws { + func mapPackageWithoutURL() throws { // Given let package = XCRemoteSwiftPackageReference( repositoryURL: "", diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Phases/PBXFrameworksBuildPhaseMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Phases/PBXFrameworksBuildPhaseMapperTests.swift index ab158951..235af16d 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Phases/PBXFrameworksBuildPhaseMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Phases/PBXFrameworksBuildPhaseMapperTests.swift @@ -2,7 +2,6 @@ import Path import Testing import XcodeGraph import XcodeProj - @testable import XcodeGraphMapper @Suite diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Schemes/XCSchemeMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Schemes/XCSchemeMapperTests.swift index c2ff1308..e2dc0bf0 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Schemes/XCSchemeMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Schemes/XCSchemeMapperTests.swift @@ -3,7 +3,6 @@ import FileSystem import Path import Testing import XcodeGraph - @testable @preconcurrency import XcodeGraphMapper @testable @preconcurrency import XcodeProj diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Settings/ConfigurationMatcherTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Settings/ConfigurationMatcherTests.swift index d1c39fdc..13b94d96 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Settings/ConfigurationMatcherTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Settings/ConfigurationMatcherTests.swift @@ -11,7 +11,7 @@ struct ConfigurationMatcherTests { } @Test("Detects 'Debug' variants from configuration names") - func variantDetectionForDebug() async throws { + func variantDetectionForDebug() { // Given // The configurationMatcher is already set up by the initializer. @@ -27,7 +27,7 @@ struct ConfigurationMatcherTests { } @Test("Detects 'Release' variants from configuration names") - func variantDetectionForRelease() async throws { + func variantDetectionForRelease() { // Given // The configurationMatcher is already set up by the initializer. @@ -43,7 +43,7 @@ struct ConfigurationMatcherTests { } @Test("Falls back to 'Debug' variant for unrecognized configuration names") - func variantFallbackToDebug() async throws { + func variantFallbackToDebug() { // Given // The configurationMatcher is already set up by the initializer. @@ -57,7 +57,7 @@ struct ConfigurationMatcherTests { } @Test("Validates configuration names based on allowed patterns") - func testValidateConfigurationName() async throws { + func testValidateConfigurationName() { // Given // The configurationMatcher is already set up by the initializer. diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Settings/XCConfigurationMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Settings/XCConfigurationMapperTests.swift index ee1d3cff..3af80b78 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Settings/XCConfigurationMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Settings/XCConfigurationMapperTests.swift @@ -37,12 +37,11 @@ struct XCConfigurationMapperTests { // Then #expect(settings.configurations.count == 1) - let configKey = settings.configurations.keys.first - try #require(configKey != nil) - #expect(configKey?.name == "Debug") - #expect(configKey?.variant == .debug) + let configKey = try #require(settings.configurations.keys.first) + #expect(configKey.name == "Debug") + #expect(configKey.variant == .debug) - let debugConfig = try #require(settings.configurations[configKey!]) + let debugConfig = try #require(settings.configurations[configKey]) #expect(debugConfig?.settings["PRODUCT_BUNDLE_IDENTIFIER"] == "com.example.debug") } diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Target/PBXTargetMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Target/PBXTargetMapperTests.swift index 29bdec42..2db67458 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Target/PBXTargetMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Target/PBXTargetMapperTests.swift @@ -21,7 +21,7 @@ struct PBXTargetMapperTests: Sendable { buildSettings: ["PRODUCT_BUNDLE_IDENTIFIER": "com.example.app"] ) try xcodeProj.mainPBXProject().targets.append(target) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) // When let mapper = PBXTargetMapper() @@ -323,7 +323,7 @@ struct PBXTargetMapperTests: Sendable { let target = PBXNativeTarget.test() try xcodeProj.mainPBXProject().targets.append(target) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let mapper = PBXTargetMapper() @@ -370,7 +370,7 @@ struct PBXTargetMapperTests: Sendable { ] ) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let mapper = PBXTargetMapper() // When @@ -400,7 +400,7 @@ struct PBXTargetMapperTests: Sendable { name: "App" ) - try xcodeProj.write(path: xcodeProj.path!) + try xcodeProj.write(path: try #require(xcodeProj.path)) let mapper = PBXTargetMapper() // When @@ -444,7 +444,7 @@ struct PBXTargetMapperTests: Sendable { xcodeProj.pbxproj.add(object: releaseConfig) xcodeProj.pbxproj.add(object: configurationList) - let target = PBXNativeTarget.test( + return PBXNativeTarget.test( name: name, buildConfigurationList: configurationList, buildRules: [], @@ -452,7 +452,5 @@ struct PBXTargetMapperTests: Sendable { dependencies: dependencies, productType: productType ) - - return target } } diff --git a/Tests/XcodeGraphMapperTests/TestData/XCUserData+TestData.swift b/Tests/XcodeGraphMapperTests/TestData/XCUserData+TestData.swift index 863352c5..5270e8c2 100644 --- a/Tests/XcodeGraphMapperTests/TestData/XCUserData+TestData.swift +++ b/Tests/XcodeGraphMapperTests/TestData/XCUserData+TestData.swift @@ -1,6 +1,6 @@ import XcodeProj -// Tests? +/// Tests? extension XCUserData { static func test( userName: String = "user", diff --git a/Tests/XcodeGraphMapperTests/TestData/XCWorkspaceDataGroup+TestData.swift b/Tests/XcodeGraphMapperTests/TestData/XCWorkspaceDataGroup+TestData.swift index 8414f008..d4449993 100644 --- a/Tests/XcodeGraphMapperTests/TestData/XCWorkspaceDataGroup+TestData.swift +++ b/Tests/XcodeGraphMapperTests/TestData/XCWorkspaceDataGroup+TestData.swift @@ -1,7 +1,5 @@ import XcodeProj -import XcodeProj - extension XCWorkspaceDataElement { static func test(name: String, children: [XCWorkspaceDataElement]) -> XCWorkspaceDataElement { .group(XCWorkspaceDataGroup(location: .group(name), name: name, children: children)) diff --git a/Tests/XcodeGraphTests/DependenciesGraph/DependenciesGraphTests.swift b/Tests/XcodeGraphTests/DependenciesGraph/DependenciesGraphTests.swift index 4d1ab496..7371d853 100644 --- a/Tests/XcodeGraphTests/DependenciesGraph/DependenciesGraphTests.swift +++ b/Tests/XcodeGraphTests/DependenciesGraph/DependenciesGraphTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class DependenciesGraphTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Extensions/SettingsDictionary+ExtrasTests.swift b/Tests/XcodeGraphTests/Extensions/SettingsDictionary+ExtrasTests.swift index 32bae6a6..878d6293 100644 --- a/Tests/XcodeGraphTests/Extensions/SettingsDictionary+ExtrasTests.swift +++ b/Tests/XcodeGraphTests/Extensions/SettingsDictionary+ExtrasTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class SettingsDictionaryExtrasTest: XCTestCase { diff --git a/Tests/XcodeGraphTests/Graph/GraphDependencyTests.swift b/Tests/XcodeGraphTests/Graph/GraphDependencyTests.swift index 04b5b9d8..4d410569 100644 --- a/Tests/XcodeGraphTests/Graph/GraphDependencyTests.swift +++ b/Tests/XcodeGraphTests/Graph/GraphDependencyTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class GraphDependencyTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Graph/GraphTargetTests.swift b/Tests/XcodeGraphTests/Graph/GraphTargetTests.swift index 0f44dbe2..e5589421 100644 --- a/Tests/XcodeGraphTests/Graph/GraphTargetTests.swift +++ b/Tests/XcodeGraphTests/Graph/GraphTargetTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class GraphTargetTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Graph/GraphTests.swift b/Tests/XcodeGraphTests/Graph/GraphTests.swift index 7387a348..246c6d33 100644 --- a/Tests/XcodeGraphTests/Graph/GraphTests.swift +++ b/Tests/XcodeGraphTests/Graph/GraphTests.swift @@ -1,13 +1,12 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class GraphTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given - let subject = Graph.test(name: "name", path: try! AbsolutePath(validating: "/path/to")) + let subject = Graph.test(name: "name", path: try AbsolutePath(validating: "/path/to")) // Then XCTAssertCodable(subject) diff --git a/Tests/XcodeGraphTests/Models/AnalyzeActionTests.swift b/Tests/XcodeGraphTests/Models/AnalyzeActionTests.swift index 3cf435b7..64491196 100644 --- a/Tests/XcodeGraphTests/Models/AnalyzeActionTests.swift +++ b/Tests/XcodeGraphTests/Models/AnalyzeActionTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class AnalyzeActionTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/ArchiveActionTests.swift b/Tests/XcodeGraphTests/Models/ArchiveActionTests.swift index 6b9b2455..4c976a9e 100644 --- a/Tests/XcodeGraphTests/Models/ArchiveActionTests.swift +++ b/Tests/XcodeGraphTests/Models/ArchiveActionTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class ArchiveActionTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/ArgumentsTests.swift b/Tests/XcodeGraphTests/Models/ArgumentsTests.swift index b9d0d936..e69c88a9 100644 --- a/Tests/XcodeGraphTests/Models/ArgumentsTests.swift +++ b/Tests/XcodeGraphTests/Models/ArgumentsTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class ArgumentsTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/BuildActionTests.swift b/Tests/XcodeGraphTests/Models/BuildActionTests.swift index c4ace6a6..e72d6bd2 100644 --- a/Tests/XcodeGraphTests/Models/BuildActionTests.swift +++ b/Tests/XcodeGraphTests/Models/BuildActionTests.swift @@ -1,16 +1,15 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class BuildActionTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = BuildAction( targets: [ .init( - projectPath: try! AbsolutePath(validating: "/path/to/project"), + projectPath: try AbsolutePath(validating: "/path/to/project"), name: "name" ), ], diff --git a/Tests/XcodeGraphTests/Models/BuildConfigurationTests.swift b/Tests/XcodeGraphTests/Models/BuildConfigurationTests.swift index 80263ce0..3a9dfc0f 100644 --- a/Tests/XcodeGraphTests/Models/BuildConfigurationTests.swift +++ b/Tests/XcodeGraphTests/Models/BuildConfigurationTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class BuildConfigurationTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/BuildRule.CompilerSpecTests.swift b/Tests/XcodeGraphTests/Models/BuildRule.CompilerSpecTests.swift index dd7e310c..cf926cd8 100644 --- a/Tests/XcodeGraphTests/Models/BuildRule.CompilerSpecTests.swift +++ b/Tests/XcodeGraphTests/Models/BuildRule.CompilerSpecTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class BuildRuleCompilerSpecTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/BuildRule.FileTypeTests.swift b/Tests/XcodeGraphTests/Models/BuildRule.FileTypeTests.swift index 94e89d1a..68f5ccaf 100644 --- a/Tests/XcodeGraphTests/Models/BuildRule.FileTypeTests.swift +++ b/Tests/XcodeGraphTests/Models/BuildRule.FileTypeTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class BuildRuleFileTypeTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/BuildRuleTests.swift b/Tests/XcodeGraphTests/Models/BuildRuleTests.swift index 382e6639..7c6687cc 100644 --- a/Tests/XcodeGraphTests/Models/BuildRuleTests.swift +++ b/Tests/XcodeGraphTests/Models/BuildRuleTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class BuildRuleTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/CompatibleXcodeVersionsTests.swift b/Tests/XcodeGraphTests/Models/CompatibleXcodeVersionsTests.swift index 2f858248..6276b4a3 100644 --- a/Tests/XcodeGraphTests/Models/CompatibleXcodeVersionsTests.swift +++ b/Tests/XcodeGraphTests/Models/CompatibleXcodeVersionsTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class CompatibleXcodeVersionsTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/CopyFileElementTests.swift b/Tests/XcodeGraphTests/Models/CopyFileElementTests.swift index 16b16746..dffcb9a4 100644 --- a/Tests/XcodeGraphTests/Models/CopyFileElementTests.swift +++ b/Tests/XcodeGraphTests/Models/CopyFileElementTests.swift @@ -1,22 +1,21 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class CopyFileElementTests: XCTestCase { - func test_codable_file() { + func test_codable_file() throws { // Given - let subject = CopyFileElement.file(path: try! AbsolutePath(validating: "/path/to/file"), condition: .when([.macos])) + let subject = CopyFileElement.file(path: try AbsolutePath(validating: "/path/to/file"), condition: .when([.macos])) // Then XCTAssertCodable(subject) } - func test_codable_folderReference() { + func test_codable_folderReference() throws { // Given let subject = CopyFileElement.folderReference( - path: try! AbsolutePath(validating: "/folder/reference"), + path: try AbsolutePath(validating: "/folder/reference"), condition: .when([.macos]) ) diff --git a/Tests/XcodeGraphTests/Models/CopyFilesActionTests.swift b/Tests/XcodeGraphTests/Models/CopyFilesActionTests.swift index 5be1de0c..da10f34e 100644 --- a/Tests/XcodeGraphTests/Models/CopyFilesActionTests.swift +++ b/Tests/XcodeGraphTests/Models/CopyFilesActionTests.swift @@ -1,18 +1,17 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class CopyFilesActionTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = CopyFilesAction( name: "name", destination: .frameworks, subpath: "subpath", files: [ - .file(path: try! AbsolutePath(validating: "/path/to/file")), + .file(path: try AbsolutePath(validating: "/path/to/file")), ] ) diff --git a/Tests/XcodeGraphTests/Models/CoreDataModelTests.swift b/Tests/XcodeGraphTests/Models/CoreDataModelTests.swift index 1a0413e9..6b634778 100644 --- a/Tests/XcodeGraphTests/Models/CoreDataModelTests.swift +++ b/Tests/XcodeGraphTests/Models/CoreDataModelTests.swift @@ -1,16 +1,15 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class CoreDataModelTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = CoreDataModel( - path: try! AbsolutePath(validating: "/path/to/model"), + path: try AbsolutePath(validating: "/path/to/model"), versions: [ - try! AbsolutePath(validating: "/path/to/version"), + try AbsolutePath(validating: "/path/to/version"), ], currentVersion: "1.1.1" ) diff --git a/Tests/XcodeGraphTests/Models/ExecutionActionTests.swift b/Tests/XcodeGraphTests/Models/ExecutionActionTests.swift index 26233755..c12f0490 100644 --- a/Tests/XcodeGraphTests/Models/ExecutionActionTests.swift +++ b/Tests/XcodeGraphTests/Models/ExecutionActionTests.swift @@ -1,17 +1,16 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class ExecutionActionTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = ExecutionAction( title: "title", scriptText: "text", target: .init( - projectPath: try! AbsolutePath(validating: "/path/to/project"), + projectPath: try AbsolutePath(validating: "/path/to/project"), name: "name" ), shellPath: nil, diff --git a/Tests/XcodeGraphTests/Models/FileElementTests.swift b/Tests/XcodeGraphTests/Models/FileElementTests.swift index 56645a81..3f90d401 100644 --- a/Tests/XcodeGraphTests/Models/FileElementTests.swift +++ b/Tests/XcodeGraphTests/Models/FileElementTests.swift @@ -1,21 +1,20 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class FileElementTests: XCTestCase { - func test_codable_file() { + func test_codable_file() throws { // Given - let subject = FileElement.file(path: try! AbsolutePath(validating: "/path/to/file")) + let subject = FileElement.file(path: try AbsolutePath(validating: "/path/to/file")) // Then XCTAssertCodable(subject) } - func test_codable_folderReference() { + func test_codable_folderReference() throws { // Given - let subject = FileElement.folderReference(path: try! AbsolutePath(validating: "/folder/reference")) + let subject = FileElement.folderReference(path: try AbsolutePath(validating: "/folder/reference")) // Then XCTAssertCodable(subject) diff --git a/Tests/XcodeGraphTests/Models/HeadersTests.swift b/Tests/XcodeGraphTests/Models/HeadersTests.swift index 02fcba37..875fa352 100644 --- a/Tests/XcodeGraphTests/Models/HeadersTests.swift +++ b/Tests/XcodeGraphTests/Models/HeadersTests.swift @@ -1,21 +1,20 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class HeadersTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = Headers( public: [ - try! AbsolutePath(validating: "/path/to/public/header"), + try AbsolutePath(validating: "/path/to/public/header"), ], private: [ - try! AbsolutePath(validating: "/path/to/private/header"), + try AbsolutePath(validating: "/path/to/private/header"), ], project: [ - try! AbsolutePath(validating: "/path/to/project/header"), + try AbsolutePath(validating: "/path/to/project/header"), ] ) diff --git a/Tests/XcodeGraphTests/Models/InfoPlistTests.swift b/Tests/XcodeGraphTests/Models/InfoPlistTests.swift index 7dbcd0d1..6926fe74 100644 --- a/Tests/XcodeGraphTests/Models/InfoPlistTests.swift +++ b/Tests/XcodeGraphTests/Models/InfoPlistTests.swift @@ -1,13 +1,12 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class InfoPlistTests: XCTestCase { - func test_codable_file() { + func test_codable_file() throws { // Given - let subject = InfoPlist.file(path: try! AbsolutePath(validating: "/path/to/file")) + let subject = InfoPlist.file(path: try AbsolutePath(validating: "/path/to/file")) // Then XCTAssertCodable(subject) @@ -25,9 +24,9 @@ final class InfoPlistTests: XCTestCase { XCTAssertCodable(subject) } - func test_path_when_file() { + func test_path_when_file() throws { // Given - let path = try! AbsolutePath(validating: "/path/Info.list") + let path = try AbsolutePath(validating: "/path/Info.list") let subject: InfoPlist = .file(path: path) // Then diff --git a/Tests/XcodeGraphTests/Models/PackageInfoTests.swift b/Tests/XcodeGraphTests/Models/PackageInfoTests.swift index feb412e1..64d58048 100644 --- a/Tests/XcodeGraphTests/Models/PackageInfoTests.swift +++ b/Tests/XcodeGraphTests/Models/PackageInfoTests.swift @@ -1,7 +1,5 @@ import Foundation import Testing -import XcodeGraph - @testable import XcodeGraph struct PackageInfoTests { diff --git a/Tests/XcodeGraphTests/Models/PackageTests.swift b/Tests/XcodeGraphTests/Models/PackageTests.swift index cf09e0f8..e72502dd 100644 --- a/Tests/XcodeGraphTests/Models/PackageTests.swift +++ b/Tests/XcodeGraphTests/Models/PackageTests.swift @@ -1,13 +1,12 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class PackageTests: XCTestCase { - func test_codable_local() { + func test_codable_local() throws { // Given - let subject = Package.local(path: try! AbsolutePath(validating: "/path/to/workspace")) + let subject = Package.local(path: try AbsolutePath(validating: "/path/to/workspace")) // Then XCTAssertCodable(subject) @@ -24,9 +23,9 @@ final class PackageTests: XCTestCase { XCTAssertCodable(subject) } - func test_is_remote_local() { + func test_is_remote_local() throws { // Given - let subject = Package.local(path: try! AbsolutePath(validating: "/path/to/package")) + let subject = Package.local(path: try AbsolutePath(validating: "/path/to/package")) // Then XCTAssertFalse(subject.isRemote) diff --git a/Tests/XcodeGraphTests/Models/PlatformFilterTests.swift b/Tests/XcodeGraphTests/Models/PlatformFilterTests.swift index 6875351f..4d2b28e1 100644 --- a/Tests/XcodeGraphTests/Models/PlatformFilterTests.swift +++ b/Tests/XcodeGraphTests/Models/PlatformFilterTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class PlatformFilterTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/ProfileActionTests.swift b/Tests/XcodeGraphTests/Models/ProfileActionTests.swift index 7f9ad126..8cc98350 100644 --- a/Tests/XcodeGraphTests/Models/ProfileActionTests.swift +++ b/Tests/XcodeGraphTests/Models/ProfileActionTests.swift @@ -1,16 +1,15 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class ProfileActionTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = ProfileAction( configurationName: "name", executable: .init( - projectPath: try! AbsolutePath(validating: "/path/to/project"), + projectPath: try AbsolutePath(validating: "/path/to/project"), name: "name" ), arguments: .init( diff --git a/Tests/XcodeGraphTests/Models/ProjectGroupTests.swift b/Tests/XcodeGraphTests/Models/ProjectGroupTests.swift index a2868465..5df8b941 100644 --- a/Tests/XcodeGraphTests/Models/ProjectGroupTests.swift +++ b/Tests/XcodeGraphTests/Models/ProjectGroupTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class ProjectGroupTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/RawScriptBuildPhaseTests.swift b/Tests/XcodeGraphTests/Models/RawScriptBuildPhaseTests.swift index e59d454b..4196911b 100644 --- a/Tests/XcodeGraphTests/Models/RawScriptBuildPhaseTests.swift +++ b/Tests/XcodeGraphTests/Models/RawScriptBuildPhaseTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class RawScriptBuildPhaseTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/RequirementTests.swift b/Tests/XcodeGraphTests/Models/RequirementTests.swift index 2a8ee764..b2fa339f 100644 --- a/Tests/XcodeGraphTests/Models/RequirementTests.swift +++ b/Tests/XcodeGraphTests/Models/RequirementTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class RequirementTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/ResourceFileElementTests.swift b/Tests/XcodeGraphTests/Models/ResourceFileElementTests.swift index 0853be8a..f40721dd 100644 --- a/Tests/XcodeGraphTests/Models/ResourceFileElementTests.swift +++ b/Tests/XcodeGraphTests/Models/ResourceFileElementTests.swift @@ -1,14 +1,13 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class ResourceFileElementTests: XCTestCase { - func test_codable_file() { + func test_codable_file() throws { // Given let subject = ResourceFileElement.file( - path: try! AbsolutePath(validating: "/path/to/element"), + path: try AbsolutePath(validating: "/path/to/element"), tags: [ "tag", ] @@ -18,10 +17,10 @@ final class ResourceFileElementTests: XCTestCase { XCTAssertCodable(subject) } - func test_codable_folderReference() { + func test_codable_folderReference() throws { // Given let subject = ResourceFileElement.folderReference( - path: try! AbsolutePath(validating: "/path/to/folder"), + path: try AbsolutePath(validating: "/path/to/folder"), tags: [ "tag", ] diff --git a/Tests/XcodeGraphTests/Models/ResourceSynthesizerTests.swift b/Tests/XcodeGraphTests/Models/ResourceSynthesizerTests.swift index 9b83a36b..b8afcff1 100644 --- a/Tests/XcodeGraphTests/Models/ResourceSynthesizerTests.swift +++ b/Tests/XcodeGraphTests/Models/ResourceSynthesizerTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class ResourceSynthesizerTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/RunActionTests.swift b/Tests/XcodeGraphTests/Models/RunActionTests.swift index 0b8b3d67..3ac0bd03 100644 --- a/Tests/XcodeGraphTests/Models/RunActionTests.swift +++ b/Tests/XcodeGraphTests/Models/RunActionTests.swift @@ -1,21 +1,20 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class RunActionTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = RunAction( configurationName: "name", attachDebugger: true, - customLLDBInitFile: try! AbsolutePath(validating: "/path/to/project"), + customLLDBInitFile: try AbsolutePath(validating: "/path/to/project"), executable: .init( - projectPath: try! AbsolutePath(validating: "/path/to/project"), + projectPath: try AbsolutePath(validating: "/path/to/project"), name: "name" ), - filePath: try! AbsolutePath(validating: "/path/to/file"), + filePath: try AbsolutePath(validating: "/path/to/file"), arguments: .init( environmentVariables: [ "key": EnvironmentVariable(value: "value", isEnabled: true), diff --git a/Tests/XcodeGraphTests/Models/SDKSourceTests.swift b/Tests/XcodeGraphTests/Models/SDKSourceTests.swift index 87b96943..485e9451 100644 --- a/Tests/XcodeGraphTests/Models/SDKSourceTests.swift +++ b/Tests/XcodeGraphTests/Models/SDKSourceTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class SDKSourceTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/SchemeTests.swift b/Tests/XcodeGraphTests/Models/SchemeTests.swift index fa0b518b..b155a491 100644 --- a/Tests/XcodeGraphTests/Models/SchemeTests.swift +++ b/Tests/XcodeGraphTests/Models/SchemeTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class SchemeTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/SettingsTests.swift b/Tests/XcodeGraphTests/Models/SettingsTests.swift index 1111301a..333d5ad9 100644 --- a/Tests/XcodeGraphTests/Models/SettingsTests.swift +++ b/Tests/XcodeGraphTests/Models/SettingsTests.swift @@ -12,16 +12,16 @@ final class SettingsTests: XCTestCase { XCTAssertCodable(subject) } - func testXcconfigs() { + func testXcconfigs() throws { // Given let configurations: [BuildConfiguration: Configuration?] = [ BuildConfiguration(name: "D", variant: .debug): Configuration( settings: [:], - xcconfig: try! AbsolutePath(validating: "/D") + xcconfig: try AbsolutePath(validating: "/D") ), .release("C"): nil, - .debug("A"): Configuration(settings: [:], xcconfig: try! AbsolutePath(validating: "/A")), - .release("B"): Configuration(settings: [:], xcconfig: try! AbsolutePath(validating: "/B")), + .debug("A"): Configuration(settings: [:], xcconfig: try AbsolutePath(validating: "/A")), + .release("B"): Configuration(settings: [:], xcconfig: try AbsolutePath(validating: "/B")), ] // When diff --git a/Tests/XcodeGraphTests/Models/SourceFileTests.swift b/Tests/XcodeGraphTests/Models/SourceFileTests.swift index c46b7dbf..62dcfc7b 100644 --- a/Tests/XcodeGraphTests/Models/SourceFileTests.swift +++ b/Tests/XcodeGraphTests/Models/SourceFileTests.swift @@ -1,14 +1,13 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class SourceFileTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = SourceFile( - path: try! AbsolutePath(validating: "/path/to/file"), + path: try AbsolutePath(validating: "/path/to/file"), compilerFlags: "flag", contentHash: "hash" ) diff --git a/Tests/XcodeGraphTests/Models/TargetDependencyTests.swift b/Tests/XcodeGraphTests/Models/TargetDependencyTests.swift index e3a070a7..6c9b9524 100644 --- a/Tests/XcodeGraphTests/Models/TargetDependencyTests.swift +++ b/Tests/XcodeGraphTests/Models/TargetDependencyTests.swift @@ -1,14 +1,13 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class TargetDependencyTests: XCTestCase { - func test_codable_framework() { + func test_codable_framework() throws { // Given let subject = TargetDependency.framework( - path: try! AbsolutePath(validating: "/path/to/framework"), + path: try AbsolutePath(validating: "/path/to/framework"), status: .required ) @@ -16,47 +15,47 @@ final class TargetDependencyTests: XCTestCase { XCTAssertCodable(subject) } - func test_codable_project() { + func test_codable_project() throws { // Given - let subject = TargetDependency.project(target: "target", path: try! AbsolutePath(validating: "/path/to/target")) + let subject = TargetDependency.project(target: "target", path: try AbsolutePath(validating: "/path/to/target")) // Then XCTAssertCodable(subject) } - func test_codable_library() { + func test_codable_library() throws { // Given let subject = TargetDependency.library( - path: try! AbsolutePath(validating: "/path/to/library"), - publicHeaders: try! AbsolutePath(validating: "/path/to/publicheaders"), - swiftModuleMap: try! AbsolutePath(validating: "/path/to/swiftModuleMap") + path: try AbsolutePath(validating: "/path/to/library"), + publicHeaders: try AbsolutePath(validating: "/path/to/publicheaders"), + swiftModuleMap: try AbsolutePath(validating: "/path/to/swiftModuleMap") ) // Then XCTAssertCodable(subject) } - func test_filtering() { + func test_filtering() throws { let expected: PlatformCondition? = .when([.macos]) let subjects: [TargetDependency] = [ - .framework(path: try! AbsolutePath(validating: "/"), status: .required, condition: expected), + .framework(path: try AbsolutePath(validating: "/"), status: .required, condition: expected), .library( - path: try! AbsolutePath(validating: "/"), - publicHeaders: try! AbsolutePath(validating: "/"), - swiftModuleMap: try! AbsolutePath(validating: "/"), + path: try AbsolutePath(validating: "/"), + publicHeaders: try AbsolutePath(validating: "/"), + swiftModuleMap: try AbsolutePath(validating: "/"), condition: expected ), .sdk(name: "", status: .required, condition: expected), .package(product: "", type: .plugin, condition: expected), .target(name: "", condition: expected), .xcframework( - path: try! AbsolutePath(validating: "/"), + path: try AbsolutePath(validating: "/"), expectedSignature: nil, status: .required, condition: expected ), - .project(target: "", path: try! AbsolutePath(validating: "/"), condition: expected), + .project(target: "", path: try AbsolutePath(validating: "/"), condition: expected), ] for subject in subjects { diff --git a/Tests/XcodeGraphTests/Models/TargetReferenceTests.swift b/Tests/XcodeGraphTests/Models/TargetReferenceTests.swift index 04310200..dcb897ac 100644 --- a/Tests/XcodeGraphTests/Models/TargetReferenceTests.swift +++ b/Tests/XcodeGraphTests/Models/TargetReferenceTests.swift @@ -1,14 +1,13 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class TargetReferenceTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = TargetReference( - projectPath: try! AbsolutePath(validating: "/path/to/project"), + projectPath: try AbsolutePath(validating: "/path/to/project"), name: "name" ) diff --git a/Tests/XcodeGraphTests/Models/TestActionTests.swift b/Tests/XcodeGraphTests/Models/TestActionTests.swift index 8f93f8b1..01242f58 100644 --- a/Tests/XcodeGraphTests/Models/TestActionTests.swift +++ b/Tests/XcodeGraphTests/Models/TestActionTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class TestActionTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/TestPlanTests.swift b/Tests/XcodeGraphTests/Models/TestPlanTests.swift index 49c46193..38ec3608 100644 --- a/Tests/XcodeGraphTests/Models/TestPlanTests.swift +++ b/Tests/XcodeGraphTests/Models/TestPlanTests.swift @@ -1,14 +1,13 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class TestPlanTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = TestPlan( - path: try! AbsolutePath(validating: "/path/to"), + path: try AbsolutePath(validating: "/path/to"), testTargets: [], isDefault: true ) diff --git a/Tests/XcodeGraphTests/Models/TestableTargetTests.swift b/Tests/XcodeGraphTests/Models/TestableTargetTests.swift index 6e56f7f7..8222f3ec 100644 --- a/Tests/XcodeGraphTests/Models/TestableTargetTests.swift +++ b/Tests/XcodeGraphTests/Models/TestableTargetTests.swift @@ -1,15 +1,14 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class TestableTargetTests: XCTestCase { - func test_codable_with_deprecated_parallelizable() { + func test_codable_with_deprecated_parallelizable() throws { // Given let subject = TestableTarget.test( target: .init( - projectPath: try! AbsolutePath(validating: "/path/to/project"), + projectPath: try AbsolutePath(validating: "/path/to/project"), name: "name" ), skipped: true, @@ -21,11 +20,11 @@ final class TestableTargetTests: XCTestCase { XCTAssertCodable(subject) } - func test_codable() { + func test_codable() throws { // Given let subject = TestableTarget( target: .init( - projectPath: try! AbsolutePath(validating: "/path/to/project"), + projectPath: try AbsolutePath(validating: "/path/to/project"), name: "name" ), skipped: true, diff --git a/Tests/XcodeGraphTests/Models/WorkspaceGenerationOptionsTests.swift b/Tests/XcodeGraphTests/Models/WorkspaceGenerationOptionsTests.swift index 25ea1ca6..187802cc 100644 --- a/Tests/XcodeGraphTests/Models/WorkspaceGenerationOptionsTests.swift +++ b/Tests/XcodeGraphTests/Models/WorkspaceGenerationOptionsTests.swift @@ -1,6 +1,5 @@ import Foundation import XCTest - @testable import XcodeGraph final class WorkspaceGenerationOptionsTests: XCTestCase { diff --git a/Tests/XcodeGraphTests/Models/WorkspaceTests.swift b/Tests/XcodeGraphTests/Models/WorkspaceTests.swift index a7540e94..f104de8c 100644 --- a/Tests/XcodeGraphTests/Models/WorkspaceTests.swift +++ b/Tests/XcodeGraphTests/Models/WorkspaceTests.swift @@ -1,14 +1,13 @@ import Foundation import Path import XCTest - @testable import XcodeGraph final class WorkspaceTests: XCTestCase { - func test_codable() { + func test_codable() throws { // Given let subject = Workspace.test( - path: try! AbsolutePath(validating: "/path/to/workspace"), + path: try AbsolutePath(validating: "/path/to/workspace"), name: "name" ) diff --git a/Tests/XcodeGraphTests/Models/XCFrameworkInfoPlistTests.swift b/Tests/XcodeGraphTests/Models/XCFrameworkInfoPlistTests.swift index e786141f..0dad6326 100644 --- a/Tests/XcodeGraphTests/Models/XCFrameworkInfoPlistTests.swift +++ b/Tests/XcodeGraphTests/Models/XCFrameworkInfoPlistTests.swift @@ -4,7 +4,7 @@ import XCTest @testable import XcodeGraph final class XCFrameworkInfoPlistTests: XCTestCase { - func test_codable() throws { + func test_codable() { // Given let subject: XCFrameworkInfoPlist = .test()