From cdb9197e43a64bf09b1b93ee867df44aa51db351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era=20Buend=C3=ADa?= <663605+pepicrft@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:23:33 +0200 Subject: [PATCH] Extract Tuist-specific models from `XcodeGraph` (#6401) * Remove no-longer needed models * Introduce TuistModels * Fix compilation * Fix Package.swift * Fix some linting issues * Remove TuistModels and merge models into TuistCore --- Package.resolved | 6 +- Package.swift | 4 +- Sources/TuistCore/Models/Cloud.swift | 41 ++ .../Models/CompatibleXcodeVersions.swift | 72 ++++ .../Models/Config.swift | 44 ++- .../Models/ConfigGenerationOptions.swift | 1 - .../TuistCore/Models/PackageSettings.swift | 67 ++++ .../Models/Plugin.swift | 0 Sources/TuistCore/Models/PluginLocation.swift | 41 ++ .../Models/PluginResourceSynthesizer.swift | 14 + .../Models/Plugins.swift | 16 + .../ProjectDescriptionHelpersPlugin.swift | 0 .../Models/Template.swift | 28 ++ .../GraphDependencyReference+TestData.swift | 1 - .../Graph/MockGraphLoader.swift | 1 - .../WorkspaceWithProjects+TestData.swift | 1 - .../Linter/EnvironmentLinter.swift | 1 - .../Linter/MockEnvironmentLinter.swift | 1 - .../Linter/MockGraphLinter.swift | 1 - Sources/TuistKit/Services/InitService.swift | 4 +- Sources/TuistKit/Services/ListService.swift | 1 + .../TuistKit/Services/ScaffoldService.swift | 2 +- .../TuistKit/Utils/ManifestGraphLoader.swift | 2 +- .../Loaders/CachedManifestLoader.swift | 8 +- .../TuistLoader/Loaders/ConfigLoader.swift | 10 +- .../Loaders/PackageSettingsLoader.swift | 6 +- .../Loaders/RecursiveManifestLoader.swift | 8 +- .../SwiftPackageManagerGraphLoader.swift | 4 +- .../Loaders/TemplateGitLoader.swift | 5 +- .../TuistLoader/Loaders/TemplateLoader.swift | 32 +- .../Cloud+ManifestMapper.swift | 12 +- ...mpatibleXcodeVersions+ManifestMapper.swift | 5 +- .../Config+ManifestMapper.swift | 24 +- .../PackageSettings+ManifestMapper.swift | 2 +- .../PluginLocation+ManifestMapper.swift | 6 +- .../Project+ManifestMapper.swift | 1 + .../ResourceSynthesizer+ManifestMapper.swift | 1 + .../ProjectDescriptionHelpersBuilder.swift | 4 +- .../PackageInfoMapper.swift | 4 +- .../ResourceSynthesizerPathLocator.swift | 3 +- .../Loaders/Mocks/MockManifestLoader.swift | 2 +- .../Mocks/MockPackageSettingsLoader.swift | 3 +- .../Loaders/Mocks/MockTemplateGitLoader.swift | 2 +- .../Loaders/Mocks/MockTemplateLoader.swift | 2 +- ...MockProjectDescriptionHelpersBuilder.swift | 2 +- .../MockResourceSynthesizerPathLocator.swift | 2 +- Sources/TuistPlugin/PluginService.swift | 1 - .../MockPluginService.swift | 2 +- Sources/TuistScaffold/TemplateGenerator.swift | 11 +- .../Utils/Mocks/MockTemplateGenerator.swift | 7 +- .../Cache/EmptyCacheStorageFactory.swift | 2 +- .../DependenciesGraph/DependenciesGraph.swift | 21 - .../Graph/ConditionalGraphTarget.swift | 49 --- Sources/XcodeGraph/Graph/Graph.swift | 67 ---- .../XcodeGraph/Graph/GraphDependency.swift | 284 -------------- Sources/XcodeGraph/Graph/GraphTarget.swift | 33 -- Sources/XcodeGraph/Models/ArchiveAction.swift | 28 -- Sources/XcodeGraph/Models/BuildAction.swift | 25 -- .../XcodeGraph/Models/CopyFileElement.swift | 39 -- .../XcodeGraph/Models/CopyFilesAction.swift | 43 --- Sources/XcodeGraph/Models/CoreDataModel.swift | 28 -- .../SwiftPackageManagerDependencies.swift | 135 ------- .../XcodeGraph/Models/ExecutionAction.swift | 34 -- Sources/XcodeGraph/Models/FileElement.swift | 25 -- Sources/XcodeGraph/Models/Headers.swift | 23 -- .../Models/Metadata/FrameworkMetadata.swift | 31 -- .../Models/Metadata/LibraryMetadata.swift | 25 -- .../Metadata/SystemFrameworkMetadata.swift | 22 -- .../Models/Metadata/XCFrameworkMetadata.swift | 31 -- Sources/XcodeGraph/Models/Package.swift | 18 - .../XcodeGraph/Models/PlatformCondition.swift | 64 --- Sources/XcodeGraph/Models/Plist.swift | 168 -------- Sources/XcodeGraph/Models/Product.swift | 241 ------------ Sources/XcodeGraph/Models/Project.swift | 152 -------- .../Models/RawScriptBuildPhase.swift | 40 -- .../Models/ResourceFileElement.swift | 58 --- .../Models/ResourceSynthesizer.swift | 96 ----- Sources/XcodeGraph/Models/RunAction.swift | 49 --- .../XcodeGraph/Models/RunActionOptions.swift | 66 ---- Sources/XcodeGraph/Models/Scheme.swift | 40 -- Sources/XcodeGraph/Models/Settings.swift | 201 ---------- .../XcodeGraph/Models/SimulatedLocation.swift | 46 --- Sources/XcodeGraph/Models/SourceFile.swift | 47 --- Sources/XcodeGraph/Models/Target.swift | 365 ------------------ .../XcodeGraph/Models/TargetDependency.swift | 74 ---- .../XcodeGraph/Models/TargetReference.swift | 12 - Sources/XcodeGraph/Models/TargetScript.swift | 152 -------- Sources/XcodeGraph/Models/TestAction.swift | 58 --- Sources/XcodeGraph/Models/TestPlan.swift | 16 - Sources/XcodeGraph/Models/Workspace.swift | 150 ------- .../Models/XCFrameworkInfoPlist.swift | 72 ---- .../DependenciesGraph+TestData.swift | 176 --------- .../Graph/Graph+TestData.swift | 25 -- .../Graph/GraphDependency+TestData.swift | 113 ------ .../Graph/GraphTarget+TestData.swift | 18 - .../Models/AnalyzeAction+TestData.swift | 9 - .../Models/ArchiveAction+TestData.swift | 21 - .../Models/Arguments+TestData.swift | 15 - .../Models/BuildAction+TestData.swift | 14 - .../Models/Cloud+TestData.swift | 14 - .../Models/Config+TestData.swift | 44 --- .../Models/Headers+TestData.swift | 17 - .../Metadata/FrameworkMetadata+TestData.swift | 26 -- .../Metadata/LibraryMetadata+TestData.swift | 22 -- .../XCFrameworkMetadata+TestData.swift | 26 -- .../Models/PackageSettings+TestData.swift | 24 -- .../Models/Plugins+TestData.swift | 17 - .../Models/ProfileAction+TestData.swift | 22 -- .../Models/Project+TestData.swift | 91 ----- .../Models/RawScriptBuildPhase+TestData.swift | 14 - .../ResourceSynthesizerPlugin+TestData.swift | 15 - .../Models/RunAction+TestData.swift | 39 -- .../Models/Scheme+TestData.swift | 27 -- .../Models/Settings+TestData.swift | 48 --- .../Models/Target+TestData.swift | 184 --------- .../Models/Template+TestData.swift | 29 -- .../Models/TestAction+TestData.swift | 42 -- .../Models/TestableTarget+TestData.swift | 21 - .../Models/Workspace+TestData.swift | 49 --- .../XCFrameworkInfoPlist+TestData.swift | 27 -- .../Graph/GraphTraverserTests.swift | 17 +- ...ectsPlatformNarrowerGraphMapperTests.swift | 1 - ...rphanExternalTargetsGraphMapperTests.swift | 1 - ...ltipleConfigurationsIntegrationTests.swift | 1 - .../SwiftPackageManagerInteractorTests.swift | 1 - .../WorkspaceGeneratorIntegrationTests.swift | 1 - .../Extensions/Xcodeproj+ExtrasTests.swift | 11 +- .../Generator/BuildPhaseGeneratorTests.swift | 1 - .../Generator/ConfigGeneratorTests.swift | 1 - .../InfoPlistContentProviderTests.swift | 1 - .../Generator/LinkGeneratorTests.swift | 1 - .../Mocks/MockInfoPlistContentProvider.swift | 1 - .../MockProjectDescriptorGenerator.swift | 1 - .../MockSchemeDescriptorsGenerator.swift | 1 - .../Generator/Mocks/MockTargetGenerator.swift | 1 - .../MockWorkspaceDescriptorGenerator.swift | 1 - .../ProjectDescriptorGeneratorTests.swift | 1 - .../Generator/ProjectFileElementsTests.swift | 1 - .../Generator/ProjectGroupsTests.swift | 1 - .../SchemeDescriptorsGeneratorTests.swift | 1 - .../Generator/TargetGeneratorTests.swift | 1 - .../WorkspaceDescriptorGeneratorTests.swift | 1 - ...paceSettingsDescriptorGeneratorTests.swift | 1 - .../WorkspaceStructureGeneratorTests.swift | 1 - ...dWorkspaceSchemeWorkspaceMapperTests.swift | 1 - .../GraphViz/GraphToGraphVizMapperTests.swift | 1 - .../Linter/EnvironmentLinterTests.swift | 1 - .../Linter/GraphLinterTests.swift | 3 +- .../Linter/Mocks/MockPackageLinter.swift | 1 - .../Linter/Mocks/MockProjectLinter.swift | 1 - .../Linter/Mocks/MockSchemeLinter.swift | 1 - .../Linter/Mocks/MockSettingsLinter.swift | 1 - .../Mocks/MockStaticProductsGraphLinter.swift | 1 - .../Linter/Mocks/MockTargetLinter.swift | 1 - .../Linter/PackageLinterTests.swift | 1 - .../Linter/ProjectLinterTests.swift | 1 - .../Linter/SchemeLinterTests.swift | 1 - .../Linter/SettingsLinterTests.swift | 1 - .../StaticProductsGraphLinterTests.swift | 1 - .../Linter/TargetLinterTests.swift | 1 - .../Linter/TargetScriptLinterTests.swift | 1 - ...togeneratedSchemesProjectMapperTests.swift | 1 - ...teDerivedDirectoryProjectMapperTests.swift | 1 - .../GenerateInfoPlistProjectMapperTests.swift | 1 - .../ResourcesProjectMapperTests.swift | 1 - ...dResourceInterfaceProjectMapperTests.swift | 1 - ...DisableShowEnvVarsProjectMapperTests.swift | 1 - .../DefaultSettingsProviderTests.swift | 1 - .../Cloud/CloudAuthServiceTests.swift | 1 - .../Cloud/CloudCleanServiceTests.swift | 2 +- .../Cloud/CloudInitServiceTests.swift | 2 +- .../Cloud/CloudLogoutServiceTests.swift | 1 - .../Cloud/CloudSessionServiceTests.swift | 1 - .../Generator/Mocks/MockGenerator.swift | 71 ++++ ...ateWorkspaceProjectsGraphMapperTests.swift | 1 - .../Mocks/MockManifestGraphLoader.swift | 1 - .../Mocks/MockProjectEditorMapper.swift | 1 - .../ProjectEditorMapperTests.swift | 1 - .../ProjectEditor/ProjectEditorTests.swift | 1 - .../Services/BuildServiceTests.swift | 1 - .../Services/InitServiceTests.swift | 25 +- .../Services/InstallServiceTests.swift | 1 - .../Services/ListServiceTests.swift | 2 +- .../Services/RunServiceTests.swift | 1 - .../Services/ScaffoldServiceTests.swift | 1 - .../Services/TestServiceTests.swift | 1 - .../Utils/TuistAnalyticsDispatcherTests.swift | 1 - ...iptionHelpersBuilderIntegrationTests.swift | 1 - .../Loaders/CachedManifestLoaderTests.swift | 10 +- .../Loaders/ConfigLoaderTests.swift | 6 +- .../Loaders/PackageSettingsLoaderTests.swift | 3 +- ...SwiftPackageManagerDependenciesTests.swift | 146 ------- .../Loaders/TemplateGitLoaderTests.swift | 3 +- .../Loaders/TemplateLoaderTests.swift | 3 +- .../Cloud+ManifestMapperTests.swift | 4 +- ...ourceSynthesizer+ManifestMapperTests.swift | 2 +- .../PackageInfoMapperTests.swift | 2 +- .../Utils/PluginsHelperTests.swift | 1 + .../TuistPluginTests/PluginServiceTests.swift | 18 +- .../TemplateGeneratorTests.swift | 2 +- .../AnalyticsArtifactUploadServiceTests.swift | 1 - .../XcodeGraphTests/Models/TargetTests.swift | 1 - Tuist/ProjectDescriptionHelpers/Module.swift | 27 -- 203 files changed, 540 insertions(+), 4719 deletions(-) create mode 100644 Sources/TuistCore/Models/Cloud.swift create mode 100644 Sources/TuistCore/Models/CompatibleXcodeVersions.swift rename Sources/{XcodeGraph => TuistCore}/Models/Config.swift (58%) rename Sources/{XcodeGraph => TuistCore}/Models/ConfigGenerationOptions.swift (98%) create mode 100644 Sources/TuistCore/Models/PackageSettings.swift rename Sources/{XcodeGraph => TuistCore}/Models/Plugin.swift (100%) create mode 100644 Sources/TuistCore/Models/PluginLocation.swift rename Sources/{XcodeGraph => TuistCore}/Models/PluginResourceSynthesizer.swift (54%) rename Sources/{XcodeGraph => TuistCore}/Models/Plugins.swift (72%) rename Sources/{XcodeGraph => TuistCore}/Models/ProjectDescriptionHelpersPlugin.swift (100%) rename Sources/{XcodeGraph => TuistCore}/Models/Template.swift (85%) delete mode 100644 Sources/XcodeGraph/DependenciesGraph/DependenciesGraph.swift delete mode 100644 Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift delete mode 100644 Sources/XcodeGraph/Graph/Graph.swift delete mode 100644 Sources/XcodeGraph/Graph/GraphDependency.swift delete mode 100644 Sources/XcodeGraph/Graph/GraphTarget.swift delete mode 100644 Sources/XcodeGraph/Models/ArchiveAction.swift delete mode 100644 Sources/XcodeGraph/Models/BuildAction.swift delete mode 100644 Sources/XcodeGraph/Models/CopyFileElement.swift delete mode 100644 Sources/XcodeGraph/Models/CopyFilesAction.swift delete mode 100644 Sources/XcodeGraph/Models/CoreDataModel.swift delete mode 100644 Sources/XcodeGraph/Models/Dependencies/SwiftPackageManagerDependencies.swift delete mode 100644 Sources/XcodeGraph/Models/ExecutionAction.swift delete mode 100644 Sources/XcodeGraph/Models/FileElement.swift delete mode 100644 Sources/XcodeGraph/Models/Headers.swift delete mode 100644 Sources/XcodeGraph/Models/Metadata/FrameworkMetadata.swift delete mode 100644 Sources/XcodeGraph/Models/Metadata/LibraryMetadata.swift delete mode 100644 Sources/XcodeGraph/Models/Metadata/SystemFrameworkMetadata.swift delete mode 100644 Sources/XcodeGraph/Models/Metadata/XCFrameworkMetadata.swift delete mode 100644 Sources/XcodeGraph/Models/Package.swift delete mode 100644 Sources/XcodeGraph/Models/PlatformCondition.swift delete mode 100644 Sources/XcodeGraph/Models/Plist.swift delete mode 100644 Sources/XcodeGraph/Models/Product.swift delete mode 100644 Sources/XcodeGraph/Models/Project.swift delete mode 100644 Sources/XcodeGraph/Models/RawScriptBuildPhase.swift delete mode 100644 Sources/XcodeGraph/Models/ResourceFileElement.swift delete mode 100644 Sources/XcodeGraph/Models/ResourceSynthesizer.swift delete mode 100644 Sources/XcodeGraph/Models/RunAction.swift delete mode 100644 Sources/XcodeGraph/Models/RunActionOptions.swift delete mode 100644 Sources/XcodeGraph/Models/Scheme.swift delete mode 100644 Sources/XcodeGraph/Models/Settings.swift delete mode 100644 Sources/XcodeGraph/Models/SimulatedLocation.swift delete mode 100644 Sources/XcodeGraph/Models/SourceFile.swift delete mode 100644 Sources/XcodeGraph/Models/Target.swift delete mode 100644 Sources/XcodeGraph/Models/TargetDependency.swift delete mode 100644 Sources/XcodeGraph/Models/TargetReference.swift delete mode 100644 Sources/XcodeGraph/Models/TargetScript.swift delete mode 100644 Sources/XcodeGraph/Models/TestAction.swift delete mode 100644 Sources/XcodeGraph/Models/TestPlan.swift delete mode 100644 Sources/XcodeGraph/Models/Workspace.swift delete mode 100644 Sources/XcodeGraph/Models/XCFrameworkInfoPlist.swift delete mode 100644 Sources/XcodeGraphTesting/DependenciesGraph/DependenciesGraph+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Graph/Graph+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Graph/GraphDependency+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Graph/GraphTarget+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/AnalyzeAction+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/ArchiveAction+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Arguments+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/BuildAction+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Cloud+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Config+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Headers+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Metadata/FrameworkMetadata+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Metadata/LibraryMetadata+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Metadata/XCFrameworkMetadata+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/PackageSettings+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Plugins+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/ProfileAction+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Project+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/RawScriptBuildPhase+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/ResourceSynthesizerPlugin+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/RunAction+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Scheme+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Settings+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Target+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Template+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/TestAction+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/TestableTarget+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/Workspace+TestData.swift delete mode 100644 Sources/XcodeGraphTesting/Models/XCFrameworkInfoPlist+TestData.swift create mode 100644 Tests/TuistKitTests/Generator/Mocks/MockGenerator.swift delete mode 100644 Tests/TuistLoaderTests/Loaders/SwiftPackageManagerDependenciesTests.swift diff --git a/Package.resolved b/Package.resolved index d5e3ca84104..0efad86762b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "026755a035a6925da2ead11d61025383dd47d8db6b0c23d6a14cb94e12523887", + "originHash" : "be656e1285b67cd89206d2e44ae693ca74086bd97ce1788a21d0533b6a6b6f62", "pins" : [ { "identity" : "aexml", @@ -240,8 +240,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tuist/XcodeGraph.git", "state" : { - "revision" : "634fd424d7d7c43aca6598f223c01b2ecf353502", - "version" : "0.2.0" + "revision" : "0e44220403553ce7f20a79e49873b492302b4650", + "version" : "0.5.0" } }, { diff --git a/Package.swift b/Package.swift index 056a5ba0b50..8144b74ee4d 100644 --- a/Package.swift +++ b/Package.swift @@ -44,7 +44,6 @@ var targets: [Target] = [ dependencies: [ "TuistCore", "TuistSupportTesting", - .product(name: "XcodeGraphTesting", package: "XcodeGraph"), pathDependency, ], linkerSettings: [.linkedFramework("XCTest")] @@ -249,7 +248,6 @@ var targets: [Target] = [ "TuistLoader", pathDependency, "TuistCore", - .product(name: "XcodeGraphTesting", package: "XcodeGraph"), "ProjectDescription", "TuistSupportTesting", ], @@ -418,7 +416,7 @@ let package = Package( .package(url: "https://github.com/tuist/swift-openapi-runtime", branch: "swift-tools-version"), .package(url: "https://github.com/tuist/swift-openapi-urlsession", branch: "swift-tools-version"), .package(url: "https://github.com/tuist/Path", .upToNextMajor(from: "0.3.0")), - .package(url: "https://github.com/tuist/XcodeGraph.git", exact: "0.2.0"), + .package(url: "https://github.com/tuist/XcodeGraph.git", .upToNextMajor(from: "0.5.0")), ], targets: targets ) diff --git a/Sources/TuistCore/Models/Cloud.swift b/Sources/TuistCore/Models/Cloud.swift new file mode 100644 index 00000000000..dcf42313f20 --- /dev/null +++ b/Sources/TuistCore/Models/Cloud.swift @@ -0,0 +1,41 @@ +import Foundation + +/// Cloud represents the configuration to connect to the server. +public struct Cloud: Equatable, Hashable { + /// Cloud option. + public enum Option: String, Codable, Equatable { + case optional + } + + /// The base URL that points to the cloud server + public let url: URL + + /// The project unique identifier. + public let projectId: String + + /// Cloud options. + public let options: [Option] + + /// Initializes an instance of Cloud. + /// - Parameters: + /// - url: Cloud server base URL. + /// - projectId: Project unique identifier. + /// - options: Cloud options. + public init(url: URL, projectId: String, options: [Option]) { + self.url = url + self.projectId = projectId + self.options = options + } +} + +#if DEBUG + extension Cloud { + public static func test( + url: URL = URL(string: "https://test.tuist.io")!, + projectId: String = "123", + options: [Cloud.Option] = [] + ) -> Cloud { + Cloud(url: url, projectId: projectId, options: options) + } + } +#endif diff --git a/Sources/TuistCore/Models/CompatibleXcodeVersions.swift b/Sources/TuistCore/Models/CompatibleXcodeVersions.swift new file mode 100644 index 00000000000..df13fde0740 --- /dev/null +++ b/Sources/TuistCore/Models/CompatibleXcodeVersions.swift @@ -0,0 +1,72 @@ +import Foundation +import XcodeGraph + +/// Enum that represents all the Xcode versions that a project or set of projects is compatible with. +public enum CompatibleXcodeVersions: Equatable, Hashable, ExpressibleByArrayLiteral, ExpressibleByStringInterpolation, + CustomStringConvertible +{ + /// The project supports all Xcode versions. + case all + + /// The project supports only a specific Xcode version. + case exact(Version) + + /// The project supports all Xcode versions from the specified version up to but not including the next major version. + case upToNextMajor(Version) + + /// The project supports all Xcode versions from the specified version up to but not including the next minor version. + case upToNextMinor(Version) + + /// List of versions that are supported by the project. + case list([CompatibleXcodeVersions]) + + public func isCompatible(versionString: String) -> Bool { + let xCodeVersion: Version = "\(versionString)" + + switch self { + case .all: + return true + case let .exact(version): + return version == xCodeVersion + case let .upToNextMajor(version): + return xCodeVersion.major == version.major && xCodeVersion >= version + case let .upToNextMinor(version): + return version.major == xCodeVersion.major && version.minor == xCodeVersion.minor && xCodeVersion >= version + case let .list(versions): + return versions.contains { $0.isCompatible(versionString: versionString) } + } + } + + // MARK: - ExpressibleByStringInterpolation + + public init(stringLiteral value: String) { + self = .exact(Version(stringLiteral: value)) + } + + // MARK: - ExpressibleByArrayLiteral + + public init(arrayLiteral elements: [CompatibleXcodeVersions]) { + self = .list(elements) + } + + public init(arrayLiteral elements: CompatibleXcodeVersions...) { + self = .list(elements) + } + + // MARK: - CustomStringConvertible + + public var description: String { + switch self { + case .all: + return "all" + case let .exact(version): + return "\(version)" + case let .upToNextMajor(version): + return "\(version)..<\(version.major + 1).0.0" + case let .upToNextMinor(version): + return "\(version)..<\(version.major).\(version.minor + 1).0" + case let .list(versions): + return "\(versions.map(\.description).joined(separator: " or "))" + } + } +} diff --git a/Sources/XcodeGraph/Models/Config.swift b/Sources/TuistCore/Models/Config.swift similarity index 58% rename from Sources/XcodeGraph/Models/Config.swift rename to Sources/TuistCore/Models/Config.swift index 8c9536c78a9..a6833fb69f1 100644 --- a/Sources/XcodeGraph/Models/Config.swift +++ b/Sources/TuistCore/Models/Config.swift @@ -1,6 +1,6 @@ import Foundation import Path -import TSCUtility +import XcodeGraph /// This model allows to configure Tuist. public struct Config: Equatable, Hashable { @@ -73,3 +73,45 @@ public struct Config: Equatable, Hashable { hasher.combine(compatibleXcodeVersions) } } + +#if DEBUG + extension Config { + public static func test( + compatibleXcodeVersions: CompatibleXcodeVersions = .all, + cloud: Cloud? = Cloud.test(), + swiftVersion: Version? = nil, + plugins: [PluginLocation] = [], + generationOptions: GenerationOptions = Config.default.generationOptions, + path: AbsolutePath? = nil + ) -> Config { + .init( + compatibleXcodeVersions: compatibleXcodeVersions, + cloud: cloud, + swiftVersion: swiftVersion, + plugins: plugins, + generationOptions: generationOptions, + path: path + ) + } + } + + extension Config.GenerationOptions { + public static func test( + resolveDependenciesWithSystemScm: Bool = false, + disablePackageVersionLocking: Bool = false, + clonedSourcePackagesDirPath: AbsolutePath? = nil, + staticSideEffectsWarningTargets: TuistCore.Config.GenerationOptions.StaticSideEffectsWarningTargets = .all, + enforceExplicitDependencies: Bool = false, + defaultConfiguration: String? = nil + ) -> Self { + .init( + resolveDependenciesWithSystemScm: resolveDependenciesWithSystemScm, + disablePackageVersionLocking: disablePackageVersionLocking, + clonedSourcePackagesDirPath: clonedSourcePackagesDirPath, + staticSideEffectsWarningTargets: staticSideEffectsWarningTargets, + enforceExplicitDependencies: enforceExplicitDependencies, + defaultConfiguration: defaultConfiguration + ) + } + } +#endif diff --git a/Sources/XcodeGraph/Models/ConfigGenerationOptions.swift b/Sources/TuistCore/Models/ConfigGenerationOptions.swift similarity index 98% rename from Sources/XcodeGraph/Models/ConfigGenerationOptions.swift rename to Sources/TuistCore/Models/ConfigGenerationOptions.swift index 6431908a14a..b2eeba444dd 100644 --- a/Sources/XcodeGraph/Models/ConfigGenerationOptions.swift +++ b/Sources/TuistCore/Models/ConfigGenerationOptions.swift @@ -1,5 +1,4 @@ import Path -import TSCUtility extension Config { public struct GenerationOptions: Codable, Hashable { diff --git a/Sources/TuistCore/Models/PackageSettings.swift b/Sources/TuistCore/Models/PackageSettings.swift new file mode 100644 index 00000000000..449a1ae74c8 --- /dev/null +++ b/Sources/TuistCore/Models/PackageSettings.swift @@ -0,0 +1,67 @@ +import Foundation +import XcodeGraph + +/// Contains the description of custom SPM settings +public struct PackageSettings: Equatable, Codable { + /// The custom `Product` types to be used for SPM targets. + public let productTypes: [String: Product] + + /// Custom destinations to be used for SPM products. + public let productDestinations: [String: Destinations] + + // The base settings to be used for targets generated from SwiftPackageManager + public let baseSettings: Settings + + /// The custom `Settings` to be applied to SPM targets + public let targetSettings: [String: SettingsDictionary] + + /// The custom project options for each project generated from a swift package + public let projectOptions: [String: XcodeGraph.Project.Options] + + /// Swift tools version of the parsed `Package.swift` + public let swiftToolsVersion: Version + + /// Initializes a new `PackageSettings` instance. + /// - Parameters: + /// - productTypes: The custom `Product` types to be used for SPM targets. + /// - baseSettings: The base settings to be used for targets generated from SwiftPackageManager + /// - targetSettings: The custom `SettingsDictionary` to be applied to denoted targets + /// - projectOptions: The custom project options for each project generated from a swift package + public init( + productTypes: [String: Product], + productDestinations: [String: Destinations], + baseSettings: Settings, + targetSettings: [String: SettingsDictionary], + projectOptions: [String: XcodeGraph.Project.Options] = [:], + swiftToolsVersion: Version + ) { + self.productTypes = productTypes + self.productDestinations = productDestinations + self.baseSettings = baseSettings + self.targetSettings = targetSettings + self.projectOptions = projectOptions + self.swiftToolsVersion = swiftToolsVersion + } +} + +#if DEBUG + extension PackageSettings { + public static func test( + productTypes: [String: Product] = [:], + productDestinations: [String: Destinations] = [:], + baseSettings: Settings = Settings.default, + targetSettings: [String: SettingsDictionary] = [:], + projectOptions: [String: XcodeGraph.Project.Options] = [:], + swiftToolsVersion: Version = Version("5.4.9") + ) -> PackageSettings { + PackageSettings( + productTypes: productTypes, + productDestinations: productDestinations, + baseSettings: baseSettings, + targetSettings: targetSettings, + projectOptions: projectOptions, + swiftToolsVersion: swiftToolsVersion + ) + } + } +#endif diff --git a/Sources/XcodeGraph/Models/Plugin.swift b/Sources/TuistCore/Models/Plugin.swift similarity index 100% rename from Sources/XcodeGraph/Models/Plugin.swift rename to Sources/TuistCore/Models/Plugin.swift diff --git a/Sources/TuistCore/Models/PluginLocation.swift b/Sources/TuistCore/Models/PluginLocation.swift new file mode 100644 index 00000000000..3af5ed9a5ee --- /dev/null +++ b/Sources/TuistCore/Models/PluginLocation.swift @@ -0,0 +1,41 @@ +import Foundation + +/// The location to a directory containing a `Plugin` manifest. +public enum PluginLocation: Hashable, Equatable { + public enum GitReference: Hashable, Equatable { + case sha(String) + case tag(String) + } + + /// An absolute path `String` to a directory a `Plugin` manifest. + /// + /// Example: + /// ``` + /// .local(path: "/User/local/bin") + /// ``` + case local(path: String) + + /// A `URL` to a `git` repository pointing at a `GitReference` (either sha or tag), and optionally a directory + /// + /// Examples: + /// ``` + /// .git(url: "https://git/helpers.git", gitReference: .tag("1.0.0")) + /// .git(url: "https://git/helpers.git", gitReference: .sha("1.0.0")) + /// ``` + case git(url: String, gitReference: GitReference, directory: String?, releaseUrl: String?) +} + +// MARK: - description + +extension PluginLocation: CustomStringConvertible { + public var description: String { + switch self { + case let .local(path): + return "local path: \(path)" + case let .git(url, .tag(tag), directory, releaseUrl): + return "git url: \(url), tag: \(tag), directory: \(directory ?? "nil"), releaseUrl: \(releaseUrl ?? "nil")" + case let .git(url, .sha(sha), directory, releaseUrl): + return "git url: \(url), sha: \(sha), directory: \(directory ?? "nil"), releaseUrl: \(releaseUrl ?? "nil")" + } + } +} diff --git a/Sources/XcodeGraph/Models/PluginResourceSynthesizer.swift b/Sources/TuistCore/Models/PluginResourceSynthesizer.swift similarity index 54% rename from Sources/XcodeGraph/Models/PluginResourceSynthesizer.swift rename to Sources/TuistCore/Models/PluginResourceSynthesizer.swift index 65409941b5b..47048e0016c 100644 --- a/Sources/XcodeGraph/Models/PluginResourceSynthesizer.swift +++ b/Sources/TuistCore/Models/PluginResourceSynthesizer.swift @@ -16,3 +16,17 @@ public struct PluginResourceSynthesizer: Equatable { self.path = path } } + +#if DEBUG + extension PluginResourceSynthesizer { + public static func test( + name: String = "Plugin", + path: AbsolutePath = try! AbsolutePath(validating: "/test") // swiftlint:disable:this force_try + ) -> Self { + .init( + name: name, + path: path + ) + } + } +#endif diff --git a/Sources/XcodeGraph/Models/Plugins.swift b/Sources/TuistCore/Models/Plugins.swift similarity index 72% rename from Sources/XcodeGraph/Models/Plugins.swift rename to Sources/TuistCore/Models/Plugins.swift index 61424933a7e..81e1e75bede 100644 --- a/Sources/XcodeGraph/Models/Plugins.swift +++ b/Sources/TuistCore/Models/Plugins.swift @@ -35,3 +35,19 @@ public struct Plugins: Equatable { resourceSynthesizers: [] ) } + +#if DEBUG + extension Plugins { + public static func test( + projectDescriptionHelpers: [ProjectDescriptionHelpersPlugin] = [], + templatePaths: [AbsolutePath] = [], + resourceSynthesizers: [PluginResourceSynthesizer] = [] + ) -> Plugins { + Plugins( + projectDescriptionHelpers: projectDescriptionHelpers, + templatePaths: templatePaths, + resourceSynthesizers: resourceSynthesizers + ) + } + } +#endif diff --git a/Sources/XcodeGraph/Models/ProjectDescriptionHelpersPlugin.swift b/Sources/TuistCore/Models/ProjectDescriptionHelpersPlugin.swift similarity index 100% rename from Sources/XcodeGraph/Models/ProjectDescriptionHelpersPlugin.swift rename to Sources/TuistCore/Models/ProjectDescriptionHelpersPlugin.swift diff --git a/Sources/XcodeGraph/Models/Template.swift b/Sources/TuistCore/Models/Template.swift similarity index 85% rename from Sources/XcodeGraph/Models/Template.swift rename to Sources/TuistCore/Models/Template.swift index b266d05c5e4..98b6a6423fa 100644 --- a/Sources/XcodeGraph/Models/Template.swift +++ b/Sources/TuistCore/Models/Template.swift @@ -149,3 +149,31 @@ extension Template.Attribute.Value: RawRepresentable { } } } + +#if DEBUG + extension Template { + public static func test( + description: String = "Template", + attributes: [Attribute] = [], + items: [Template.Item] = [] + ) -> Template { + Template( + description: description, + attributes: attributes, + items: items + ) + } + } + + extension Template.Item { + public static func test( + path: RelativePath, + contents: Template.Contents = .string("test content") + ) -> Template.Item { + Template.Item( + path: path, + contents: contents + ) + } + } +#endif diff --git a/Sources/TuistCoreTesting/Graph/GraphDependencyReference+TestData.swift b/Sources/TuistCoreTesting/Graph/GraphDependencyReference+TestData.swift index e07b61e7249..f25f0aa31e3 100644 --- a/Sources/TuistCoreTesting/Graph/GraphDependencyReference+TestData.swift +++ b/Sources/TuistCoreTesting/Graph/GraphDependencyReference+TestData.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting extension GraphDependencyReference { public static func testFramework( diff --git a/Sources/TuistCoreTesting/Graph/MockGraphLoader.swift b/Sources/TuistCoreTesting/Graph/MockGraphLoader.swift index 5d4a789972c..9a46859ddc2 100644 --- a/Sources/TuistCoreTesting/Graph/MockGraphLoader.swift +++ b/Sources/TuistCoreTesting/Graph/MockGraphLoader.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import XcodeGraph -@testable import XcodeGraphTesting public final class MockGraphLoader: GraphLoading { public init() {} diff --git a/Sources/TuistCoreTesting/Graph/WorkspaceWithProjects+TestData.swift b/Sources/TuistCoreTesting/Graph/WorkspaceWithProjects+TestData.swift index 129ca0aeeb0..8473c96b457 100644 --- a/Sources/TuistCoreTesting/Graph/WorkspaceWithProjects+TestData.swift +++ b/Sources/TuistCoreTesting/Graph/WorkspaceWithProjects+TestData.swift @@ -1,7 +1,6 @@ import Foundation import Path import XcodeGraph -import XcodeGraphTesting @testable import TuistCore extension WorkspaceWithProjects { diff --git a/Sources/TuistGenerator/Linter/EnvironmentLinter.swift b/Sources/TuistGenerator/Linter/EnvironmentLinter.swift index 081a5b2890f..670d9f99868 100644 --- a/Sources/TuistGenerator/Linter/EnvironmentLinter.swift +++ b/Sources/TuistGenerator/Linter/EnvironmentLinter.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import TuistSupport -import XcodeGraph public protocol EnvironmentLinting { /// Lints a given Tuist configuration. diff --git a/Sources/TuistGeneratorTesting/Linter/MockEnvironmentLinter.swift b/Sources/TuistGeneratorTesting/Linter/MockEnvironmentLinter.swift index 43be18152ca..59e31a3bd68 100644 --- a/Sources/TuistGeneratorTesting/Linter/MockEnvironmentLinter.swift +++ b/Sources/TuistGeneratorTesting/Linter/MockEnvironmentLinter.swift @@ -1,7 +1,6 @@ import Foundation import Path import TuistCore -import XcodeGraph @testable import TuistGenerator diff --git a/Sources/TuistGeneratorTesting/Linter/MockGraphLinter.swift b/Sources/TuistGeneratorTesting/Linter/MockGraphLinter.swift index 5f9ea4ec41e..41893d68efc 100644 --- a/Sources/TuistGeneratorTesting/Linter/MockGraphLinter.swift +++ b/Sources/TuistGeneratorTesting/Linter/MockGraphLinter.swift @@ -1,7 +1,6 @@ import Foundation import TuistCore import TuistSupport -import XcodeGraph @testable import TuistGenerator public class MockGraphLinter: GraphLinting { diff --git a/Sources/TuistKit/Services/InitService.swift b/Sources/TuistKit/Services/InitService.swift index 3f1d84f959a..32e61bbf88b 100644 --- a/Sources/TuistKit/Services/InitService.swift +++ b/Sources/TuistKit/Services/InitService.swift @@ -187,8 +187,8 @@ class InitService { requiredTemplateOptions: [String: String], optionalTemplateOptions: [String: String?], template: Template - ) throws -> [String: XcodeGraph.Template.Attribute.Value] { - let defaultAttributes: [String: XcodeGraph.Template.Attribute.Value] = [ + ) throws -> [String: Template.Attribute.Value] { + let defaultAttributes: [String: Template.Attribute.Value] = [ "name": .string(name), "platform": .string(platform.caseValue), "tuist_version": .string(tuistVersion), diff --git a/Sources/TuistKit/Services/ListService.swift b/Sources/TuistKit/Services/ListService.swift index 89d80fe02e3..9e8d2a3add8 100644 --- a/Sources/TuistKit/Services/ListService.swift +++ b/Sources/TuistKit/Services/ListService.swift @@ -1,5 +1,6 @@ import Foundation import Path +import TuistCore import TuistLoader import TuistPlugin import TuistScaffold diff --git a/Sources/TuistKit/Services/ScaffoldService.swift b/Sources/TuistKit/Services/ScaffoldService.swift index 1ecca3cf859..16ae55b4913 100644 --- a/Sources/TuistKit/Services/ScaffoldService.swift +++ b/Sources/TuistKit/Services/ScaffoldService.swift @@ -131,7 +131,7 @@ final class ScaffoldService { requiredTemplateOptions: [String: String], optionalTemplateOptions: [String: String?], template: Template - ) throws -> [String: XcodeGraph.Template.Attribute.Value] { + ) throws -> [String: Template.Attribute.Value] { try template.attributes.reduce(into: [:]) { attributesDictionary, attribute in switch attribute { case let .required(name): diff --git a/Sources/TuistKit/Utils/ManifestGraphLoader.swift b/Sources/TuistKit/Utils/ManifestGraphLoader.swift index e66120ee321..24e9d8b02f4 100644 --- a/Sources/TuistKit/Utils/ManifestGraphLoader.swift +++ b/Sources/TuistKit/Utils/ManifestGraphLoader.swift @@ -107,7 +107,7 @@ public final class ManifestGraphLoader: ManifestGraphLoading { // Load DependenciesGraph let dependenciesGraph: XcodeGraph.DependenciesGraph - let packageSettings: XcodeGraph.PackageSettings? + let packageSettings: TuistCore.PackageSettings? // Load SPM graph only if is SPM Project only or the workspace is using external dependencies if let packagePath = manifestFilesLocator.locatePackageManifest(at: path), diff --git a/Sources/TuistLoader/Loaders/CachedManifestLoader.swift b/Sources/TuistLoader/Loaders/CachedManifestLoader.swift index b015c4c36db..a8c7039bb31 100644 --- a/Sources/TuistLoader/Loaders/CachedManifestLoader.swift +++ b/Sources/TuistLoader/Loaders/CachedManifestLoader.swift @@ -3,8 +3,6 @@ import Path import ProjectDescription import TuistCore import TuistSupport -import struct XcodeGraph.Config -import struct XcodeGraph.Plugins /// Cached Manifest Loader /// @@ -79,19 +77,19 @@ public class CachedManifestLoader: ManifestLoading { } } - public func loadTemplate(at path: AbsolutePath) throws -> Template { + public func loadTemplate(at path: AbsolutePath) throws -> ProjectDescription.Template { try load(manifest: .template, at: path) { try manifestLoader.loadTemplate(at: path) } } - public func loadPlugin(at path: AbsolutePath) throws -> Plugin { + public func loadPlugin(at path: AbsolutePath) throws -> ProjectDescription.Plugin { try load(manifest: .plugin, at: path) { try manifestLoader.loadPlugin(at: path) } } - public func loadPackageSettings(at path: AbsolutePath) throws -> PackageSettings { + public func loadPackageSettings(at path: AbsolutePath) throws -> ProjectDescription.PackageSettings { try load(manifest: .packageSettings, at: path) { try manifestLoader.loadPackageSettings(at: path) } diff --git a/Sources/TuistLoader/Loaders/ConfigLoader.swift b/Sources/TuistLoader/Loaders/ConfigLoader.swift index 9e5e67a5ef8..83651cf11a8 100644 --- a/Sources/TuistLoader/Loaders/ConfigLoader.swift +++ b/Sources/TuistLoader/Loaders/ConfigLoader.swift @@ -14,7 +14,7 @@ public protocol ConfigLoading { /// - Parameter path: Directory from which look up and load the Config. /// - Returns: Loaded Config object. /// - Throws: An error if the Config.swift can't be parsed. - func loadConfig(path: AbsolutePath) throws -> XcodeGraph.Config + func loadConfig(path: AbsolutePath) throws -> TuistCore.Config /// Locates the Config.swift manifest from the given directory. func locateConfig(at: AbsolutePath) -> AbsolutePath? @@ -24,7 +24,7 @@ public final class ConfigLoader: ConfigLoading { private let manifestLoader: ManifestLoading private let rootDirectoryLocator: RootDirectoryLocating private let fileHandler: FileHandling - private var cachedConfigs: [AbsolutePath: XcodeGraph.Config] = [:] + private var cachedConfigs: [AbsolutePath: TuistCore.Config] = [:] public init( manifestLoader: ManifestLoading = ManifestLoader(), @@ -36,19 +36,19 @@ public final class ConfigLoader: ConfigLoading { self.fileHandler = fileHandler } - public func loadConfig(path: AbsolutePath) throws -> XcodeGraph.Config { + public func loadConfig(path: AbsolutePath) throws -> TuistCore.Config { if let cached = cachedConfigs[path] { return cached } guard let configPath = locateConfig(at: path) else { - let config = XcodeGraph.Config.default + let config = TuistCore.Config.default cachedConfigs[path] = config return config } let manifest = try manifestLoader.loadConfig(at: configPath.parentDirectory) - let config = try XcodeGraph.Config.from(manifest: manifest, at: configPath) + let config = try TuistCore.Config.from(manifest: manifest, at: configPath) cachedConfigs[path] = config return config } diff --git a/Sources/TuistLoader/Loaders/PackageSettingsLoader.swift b/Sources/TuistLoader/Loaders/PackageSettingsLoader.swift index 4b86ecf84f5..07b81cc7a02 100644 --- a/Sources/TuistLoader/Loaders/PackageSettingsLoader.swift +++ b/Sources/TuistLoader/Loaders/PackageSettingsLoader.swift @@ -12,7 +12,7 @@ public protocol PackageSettingsLoading { /// - Parameter path: The absolute path for the `PackageSettings` to load. /// - Parameter plugins: The plugins for the `PackageSettings` to load. /// - Returns: The `PackageSettings` loaded from the specified path. - func loadPackageSettings(at path: AbsolutePath, with plugins: Plugins) throws -> XcodeGraph.PackageSettings + func loadPackageSettings(at path: AbsolutePath, with plugins: Plugins) throws -> TuistCore.PackageSettings } public final class PackageSettingsLoader: PackageSettingsLoading { @@ -33,7 +33,7 @@ public final class PackageSettingsLoader: PackageSettingsLoading { self.manifestFilesLocator = manifestFilesLocator } - public func loadPackageSettings(at path: AbsolutePath, with plugins: Plugins) throws -> XcodeGraph.PackageSettings { + public func loadPackageSettings(at path: AbsolutePath, with plugins: Plugins) throws -> TuistCore.PackageSettings { let path = manifestFilesLocator.locatePackageManifest(at: path)?.parentDirectory ?? path try manifestLoader.register(plugins: plugins) let manifest = try manifestLoader.loadPackageSettings(at: path) @@ -42,7 +42,7 @@ public final class PackageSettingsLoader: PackageSettingsLoading { at: path ) - return try XcodeGraph.PackageSettings.from( + return try TuistCore.PackageSettings.from( manifest: manifest, generatorPaths: generatorPaths, swiftToolsVersion: swiftToolsVersion diff --git a/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift b/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift index c982084db5e..72142f7c5a9 100644 --- a/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift +++ b/Sources/TuistLoader/Loaders/RecursiveManifestLoader.swift @@ -1,8 +1,8 @@ import Foundation import Path import ProjectDescription +import TuistCore import TuistSupport -import XcodeGraph /// A component that can load a manifest and all its (transitive) manifest dependencies public protocol RecursiveManifestLoading { @@ -20,7 +20,7 @@ public protocol RecursiveManifestLoading { /// - Returns: Loaded manifest func loadAndMergePackageProjects( in loadedWorkspace: LoadedWorkspace, - packageSettings: XcodeGraph.PackageSettings + packageSettings: TuistCore.PackageSettings ) throws -> LoadedWorkspace } @@ -85,7 +85,7 @@ public class RecursiveManifestLoader: RecursiveManifestLoading { ) } - public func loadAndMergePackageProjects(in loadedWorkspace: LoadedWorkspace, packageSettings: XcodeGraph.PackageSettings) + public func loadAndMergePackageProjects(in loadedWorkspace: LoadedWorkspace, packageSettings: TuistCore.PackageSettings) throws -> LoadedWorkspace { let generatorPaths = GeneratorPaths(manifestDirectory: loadedWorkspace.path) @@ -120,7 +120,7 @@ public class RecursiveManifestLoader: RecursiveManifestLoading { private func loadPackageProjects( paths: [AbsolutePath], - packageSettings: XcodeGraph.PackageSettings? + packageSettings: TuistCore.PackageSettings? ) throws -> LoadedProjects { guard let packageSettings else { return LoadedProjects(projects: [:]) } var cache = [AbsolutePath: ProjectDescription.Project]() diff --git a/Sources/TuistLoader/Loaders/SwiftPackageManagerGraphLoader.swift b/Sources/TuistLoader/Loaders/SwiftPackageManagerGraphLoader.swift index 717d134b07c..0bc42be5043 100644 --- a/Sources/TuistLoader/Loaders/SwiftPackageManagerGraphLoader.swift +++ b/Sources/TuistLoader/Loaders/SwiftPackageManagerGraphLoader.swift @@ -48,7 +48,7 @@ public protocol SwiftPackageManagerGraphLoading { /// dependencies. func load( packagePath: AbsolutePath, - packageSettings: XcodeGraph.PackageSettings + packageSettings: TuistCore.PackageSettings ) throws -> TuistCore.DependenciesGraph } @@ -73,7 +73,7 @@ public final class SwiftPackageManagerGraphLoader: SwiftPackageManagerGraphLoadi // swiftlint:disable:next function_body_length public func load( packagePath: AbsolutePath, - packageSettings: XcodeGraph.PackageSettings + packageSettings: TuistCore.PackageSettings ) throws -> TuistCore.DependenciesGraph { let path = packagePath.parentDirectory.appending( component: Constants.SwiftPackageManager.packageBuildDirectoryName diff --git a/Sources/TuistLoader/Loaders/TemplateGitLoader.swift b/Sources/TuistLoader/Loaders/TemplateGitLoader.swift index 5799feb1912..5b5325ce18f 100644 --- a/Sources/TuistLoader/Loaders/TemplateGitLoader.swift +++ b/Sources/TuistLoader/Loaders/TemplateGitLoader.swift @@ -1,3 +1,4 @@ +import TuistCore import TuistSupport import XcodeGraph @@ -7,7 +8,7 @@ public protocol TemplateGitLoading { /// - Parameters: /// - templateURL: Git repository url /// - closure: Closure to perform work on loaded template - func loadTemplate(from templateURL: String, closure: (XcodeGraph.Template) throws -> Void) throws + func loadTemplate(from templateURL: String, closure: (TuistCore.Template) throws -> Void) throws } public final class TemplateGitLoader: TemplateGitLoading { @@ -38,7 +39,7 @@ public final class TemplateGitLoader: TemplateGitLoading { self.templateLocationParser = templateLocationParser } - public func loadTemplate(from templateURL: String, closure: (XcodeGraph.Template) throws -> Void) throws { + public func loadTemplate(from templateURL: String, closure: (TuistCore.Template) throws -> Void) throws { let repoURL = templateLocationParser.parseRepositoryURL(from: templateURL) let repoBranch = templateLocationParser.parseRepositoryBranch(from: templateURL) try fileHandler.inTemporaryDirectory { temporaryPath in diff --git a/Sources/TuistLoader/Loaders/TemplateLoader.swift b/Sources/TuistLoader/Loaders/TemplateLoader.swift index 40730fbc66d..c267548195d 100644 --- a/Sources/TuistLoader/Loaders/TemplateLoader.swift +++ b/Sources/TuistLoader/Loaders/TemplateLoader.swift @@ -11,7 +11,7 @@ public protocol TemplateLoading { /// - path: Path of template manifest file `name_of_template.swift` /// - plugins: List of available plugins. /// - Returns: Loaded `TuistScaffold.Template` - func loadTemplate(at path: AbsolutePath, plugins: Plugins) throws -> XcodeGraph.Template + func loadTemplate(at path: AbsolutePath, plugins: Plugins) throws -> TuistCore.Template } public class TemplateLoader: TemplateLoading { @@ -26,28 +26,28 @@ public class TemplateLoader: TemplateLoading { self.manifestLoader = manifestLoader } - public func loadTemplate(at path: AbsolutePath, plugins: Plugins) throws -> XcodeGraph.Template { + public func loadTemplate(at path: AbsolutePath, plugins: Plugins) throws -> TuistCore.Template { try manifestLoader.register(plugins: plugins) let template = try manifestLoader.loadTemplate(at: path) let generatorPaths = GeneratorPaths(manifestDirectory: path) - return try XcodeGraph.Template.from( + return try TuistCore.Template.from( manifest: template, generatorPaths: generatorPaths ) } } -extension XcodeGraph.Template { - static func from(manifest: ProjectDescription.Template, generatorPaths: GeneratorPaths) throws -> XcodeGraph.Template { - let attributes = try manifest.attributes.map(XcodeGraph.Template.Attribute.from) +extension TuistCore.Template { + static func from(manifest: ProjectDescription.Template, generatorPaths: GeneratorPaths) throws -> TuistCore.Template { + let attributes = try manifest.attributes.map(TuistCore.Template.Attribute.from) let items = try manifest.items.map { Item( path: try RelativePath(validating: $0.path), - contents: try XcodeGraph.Template.Contents.from( + contents: try TuistCore.Template.Contents.from( manifest: $0.contents, generatorPaths: generatorPaths ) ) } - return XcodeGraph.Template( + return TuistCore.Template( description: manifest.description, attributes: attributes, items: items @@ -55,8 +55,8 @@ extension XcodeGraph.Template { } } -extension XcodeGraph.Template.Attribute { - static func from(manifest: ProjectDescription.Template.Attribute) throws -> XcodeGraph.Template.Attribute { +extension TuistCore.Template.Attribute { + static func from(manifest: ProjectDescription.Template.Attribute) throws -> TuistCore.Template.Attribute { switch manifest { case let .required(name): return .required(name) @@ -66,8 +66,8 @@ extension XcodeGraph.Template.Attribute { } } -extension XcodeGraph.Template.Attribute.Value { - static func from(value: ProjectDescription.Template.Attribute.Value) throws -> XcodeGraph.Template.Attribute.Value { +extension TuistCore.Template.Attribute.Value { + static func from(value: ProjectDescription.Template.Attribute.Value) throws -> TuistCore.Template.Attribute.Value { switch value { case let .string(string): return .string(string) @@ -78,23 +78,23 @@ extension XcodeGraph.Template.Attribute.Value { case let .boolean(boolean): return .boolean(boolean) case let .dictionary(dictionary): - var newDictionary: [String: XcodeGraph.Template.Attribute.Value] = [:] + var newDictionary: [String: TuistCore.Template.Attribute.Value] = [:] for (key, value) in dictionary { newDictionary[key] = try from(value: value) } return .dictionary(newDictionary) case let .array(array): - let newArray: [XcodeGraph.Template.Attribute.Value] = try array.map { try from(value: $0) } + let newArray: [TuistCore.Template.Attribute.Value] = try array.map { try from(value: $0) } return .array(newArray) } } } -extension XcodeGraph.Template.Contents { +extension TuistCore.Template.Contents { static func from( manifest: ProjectDescription.Template.Contents, generatorPaths: GeneratorPaths - ) throws -> XcodeGraph.Template.Contents { + ) throws -> TuistCore.Template.Contents { switch manifest { case let .string(contents): return .string(contents) diff --git a/Sources/TuistLoader/Models+ManifestMappers/Cloud+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/Cloud+ManifestMapper.swift index e4bd5b9d68f..037a2ed9440 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/Cloud+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/Cloud+ManifestMapper.swift @@ -25,21 +25,21 @@ enum CloudManifestMapperError: FatalError { } } -extension XcodeGraph.Cloud { - static func from(manifest: ProjectDescription.Cloud) throws -> XcodeGraph.Cloud { +extension TuistCore.Cloud { + static func from(manifest: ProjectDescription.Cloud) throws -> TuistCore.Cloud { var cloudURL: URL! if let manifestCloudURL = URL(string: manifest.url.dropSuffix("/")) { cloudURL = manifestCloudURL } else { throw CloudManifestMapperError.invalidCloudURL(manifest.url) } - let options = manifest.options.compactMap(XcodeGraph.Cloud.Option.from) - return XcodeGraph.Cloud(url: cloudURL, projectId: manifest.projectId, options: options) + let options = manifest.options.compactMap(TuistCore.Cloud.Option.from) + return TuistCore.Cloud(url: cloudURL, projectId: manifest.projectId, options: options) } } -extension XcodeGraph.Cloud.Option { - static func from(manifest: ProjectDescription.Cloud.Option) -> XcodeGraph.Cloud.Option? { +extension TuistCore.Cloud.Option { + static func from(manifest: ProjectDescription.Cloud.Option) -> TuistCore.Cloud.Option? { switch manifest { case .optional: return .optional diff --git a/Sources/TuistLoader/Models+ManifestMappers/CompatibleXcodeVersions+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/CompatibleXcodeVersions+ManifestMapper.swift index 3dcb65ee317..c9d65f65f2f 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/CompatibleXcodeVersions+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/CompatibleXcodeVersions+ManifestMapper.swift @@ -3,14 +3,13 @@ import Path import ProjectDescription import TuistCore import TuistSupport -import XcodeGraph -extension XcodeGraph.CompatibleXcodeVersions { +extension TuistCore.CompatibleXcodeVersions { /// Maps a ProjectDescription.CompatibleXcodeVersions instance into a XcodeGraph.CompatibleXcodeVersions model. /// - Parameters: /// - manifest: Manifest representation of compatible Xcode versions. /// - generatorPaths: Generator paths. - static func from(manifest: ProjectDescription.CompatibleXcodeVersions) -> XcodeGraph.CompatibleXcodeVersions { + static func from(manifest: ProjectDescription.CompatibleXcodeVersions) -> TuistCore.CompatibleXcodeVersions { switch manifest { case .all: return .all diff --git a/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift index cc0d892129a..d13f3599cc0 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/Config+ManifestMapper.swift @@ -6,18 +6,18 @@ import TuistCore import TuistSupport import XcodeGraph -extension XcodeGraph.Config { +extension TuistCore.Config { /// Maps a ProjectDescription.Config instance into a XcodeGraph.Config model. /// - Parameters: /// - manifest: Manifest representation of Tuist config. /// - path: The path of the config file. - static func from(manifest: ProjectDescription.Config, at path: AbsolutePath) throws -> XcodeGraph.Config { + static func from(manifest: ProjectDescription.Config, at path: AbsolutePath) throws -> TuistCore.Config { let generatorPaths = GeneratorPaths(manifestDirectory: path) - let generationOptions = try XcodeGraph.Config.GenerationOptions.from( + let generationOptions = try TuistCore.Config.GenerationOptions.from( manifest: manifest.generationOptions, generatorPaths: generatorPaths ) - let compatibleXcodeVersions = XcodeGraph.CompatibleXcodeVersions.from(manifest: manifest.compatibleXcodeVersions) + let compatibleXcodeVersions = TuistCore.CompatibleXcodeVersions.from(manifest: manifest.compatibleXcodeVersions) let plugins = try manifest.plugins.map { try PluginLocation.from(manifest: $0, generatorPaths: generatorPaths) } let swiftVersion: TSCUtility.Version? if let configuredVersion = manifest.swiftVersion { @@ -26,12 +26,12 @@ extension XcodeGraph.Config { swiftVersion = nil } - var cloud: XcodeGraph.Cloud? + var cloud: TuistCore.Cloud? if let manifestCloud = manifest.cloud { - cloud = try XcodeGraph.Cloud.from(manifest: manifestCloud) + cloud = try TuistCore.Cloud.from(manifest: manifestCloud) } - return XcodeGraph.Config( + return TuistCore.Config( compatibleXcodeVersions: compatibleXcodeVersions, cloud: cloud, swiftVersion: swiftVersion.map { .init(stringLiteral: $0.description) }, @@ -42,7 +42,7 @@ extension XcodeGraph.Config { } } -extension XcodeGraph.Config.GenerationOptions { +extension TuistCore.Config.GenerationOptions { /// Maps a ProjectDescription.Config.GenerationOptions instance into a XcodeGraph.Config.GenerationOptions model. /// - Parameters: /// - manifest: Manifest representation of Tuist config generation options @@ -50,7 +50,7 @@ extension XcodeGraph.Config.GenerationOptions { static func from( manifest: ProjectDescription.Config.GenerationOptions, generatorPaths: GeneratorPaths - ) throws -> XcodeGraph.Config.GenerationOptions { + ) throws -> TuistCore.Config.GenerationOptions { let clonedSourcePackagesDirPath: AbsolutePath? = try { if let path = manifest.clonedSourcePackagesDirPath { return try generatorPaths.resolve(path: path) @@ -62,7 +62,7 @@ extension XcodeGraph.Config.GenerationOptions { resolveDependenciesWithSystemScm: manifest.resolveDependenciesWithSystemScm, disablePackageVersionLocking: manifest.disablePackageVersionLocking, clonedSourcePackagesDirPath: clonedSourcePackagesDirPath, - staticSideEffectsWarningTargets: XcodeGraph.Config.GenerationOptions.StaticSideEffectsWarningTargets + staticSideEffectsWarningTargets: TuistCore.Config.GenerationOptions.StaticSideEffectsWarningTargets .from(manifest: manifest.staticSideEffectsWarningTargets), enforceExplicitDependencies: manifest.enforceExplicitDependencies, defaultConfiguration: manifest.defaultConfiguration @@ -70,14 +70,14 @@ extension XcodeGraph.Config.GenerationOptions { } } -extension XcodeGraph.Config.GenerationOptions.StaticSideEffectsWarningTargets { +extension TuistCore.Config.GenerationOptions.StaticSideEffectsWarningTargets { /// Maps a ProjectDescription.Config.GenerationOptions.StaticSideEffectsWarningTargets instance into a /// XcodeGraph.Config.GenerationOptions.StaticSideEffectsWarningTargets model. /// - Parameters: /// - manifest: Manifest representation of Tuist config static side effects warning targets option static func from( manifest: ProjectDescription.Config.GenerationOptions.StaticSideEffectsWarningTargets - ) -> XcodeGraph.Config.GenerationOptions.StaticSideEffectsWarningTargets { + ) -> TuistCore.Config.GenerationOptions.StaticSideEffectsWarningTargets { switch manifest { case .all: return .all case .none: return .none diff --git a/Sources/TuistLoader/Models+ManifestMappers/PackageSettings+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/PackageSettings+ManifestMapper.swift index a99a2b967b4..c0ca642c35e 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/PackageSettings+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/PackageSettings+ManifestMapper.swift @@ -6,7 +6,7 @@ import TuistCore import TuistSupport import XcodeGraph -extension XcodeGraph.PackageSettings { +extension TuistCore.PackageSettings { /// Creates `XcodeGraph.PackageSettings` instance from `ProjectDescription.PackageSettings` /// instance. static func from( diff --git a/Sources/TuistLoader/Models+ManifestMappers/PluginLocation+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/PluginLocation+ManifestMapper.swift index 3069aedf71c..d5c40208fb5 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/PluginLocation+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/PluginLocation+ManifestMapper.swift @@ -1,13 +1,13 @@ import Foundation import ProjectDescription -import XcodeGraph +import TuistCore -extension XcodeGraph.PluginLocation { +extension TuistCore.PluginLocation { /// Convert from `ProjectDescription.PluginLocation` to `XcodeGraph.PluginLocation` static func from( manifest: ProjectDescription.PluginLocation, generatorPaths: GeneratorPaths - ) throws -> XcodeGraph.PluginLocation { + ) throws -> TuistCore.PluginLocation { switch manifest.type { case let .local(path): return .local(path: try generatorPaths.resolve(path: path).pathString) diff --git a/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift index 9400bbc4907..2290fbc7891 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/Project+ManifestMapper.swift @@ -1,6 +1,7 @@ import Foundation import Path import ProjectDescription +import TuistCore import XcodeGraph extension XcodeGraph.Project { diff --git a/Sources/TuistLoader/Models+ManifestMappers/ResourceSynthesizer+ManifestMapper.swift b/Sources/TuistLoader/Models+ManifestMappers/ResourceSynthesizer+ManifestMapper.swift index f362cde38c1..945db504356 100644 --- a/Sources/TuistLoader/Models+ManifestMappers/ResourceSynthesizer+ManifestMapper.swift +++ b/Sources/TuistLoader/Models+ManifestMappers/ResourceSynthesizer+ManifestMapper.swift @@ -1,5 +1,6 @@ import Path import ProjectDescription +import TuistCore import XcodeGraph extension XcodeGraph.ResourceSynthesizer { diff --git a/Sources/TuistLoader/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilder.swift b/Sources/TuistLoader/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilder.swift index 15e7d540654..83fa112b9a8 100644 --- a/Sources/TuistLoader/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilder.swift +++ b/Sources/TuistLoader/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilder.swift @@ -1,7 +1,7 @@ import Foundation import Path +import TuistCore import TuistSupport -import XcodeGraph /// This protocol defines the interface to compile a temporary module with the /// helper files under /Tuist/ProjectDescriptionHelpers that can be imported @@ -19,7 +19,7 @@ public protocol ProjectDescriptionHelpersBuilding: AnyObject { func build( at path: AbsolutePath, projectDescriptionSearchPaths: ProjectDescriptionSearchPaths, - projectDescriptionHelperPlugins: [ProjectDescriptionHelpersPlugin] + projectDescriptionHelperPlugins: [TuistCore.ProjectDescriptionHelpersPlugin] ) throws -> [ProjectDescriptionHelpersModule] /// Builds all the plugin helpers module and returns the location to the built modules. diff --git a/Sources/TuistLoader/SwiftPackageManager/PackageInfoMapper.swift b/Sources/TuistLoader/SwiftPackageManager/PackageInfoMapper.swift index 942bb06429a..be6a8f5a5f4 100644 --- a/Sources/TuistLoader/SwiftPackageManager/PackageInfoMapper.swift +++ b/Sources/TuistLoader/SwiftPackageManager/PackageInfoMapper.swift @@ -111,7 +111,7 @@ public protocol PackageInfoMapping { packageInfo: PackageInfo, path: AbsolutePath, packageType: PackageType, - packageSettings: XcodeGraph.PackageSettings, + packageSettings: TuistCore.PackageSettings, packageToProject: [String: AbsolutePath] ) throws -> ProjectDescription.Project? } @@ -257,7 +257,7 @@ public final class PackageInfoMapper: PackageInfoMapping { packageInfo: PackageInfo, path: AbsolutePath, packageType: PackageType, - packageSettings: XcodeGraph.PackageSettings, + packageSettings: TuistCore.PackageSettings, packageToProject _: [String: AbsolutePath] ) throws -> ProjectDescription.Project? { // Hardcoded mapping for some well known libraries, until the logic can handle those properly diff --git a/Sources/TuistLoader/Utils/ResourceSynthesizerPathLocator.swift b/Sources/TuistLoader/Utils/ResourceSynthesizerPathLocator.swift index 1cefed97065..77a9ddd50d7 100644 --- a/Sources/TuistLoader/Utils/ResourceSynthesizerPathLocator.swift +++ b/Sources/TuistLoader/Utils/ResourceSynthesizerPathLocator.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import TuistSupport -import XcodeGraph public protocol ResourceSynthesizerPathLocating { func locate(at: AbsolutePath) -> AbsolutePath? @@ -10,7 +9,7 @@ public protocol ResourceSynthesizerPathLocating { func templatePath( for pluginName: String, resourceName: String, - resourceSynthesizerPlugins: [PluginResourceSynthesizer] + resourceSynthesizerPlugins: [TuistCore.PluginResourceSynthesizer] ) throws -> AbsolutePath func templatePath( diff --git a/Sources/TuistLoaderTesting/Loaders/Mocks/MockManifestLoader.swift b/Sources/TuistLoaderTesting/Loaders/Mocks/MockManifestLoader.swift index 3ccfde98967..ab9a0cf1df8 100644 --- a/Sources/TuistLoaderTesting/Loaders/Mocks/MockManifestLoader.swift +++ b/Sources/TuistLoaderTesting/Loaders/Mocks/MockManifestLoader.swift @@ -1,8 +1,8 @@ import Foundation import Path import ProjectDescription +import struct TuistCore.Plugins import TuistSupport -import struct XcodeGraph.Plugins @testable import TuistLoader @testable import TuistSupportTesting diff --git a/Sources/TuistLoaderTesting/Loaders/Mocks/MockPackageSettingsLoader.swift b/Sources/TuistLoaderTesting/Loaders/Mocks/MockPackageSettingsLoader.swift index b23a4dd543c..ee0d51f97f7 100644 --- a/Sources/TuistLoaderTesting/Loaders/Mocks/MockPackageSettingsLoader.swift +++ b/Sources/TuistLoaderTesting/Loaders/Mocks/MockPackageSettingsLoader.swift @@ -1,7 +1,6 @@ import Path +import TuistCore import TuistSupport -import XcodeGraph -import XcodeGraphTesting @testable import TuistLoader diff --git a/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateGitLoader.swift b/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateGitLoader.swift index a162400c28b..f9d5f615cda 100644 --- a/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateGitLoader.swift +++ b/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateGitLoader.swift @@ -1,7 +1,7 @@ import Foundation import Path +import TuistCore import TuistLoader -import XcodeGraph public final class MockTemplateGitLoader: TemplateGitLoading { public var loadTemplateStub: ((String) throws -> Template)? diff --git a/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateLoader.swift b/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateLoader.swift index 74116dbb7f7..8d5f2baeae2 100644 --- a/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateLoader.swift +++ b/Sources/TuistLoaderTesting/Loaders/Mocks/MockTemplateLoader.swift @@ -1,7 +1,7 @@ import Foundation import Path +import TuistCore import TuistLoader -import XcodeGraph public final class MockTemplateLoader: TemplateLoading { public var loadTemplateStub: ((AbsolutePath) throws -> Template)? diff --git a/Sources/TuistLoaderTesting/ProjectDescriptionHelpers/MockProjectDescriptionHelpersBuilder.swift b/Sources/TuistLoaderTesting/ProjectDescriptionHelpers/MockProjectDescriptionHelpersBuilder.swift index c517bb82e93..c3e2207dbac 100644 --- a/Sources/TuistLoaderTesting/ProjectDescriptionHelpers/MockProjectDescriptionHelpersBuilder.swift +++ b/Sources/TuistLoaderTesting/ProjectDescriptionHelpers/MockProjectDescriptionHelpersBuilder.swift @@ -1,7 +1,7 @@ import Foundation import Path +import TuistCore import TuistSupport -import XcodeGraph @testable import TuistLoader diff --git a/Sources/TuistLoaderTesting/Utils/Mocks/MockResourceSynthesizerPathLocator.swift b/Sources/TuistLoaderTesting/Utils/Mocks/MockResourceSynthesizerPathLocator.swift index ef43e9b7bf4..3ce9c86d88c 100644 --- a/Sources/TuistLoaderTesting/Utils/Mocks/MockResourceSynthesizerPathLocator.swift +++ b/Sources/TuistLoaderTesting/Utils/Mocks/MockResourceSynthesizerPathLocator.swift @@ -1,6 +1,6 @@ import Foundation import Path -import XcodeGraph +import TuistCore @testable import TuistLoader public final class MockResourceSynthesizerPathLocator: ResourceSynthesizerPathLocating { diff --git a/Sources/TuistPlugin/PluginService.swift b/Sources/TuistPlugin/PluginService.swift index d28f2755eb2..1f69570b9dd 100644 --- a/Sources/TuistPlugin/PluginService.swift +++ b/Sources/TuistPlugin/PluginService.swift @@ -4,7 +4,6 @@ import TuistCore import TuistLoader import TuistScaffold import TuistSupport -import XcodeGraph /// Paths to remote plugin's code and artifacts. public struct RemotePluginPaths: Equatable, Hashable { diff --git a/Sources/TuistPluginTesting/MockPluginService.swift b/Sources/TuistPluginTesting/MockPluginService.swift index 53ace9af5a9..3849e1f12bb 100644 --- a/Sources/TuistPluginTesting/MockPluginService.swift +++ b/Sources/TuistPluginTesting/MockPluginService.swift @@ -1,5 +1,5 @@ +import TuistCore import TuistPlugin -import XcodeGraph public final class MockPluginService: PluginServicing { public init() {} diff --git a/Sources/TuistScaffold/TemplateGenerator.swift b/Sources/TuistScaffold/TemplateGenerator.swift index c2dbaf1e804..cbd05bca939 100644 --- a/Sources/TuistScaffold/TemplateGenerator.swift +++ b/Sources/TuistScaffold/TemplateGenerator.swift @@ -4,7 +4,6 @@ import PathKit import StencilSwiftKit import TuistCore import TuistSupport -import XcodeGraph /// Interface for generating content defined in template manifest public protocol TemplateGenerating { @@ -16,7 +15,7 @@ public protocol TemplateGenerating { func generate( template: Template, to destinationPath: AbsolutePath, - attributes: [String: XcodeGraph.Template.Attribute.Value] + attributes: [String: Template.Attribute.Value] ) throws } @@ -27,7 +26,7 @@ public final class TemplateGenerator: TemplateGenerating { public func generate( template: Template, to destinationPath: AbsolutePath, - attributes: [String: XcodeGraph.Template.Attribute.Value] + attributes: [String: Template.Attribute.Value] ) throws { let renderedItems = try renderItems( template: template, @@ -50,7 +49,7 @@ public final class TemplateGenerator: TemplateGenerating { /// Renders items' paths in format path_to_dir/{{ attribute_name }} with `attributes` private func renderItems( template: Template, - attributes: [String: XcodeGraph.Template.Attribute.Value] + attributes: [String: Template.Attribute.Value] ) throws -> [Template.Item] { let environment = stencilSwiftEnvironment() return try template.items.map { @@ -103,7 +102,7 @@ public final class TemplateGenerator: TemplateGenerating { /// Generate all `renderedItems` private func generateItems( renderedItems: [Template.Item], - attributes: [String: XcodeGraph.Template.Attribute.Value], + attributes: [String: Template.Attribute.Value], destinationPath: AbsolutePath ) throws { let environment = stencilSwiftEnvironment() @@ -156,7 +155,7 @@ public final class TemplateGenerator: TemplateGenerating { } } -extension [String: XcodeGraph.Template.Attribute.Value] { +extension [String: Template.Attribute.Value] { fileprivate var toStringAny: [String: Any] { reduce([:]) { partialResult, attribute in var result: [String: Any] = partialResult diff --git a/Sources/TuistScaffoldTesting/Utils/Mocks/MockTemplateGenerator.swift b/Sources/TuistScaffoldTesting/Utils/Mocks/MockTemplateGenerator.swift index 960d8a5336d..7027ca5eea9 100644 --- a/Sources/TuistScaffoldTesting/Utils/Mocks/MockTemplateGenerator.swift +++ b/Sources/TuistScaffoldTesting/Utils/Mocks/MockTemplateGenerator.swift @@ -1,17 +1,16 @@ import Foundation import Path -import XcodeGraph +import TuistCore -@testable import TuistCore @testable import TuistScaffold public final class MockTemplateGenerator: TemplateGenerating { - public var generateStub: ((Template, AbsolutePath, [String: XcodeGraph.Template.Attribute.Value]) throws -> Void)? + public var generateStub: ((Template, AbsolutePath, [String: TuistCore.Template.Attribute.Value]) throws -> Void)? public func generate( template: Template, to destinationPath: AbsolutePath, - attributes: [String: XcodeGraph.Template.Attribute.Value] + attributes: [String: TuistCore.Template.Attribute.Value] ) throws { try generateStub?(template, destinationPath, attributes) } diff --git a/Sources/TuistServer/Cache/EmptyCacheStorageFactory.swift b/Sources/TuistServer/Cache/EmptyCacheStorageFactory.swift index ff4701308b7..3cdb04c36a2 100644 --- a/Sources/TuistServer/Cache/EmptyCacheStorageFactory.swift +++ b/Sources/TuistServer/Cache/EmptyCacheStorageFactory.swift @@ -1,5 +1,5 @@ import Foundation -import XcodeGraph +import TuistCore public final class EmptyCacheStorageFactory: CacheStorageFactorying { public init() {} diff --git a/Sources/XcodeGraph/DependenciesGraph/DependenciesGraph.swift b/Sources/XcodeGraph/DependenciesGraph/DependenciesGraph.swift deleted file mode 100644 index f9927f0ac35..00000000000 --- a/Sources/XcodeGraph/DependenciesGraph/DependenciesGraph.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Path -import TuistSupport - -/// A directed acyclic graph (DAG) that Tuist uses to represent the dependency tree. -public struct DependenciesGraph: Equatable, Codable { - /// A dictionary where the keys are the supported platforms and the values are dictionaries where the keys are the names of - /// dependencies, and the values are the dependencies themselves. - public let externalDependencies: [String: [TargetDependency]] - - /// A dictionary where the keys are the folder of external projects, and the values are the projects themselves. - public let externalProjects: [AbsolutePath: Project] - - /// Create an instance of `DependenciesGraph` model. - public init(externalDependencies: [String: [TargetDependency]], externalProjects: [AbsolutePath: Project]) { - self.externalDependencies = externalDependencies - self.externalProjects = externalProjects - } - - /// An empty `DependenciesGraph`. - public static let none: DependenciesGraph = .init(externalDependencies: [:], externalProjects: [:]) -} diff --git a/Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift b/Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift deleted file mode 100644 index e132261208a..00000000000 --- a/Sources/XcodeGraph/Graph/ConditionalGraphTarget.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import Path - -public struct GraphTargetReference: Equatable, Comparable, Hashable, CustomDebugStringConvertible, CustomStringConvertible, - Codable -{ - /// Path to the directory that contains the project where the target is defined. - public let graphTarget: GraphTarget - - public var target: Target { graphTarget.target } - - /// Platforms the target is conditionally deployed to. - public let condition: PlatformCondition? - - public init(target: GraphTarget, condition: PlatformCondition? = nil) { - graphTarget = target - self.condition = condition - } - - public static func < (lhs: GraphTargetReference, rhs: GraphTargetReference) -> Bool { - lhs.graphTarget < rhs.graphTarget -// guard let -// return (lhs.condition, lhs.graphTarget) < (rhs.condtion, rhs.graphTarget) -// -// -// switch (lhs.condition, rhs.condition) { -// case (let lhsCondtion, let rhsCondtion): -// return (lhsCondition, lhs.graphTarget) < (rhsCondtion, rhs.graphTarget) -// case -// } - } - - // MARK: - CustomDebugStringConvertible/CustomStringConvertible - - public var debugDescription: String { - description - } - - public var description: String { - "Target '\(target.name)' at path '\(graphTarget.project.path)'" - } -} - -// -// extension GraphTarget { -// public func reference(_ condition: PlatformCondition?) -> GraphTargetReference { -// return GraphTargetReference(target: self, condition: condition) -// } -// } diff --git a/Sources/XcodeGraph/Graph/Graph.swift b/Sources/XcodeGraph/Graph/Graph.swift deleted file mode 100644 index 033b95abe50..00000000000 --- a/Sources/XcodeGraph/Graph/Graph.swift +++ /dev/null @@ -1,67 +0,0 @@ -import Foundation -import Path - -/// A directed acyclic graph (DAG) that Tuist uses to represent the dependency tree. -public struct Graph: Equatable, Codable { - /// The name of the graph - public var name: String - - /// The path where the graph has been loaded from. - public var path: AbsolutePath - - /// Graph's workspace. - public var workspace: Workspace - - /// A dictionary where the keys are the paths to the directories where the projects are defined, - /// and the values are the projects defined in the directories. - public var projects: [AbsolutePath: Project] - - /// A dictionary where the keys are paths to the directories where the projects that contain packages are defined, - /// and the values are dictionaries where the key is the reference to the package, and the values are the packages. - public var packages: [AbsolutePath: [String: Package]] - - /// A dictionary that contains the one-to-many dependencies that represent the graph. - public var dependencies: [GraphDependency: Set] - - /// A dictionary that contains the Conditions to apply to a dependency relationship - public var dependencyConditions: [GraphEdge: PlatformCondition] - - public init( - name: String, - path: AbsolutePath, - workspace: Workspace, - projects: [AbsolutePath: Project], - packages: [AbsolutePath: [String: Package]], - dependencies: [GraphDependency: Set], - dependencyConditions: [GraphEdge: PlatformCondition] - ) { - self.name = name - self.path = path - self.workspace = workspace - self.projects = projects - self.packages = packages - self.dependencies = dependencies - self.dependencyConditions = dependencyConditions - } -} - -/// Convenience accessors to work with `GraphTarget` and `GraphDependency` types while traversing the graph -extension [GraphEdge: PlatformCondition] { - public subscript(_ edge: (GraphDependency, GraphDependency)) -> PlatformCondition? { - get { - self[GraphEdge(from: edge.0, to: edge.1)] - } - set { - self[GraphEdge(from: edge.0, to: edge.1)] = newValue - } - } - - public subscript(_ edge: (GraphDependency, GraphTarget)) -> PlatformCondition? { - get { - self[GraphEdge(from: edge.0, to: edge.1)] - } - set { - self[GraphEdge(from: edge.0, to: edge.1)] = newValue - } - } -} diff --git a/Sources/XcodeGraph/Graph/GraphDependency.swift b/Sources/XcodeGraph/Graph/GraphDependency.swift deleted file mode 100644 index 870b73c4cce..00000000000 --- a/Sources/XcodeGraph/Graph/GraphDependency.swift +++ /dev/null @@ -1,284 +0,0 @@ -import Foundation -import Path - -public enum GraphDependency: Hashable, CustomStringConvertible, Comparable, Codable { - public struct XCFramework: Hashable, CustomStringConvertible, Comparable, Codable { - public let path: AbsolutePath - public let infoPlist: XCFrameworkInfoPlist - public let primaryBinaryPath: AbsolutePath - public let linking: BinaryLinking - public let mergeable: Bool - public let status: FrameworkStatus - - public init( - path: AbsolutePath, - infoPlist: XCFrameworkInfoPlist, - primaryBinaryPath: AbsolutePath, - linking: BinaryLinking, - mergeable: Bool, - status: FrameworkStatus, - macroPath _: AbsolutePath? - ) { - self.path = path - self.infoPlist = infoPlist - self.primaryBinaryPath = primaryBinaryPath - self.linking = linking - self.mergeable = mergeable - self.status = status - } - - public var description: String { - "xcframework '\(path.basename)'" - } - - public static func < (lhs: GraphDependency.XCFramework, rhs: GraphDependency.XCFramework) -> Bool { - lhs.description < rhs.description - } - } - - public enum PackageProductType: String, Hashable, CustomStringConvertible, Comparable, Codable { - public var description: String { - rawValue - } - - case runtime = "runtime package product" - case plugin = "plugin package product" - case macro = "macro package product" - - public static func < (lhs: PackageProductType, rhs: PackageProductType) -> Bool { - lhs.description < rhs.description - } - } - - case xcframework(GraphDependency.XCFramework) - - /// A dependency that represents a pre-compiled framework. - case framework( - path: AbsolutePath, - binaryPath: AbsolutePath, - dsymPath: AbsolutePath?, - bcsymbolmapPaths: [AbsolutePath], - linking: BinaryLinking, - architectures: [BinaryArchitecture], - status: FrameworkStatus - ) - - /// A dependency that represents a pre-compiled library. - case library( - path: AbsolutePath, - publicHeaders: AbsolutePath, - linking: BinaryLinking, - architectures: [BinaryArchitecture], - swiftModuleMap: AbsolutePath? - ) - - /// A macOS executable that represents a macro - case macro(path: AbsolutePath) - - /// A dependency that represents a pre-compiled bundle. - case bundle(path: AbsolutePath) - - /// A dependency that represents a package product. - case packageProduct(path: AbsolutePath, product: String, type: PackageProductType) - - /// A dependency that represents a target that is defined in the project at the given path. - case target(name: String, path: AbsolutePath) - - /// A dependency that represents an SDK - case sdk(name: String, path: AbsolutePath, status: SDKStatus, source: SDKSource) - - public func hash(into hasher: inout Hasher) { - switch self { - case let .macro(path): - hasher.combine(path) - case let .xcframework(xcframework): - hasher.combine(xcframework) - case let .framework(path, _, _, _, _, _, _): - hasher.combine("framework") - hasher.combine(path) - case let .library(path, _, _, _, _): - hasher.combine("library") - hasher.combine(path) - case let .bundle(path): - hasher.combine("bundle") - hasher.combine(path) - case let .packageProduct(path, product, isPlugin): - hasher.combine("package") - hasher.combine(path) - hasher.combine(product) - hasher.combine(isPlugin) - case let .target(name, path): - hasher.combine("target") - hasher.combine(name) - hasher.combine(path) - case let .sdk(name, path, status, source): - hasher.combine("sdk") - hasher.combine(name) - hasher.combine(path) - hasher.combine(status) - hasher.combine(source) - } - } - - public var isTarget: Bool { - switch self { - case .macro: return false - case .xcframework: return false - case .framework: return false - case .library: return false - case .bundle: return false - case .packageProduct: return false - case .target: return true - case .sdk: return false - } - } - - /** - When the graph dependency represents a pre-compiled static binary. - */ - public var isStaticPrecompiled: Bool { - switch self { - case .macro: return false - case let .xcframework(xcframework): - return xcframework.linking == .static - case let .framework(_, _, _, _, linking, _, _), - let .library(_, _, linking, _, _): return linking == .static - case .bundle: return false - case .packageProduct: return false - case .target: return false - case .sdk: return false - } - } - - /** - When the graph dependency represents a dynamic precompiled binary, it returns true. - */ - public var isDynamicPrecompiled: Bool { - switch self { - case .macro: return false - case let .xcframework(xcframework): - return xcframework.linking == .dynamic - case let .framework(_, _, _, _, linking, _, _), - let .library(_, _, linking, _, _): return linking == .dynamic - case .bundle: return false - case .packageProduct: return false - case .target: return false - case .sdk: return false - } - } - - public var isPrecompiled: Bool { - switch self { - case .macro: return true - case .xcframework: return true - case .framework: return true - case .library: return true - case .bundle: return true - case .packageProduct: return false - case .target: return false - case .sdk: return false - } - } - - public var isLinkable: Bool { - switch self { - case .macro: return false - case .xcframework: return true - case .framework: return true - case .library: return true - case .bundle: return false - case .packageProduct: return true - case .target: return true - case .sdk: return true - } - } - - public var isPrecompiledMacro: Bool { - switch self { - case .macro: return true - case .xcframework: return false - case .framework: return false - case .library: return false - case .bundle: return false - case .packageProduct: return false - case .target: return false - case .sdk: return false - } - } - - public var isPrecompiledDynamicAndLinkable: Bool { - switch self { - case .macro: return false - case let .xcframework(xcframework): - return xcframework.linking == .dynamic - case let .framework(_, _, _, _, linking, _, _), - let .library(path: _, publicHeaders: _, linking: linking, architectures: _, swiftModuleMap: _): - return linking == .dynamic - case .bundle: return false - case .packageProduct: return false - case .target: return false - case .sdk: return false - } - } - - // MARK: - Internal - - public var targetDependency: (name: String, path: AbsolutePath)? { - switch self { - case let .target(name: name, path: path): - return (name, path) - default: - return nil - } - } - - // MARK: - CustomStringConvertible - - public var description: String { - switch self { - case .macro: - return "macro '\(name)'" - case .xcframework: - return "xcframework '\(name)'" - case .framework: - return "framework '\(name)'" - case .library: - return "library '\(name)'" - case .bundle: - return "bundle '\(name)'" - case .packageProduct: - return "package '\(name)'" - case .target: - return "target '\(name)'" - case .sdk: - return "sdk '\(name)'" - } - } - - public var name: String { - switch self { - case let .macro(path): - return path.basename - case let .xcframework(xcframework): - return xcframework.path.basename - case let .framework(path, _, _, _, _, _, _): - return path.basename - case let .library(path, _, _, _, _): - return path.basename - case let .bundle(path): - return path.basename - case let .packageProduct(_, product, _): - return product - case let .target(name, _): - return name - case let .sdk(name, _, _, _): - return name - } - } - - // MARK: - Comparable - - public static func < (lhs: GraphDependency, rhs: GraphDependency) -> Bool { - lhs.description < rhs.description - } -} diff --git a/Sources/XcodeGraph/Graph/GraphTarget.swift b/Sources/XcodeGraph/Graph/GraphTarget.swift deleted file mode 100644 index a2126db3812..00000000000 --- a/Sources/XcodeGraph/Graph/GraphTarget.swift +++ /dev/null @@ -1,33 +0,0 @@ -import Foundation -import Path - -public struct GraphTarget: Equatable, Hashable, Comparable, CustomDebugStringConvertible, CustomStringConvertible, Codable { - /// Path to the directory that contains the project where the target is defined. - public let path: AbsolutePath - - /// Target representation. - public let target: Target - - /// Project that contains the target. - public let project: Project - - public init(path: AbsolutePath, target: Target, project: Project) { - self.path = path - self.target = target - self.project = project - } - - public static func < (lhs: GraphTarget, rhs: GraphTarget) -> Bool { - (lhs.path, lhs.target) < (rhs.path, rhs.target) - } - - // MARK: - CustomDebugStringConvertible/CustomStringConvertible - - public var debugDescription: String { - description - } - - public var description: String { - "Target '\(target.name)' at path '\(project.path)'" - } -} diff --git a/Sources/XcodeGraph/Models/ArchiveAction.swift b/Sources/XcodeGraph/Models/ArchiveAction.swift deleted file mode 100644 index da727bb996d..00000000000 --- a/Sources/XcodeGraph/Models/ArchiveAction.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation -import Path - -public struct ArchiveAction: Equatable, Codable { - // MARK: - Attributes - - public let configurationName: String - public let revealArchiveInOrganizer: Bool - public let customArchiveName: String? - public let preActions: [ExecutionAction] - public let postActions: [ExecutionAction] - - // MARK: - Init - - public init( - configurationName: String, - revealArchiveInOrganizer: Bool = true, - customArchiveName: String? = nil, - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [] - ) { - self.configurationName = configurationName - self.revealArchiveInOrganizer = revealArchiveInOrganizer - self.customArchiveName = customArchiveName - self.preActions = preActions - self.postActions = postActions - } -} diff --git a/Sources/XcodeGraph/Models/BuildAction.swift b/Sources/XcodeGraph/Models/BuildAction.swift deleted file mode 100644 index e539571ecba..00000000000 --- a/Sources/XcodeGraph/Models/BuildAction.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import Path - -public struct BuildAction: Equatable, Codable { - // MARK: - Attributes - - public var targets: [TargetReference] - public var preActions: [ExecutionAction] - public var postActions: [ExecutionAction] - public var runPostActionsOnFailure: Bool - - // MARK: - Init - - public init( - targets: [TargetReference] = [], - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [], - runPostActionsOnFailure: Bool = false - ) { - self.targets = targets - self.preActions = preActions - self.postActions = postActions - self.runPostActionsOnFailure = runPostActionsOnFailure - } -} diff --git a/Sources/XcodeGraph/Models/CopyFileElement.swift b/Sources/XcodeGraph/Models/CopyFileElement.swift deleted file mode 100644 index 649599e385f..00000000000 --- a/Sources/XcodeGraph/Models/CopyFileElement.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import Path - -public enum CopyFileElement: Equatable, Hashable, Codable { - case file(path: AbsolutePath, condition: PlatformCondition? = nil, codeSignOnCopy: Bool = false) - case folderReference(path: AbsolutePath, condition: PlatformCondition? = nil, codeSignOnCopy: Bool = false) - - public var path: AbsolutePath { - switch self { - case let .file(path, _, _): - return path - case let .folderReference(path, _, _): - return path - } - } - - public var isReference: Bool { - switch self { - case .file: - return false - case .folderReference: - return true - } - } - - public var condition: PlatformCondition? { - switch self { - case let .file(_, condition, _), let .folderReference(_, condition, _): - return condition - } - } - - public var codeSignOnCopy: Bool { - switch self { - case let .file(_, _, codeSignOnCopy), let .folderReference(_, _, codeSignOnCopy): - return codeSignOnCopy - } - } -} diff --git a/Sources/XcodeGraph/Models/CopyFilesAction.swift b/Sources/XcodeGraph/Models/CopyFilesAction.swift deleted file mode 100644 index d61b35d68e3..00000000000 --- a/Sources/XcodeGraph/Models/CopyFilesAction.swift +++ /dev/null @@ -1,43 +0,0 @@ -import Foundation -import Path - -public struct CopyFilesAction: Equatable, Codable { - /// Name of the build phase when the project gets generated. - public var name: String - - /// Destination to copy files to. - public var destination: Destination - - /// Path to a folder inside the destination. - public var subpath: String? - - /// Relative paths to the files to be copied. - public var files: [CopyFileElement] - - /// Destination path. - public enum Destination: String, Equatable, Codable { - case absolutePath - case productsDirectory - case wrapper - case executables - case resources - case javaResources - case frameworks - case sharedFrameworks - case sharedSupport - case plugins - case other - } - - public init( - name: String, - destination: Destination, - subpath: String? = nil, - files: [CopyFileElement] - ) { - self.name = name - self.destination = destination - self.subpath = subpath - self.files = files - } -} diff --git a/Sources/XcodeGraph/Models/CoreDataModel.swift b/Sources/XcodeGraph/Models/CoreDataModel.swift deleted file mode 100644 index b17b74e293c..00000000000 --- a/Sources/XcodeGraph/Models/CoreDataModel.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation -import Path - -/// Represents a Core Data model -public struct CoreDataModel: Equatable, Codable { - // MARK: - Attributes - - /// Relative path to the Core Data model. - public let path: AbsolutePath - - /// Paths to the versions. - public let versions: [AbsolutePath] - - /// Current version without the extension. - public let currentVersion: String - - // MARK: - Init - - public init( - path: AbsolutePath, - versions: [AbsolutePath], - currentVersion: String - ) { - self.path = path - self.versions = versions - self.currentVersion = currentVersion - } -} diff --git a/Sources/XcodeGraph/Models/Dependencies/SwiftPackageManagerDependencies.swift b/Sources/XcodeGraph/Models/Dependencies/SwiftPackageManagerDependencies.swift deleted file mode 100644 index e61900ab763..00000000000 --- a/Sources/XcodeGraph/Models/Dependencies/SwiftPackageManagerDependencies.swift +++ /dev/null @@ -1,135 +0,0 @@ -import Foundation -import Path - -public enum PackagesOrManifest: Equatable { - case packages([Package]) - case manifest -} - -/// Contains the description of a dependency that can be installed using Swift Package Manager. -public struct SwiftPackageManagerDependencies: Equatable { - /// The path to the `Package.swift` manifest defining the dependencies, or the list of packages that will be installed using - /// Swift Package Manager. - public let packagesOrManifest: PackagesOrManifest - - /// The custom `Product` types to be used for SPM targets. - public let productTypes: [String: Product] - - // The base settings to be used for targets generated from SwiftPackageManager - public let baseSettings: Settings - - /// The custom `Settings` to be applied to SPM targets - public let targetSettings: [String: SettingsDictionary] - - /// The custom project options for each project generated from a swift package - public let projectOptions: [String: XcodeGraph.Project.Options] - - /// Initializes a new `SwiftPackageManagerDependencies` instance. - /// - Parameters: - /// - packagesOrManifest: The path to the `Package.swift` manifest defining the dependencies, or the list of packages - /// that will be installed using Swift Package Manager. - /// - productTypes: The custom `Product` types to be used for SPM targets. - /// - baseSettings: The base settings to be used for targets generated from SwiftPackageManager - /// - targetSettings: The custom `SettingsDictionary` to be applied to denoted targets - /// - projectOptions: The custom project options for each project generated from a swift package - - public init( - _ packagesOrManifest: PackagesOrManifest, - productTypes: [String: Product], - baseSettings: Settings, - targetSettings: [String: SettingsDictionary], - projectOptions: [String: XcodeGraph.Project.Options] = [:] - ) { - self.packagesOrManifest = packagesOrManifest - self.productTypes = productTypes - self.baseSettings = baseSettings - self.targetSettings = targetSettings - self.projectOptions = projectOptions - } -} - -extension SwiftPackageManagerDependencies { - public enum Manifest: Equatable { - case content(String) - case manifest - } - - /// Returns `Package.swift` representation. - public func manifest(isLegacy: Bool, packageManifestFolder: AbsolutePath) -> Manifest { - switch packagesOrManifest { - case let .packages(packages): - return .content( - """ - import PackageDescription - - let package = Package( - name: "PackageName", - dependencies: [ - \(packages.map { - let manifest = $0.manifestValue(isLegacy: isLegacy, packageManifestFolder: packageManifestFolder) - return manifest + "," - }.joined(separator: "\n ")) - ] - ) - """ - ) - case .manifest: - return .manifest - } - } -} - -// MARK: - Package.manifestValue() - -extension Package { - /// Returns `Package.swift` representation. - fileprivate func manifestValue(isLegacy: Bool, packageManifestFolder: AbsolutePath) -> String { - switch self { - case let .local(path): - return #".package(path: "\#(path.relative(to: packageManifestFolder))")"# - case let .remote(url, requirement): - let requirementManifestValue = isLegacy ? requirement.legacyManifestValue : requirement.manifestValue - return #".package(url: "\#(url)", \#(requirementManifestValue))"# - } - } -} - -// MARK: - Requirement.manifestValue() - -extension Requirement { - /// Returns `Package.swift` representation. - fileprivate var manifestValue: String { - switch self { - case let .exact(version): - return #"exact: "\#(version)""# - case let .upToNextMajor(version): - return #"from: "\#(version)""# - case let .upToNextMinor(version): - return #".upToNextMinor(from: "\#(version)")"# - case let .branch(branch): - return #"branch: "\#(branch)""# - case let .revision(revision): - return #"revision: "\#(revision)""# - case let .range(from, to): - return #""\#(from)" ..< "\#(to)""# - } - } - - /// Returns legacy `Package.swift` representation. - fileprivate var legacyManifestValue: String { - switch self { - case let .exact(version): - return #".exact("\#(version)")"# - case let .upToNextMajor(version): - return #".upToNextMajor(from: "\#(version)")"# - case let .upToNextMinor(version): - return #".upToNextMinor(from: "\#(version)")"# - case let .branch(branch): - return #".branch("\#(branch)")"# - case let .revision(revision): - return #".revision("\#(revision)")"# - case let .range(from, to): - return #""\#(from)" ..< "\#(to)""# - } - } -} diff --git a/Sources/XcodeGraph/Models/ExecutionAction.swift b/Sources/XcodeGraph/Models/ExecutionAction.swift deleted file mode 100644 index 5c1f97379be..00000000000 --- a/Sources/XcodeGraph/Models/ExecutionAction.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation -import Path - -/// A execution action -public struct ExecutionAction: Equatable, Codable { - // MARK: - Attributes - - /// Name of a script. - public let title: String - /// An inline shell script. - public let scriptText: String - /// Name of the build or test target that will provide the action's build settings. - public let target: TargetReference? - /// The path to the shell which shall execute this script. if it is nil, Xcode will use default value. - public let shellPath: String? - - public let showEnvVarsInLog: Bool - - // MARK: - Init - - public init( - title: String, - scriptText: String, - target: TargetReference?, - shellPath: String?, - showEnvVarsInLog: Bool = true - ) { - self.title = title - self.scriptText = scriptText - self.target = target - self.shellPath = shellPath - self.showEnvVarsInLog = showEnvVarsInLog - } -} diff --git a/Sources/XcodeGraph/Models/FileElement.swift b/Sources/XcodeGraph/Models/FileElement.swift deleted file mode 100644 index f7fe037934f..00000000000 --- a/Sources/XcodeGraph/Models/FileElement.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import Path - -public enum FileElement: Equatable, Hashable, Codable { - case file(path: AbsolutePath) - case folderReference(path: AbsolutePath) - - public var path: AbsolutePath { - switch self { - case let .file(path): - return path - case let .folderReference(path): - return path - } - } - - public var isReference: Bool { - switch self { - case .file: - return false - case .folderReference: - return true - } - } -} diff --git a/Sources/XcodeGraph/Models/Headers.swift b/Sources/XcodeGraph/Models/Headers.swift deleted file mode 100644 index 85e76eacbb4..00000000000 --- a/Sources/XcodeGraph/Models/Headers.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import Path - -/// Headers -public struct Headers: Equatable, Codable { - // MARK: - Attributes - - public let `public`: [AbsolutePath] - public let `private`: [AbsolutePath] - public let project: [AbsolutePath] - - // MARK: - Init - - public init( - public: [AbsolutePath], - private: [AbsolutePath], - project: [AbsolutePath] - ) { - self.public = `public` - self.private = `private` - self.project = project - } -} diff --git a/Sources/XcodeGraph/Models/Metadata/FrameworkMetadata.swift b/Sources/XcodeGraph/Models/Metadata/FrameworkMetadata.swift deleted file mode 100644 index d1bf70b626b..00000000000 --- a/Sources/XcodeGraph/Models/Metadata/FrameworkMetadata.swift +++ /dev/null @@ -1,31 +0,0 @@ -import Foundation -import Path - -/// The metadata associated with a precompiled framework (.framework) -public struct FrameworkMetadata: Equatable { - public var path: AbsolutePath - public var binaryPath: AbsolutePath - public var dsymPath: AbsolutePath? - public var bcsymbolmapPaths: [AbsolutePath] - public var linking: BinaryLinking - public var architectures: [BinaryArchitecture] - public var status: FrameworkStatus - - public init( - path: AbsolutePath, - binaryPath: AbsolutePath, - dsymPath: AbsolutePath?, - bcsymbolmapPaths: [AbsolutePath], - linking: BinaryLinking, - architectures: [BinaryArchitecture], - status: FrameworkStatus - ) { - self.path = path - self.binaryPath = binaryPath - self.dsymPath = dsymPath - self.bcsymbolmapPaths = bcsymbolmapPaths - self.linking = linking - self.architectures = architectures - self.status = status - } -} diff --git a/Sources/XcodeGraph/Models/Metadata/LibraryMetadata.swift b/Sources/XcodeGraph/Models/Metadata/LibraryMetadata.swift deleted file mode 100644 index c8aad5cc99a..00000000000 --- a/Sources/XcodeGraph/Models/Metadata/LibraryMetadata.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import Path - -/// The metadata associated with a precompiled library (.a / .dylib) -public struct LibraryMetadata: Equatable { - public var path: AbsolutePath - public var publicHeaders: AbsolutePath - public var swiftModuleMap: AbsolutePath? - public var architectures: [BinaryArchitecture] - public var linking: BinaryLinking - - public init( - path: AbsolutePath, - publicHeaders: AbsolutePath, - swiftModuleMap: AbsolutePath?, - architectures: [BinaryArchitecture], - linking: BinaryLinking - ) { - self.path = path - self.publicHeaders = publicHeaders - self.swiftModuleMap = swiftModuleMap - self.architectures = architectures - self.linking = linking - } -} diff --git a/Sources/XcodeGraph/Models/Metadata/SystemFrameworkMetadata.swift b/Sources/XcodeGraph/Models/Metadata/SystemFrameworkMetadata.swift deleted file mode 100644 index fa82494069c..00000000000 --- a/Sources/XcodeGraph/Models/Metadata/SystemFrameworkMetadata.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Foundation -import Path - -/// The metadata associated with a system framework or library (e.g. UIKit.framework, libc++.tbd) -public struct SystemFrameworkMetadata: Equatable { - public var name: String - public var path: AbsolutePath - public var status: SDKStatus - public var source: SDKSource - - public init( - name: String, - path: AbsolutePath, - status: SDKStatus, - source: SDKSource - ) { - self.name = name - self.path = path - self.status = status - self.source = source - } -} diff --git a/Sources/XcodeGraph/Models/Metadata/XCFrameworkMetadata.swift b/Sources/XcodeGraph/Models/Metadata/XCFrameworkMetadata.swift deleted file mode 100644 index 707bfa74ae8..00000000000 --- a/Sources/XcodeGraph/Models/Metadata/XCFrameworkMetadata.swift +++ /dev/null @@ -1,31 +0,0 @@ -import Foundation -import Path - -/// The metadata associated with a precompiled xcframework -public struct XCFrameworkMetadata: Equatable { - public var path: AbsolutePath - public var infoPlist: XCFrameworkInfoPlist - public var primaryBinaryPath: AbsolutePath - public var linking: BinaryLinking - public var mergeable: Bool - public var status: FrameworkStatus - public var macroPath: AbsolutePath? - - public init( - path: AbsolutePath, - infoPlist: XCFrameworkInfoPlist, - primaryBinaryPath: AbsolutePath, - linking: BinaryLinking, - mergeable: Bool, - status: FrameworkStatus, - macroPath: AbsolutePath? - ) { - self.path = path - self.infoPlist = infoPlist - self.primaryBinaryPath = primaryBinaryPath - self.linking = linking - self.mergeable = mergeable - self.status = status - self.macroPath = macroPath - } -} diff --git a/Sources/XcodeGraph/Models/Package.swift b/Sources/XcodeGraph/Models/Package.swift deleted file mode 100644 index ac4aab84164..00000000000 --- a/Sources/XcodeGraph/Models/Package.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation -import Path - -public enum Package: Equatable, Codable { - case remote(url: String, requirement: Requirement) - case local(path: AbsolutePath) -} - -extension XcodeGraph.Package { - public var isRemote: Bool { - switch self { - case .remote: - return true - case .local: - return false - } - } -} diff --git a/Sources/XcodeGraph/Models/PlatformCondition.swift b/Sources/XcodeGraph/Models/PlatformCondition.swift deleted file mode 100644 index 9709766f436..00000000000 --- a/Sources/XcodeGraph/Models/PlatformCondition.swift +++ /dev/null @@ -1,64 +0,0 @@ -import Foundation -import Path - -public struct PlatformCondition: Codable, Hashable, Equatable, Comparable { - public static func < (lhs: PlatformCondition, rhs: PlatformCondition) -> Bool { - lhs.platformFilters < rhs.platformFilters - } - - public static func < (lhs: PlatformCondition, rhs: PlatformCondition?) -> Bool { - guard let rhsFilters = rhs?.platformFilters else { return false } - return lhs.platformFilters < rhsFilters - } - - public let platformFilters: PlatformFilters - private init(platformFilters: PlatformFilters) { - self.platformFilters = platformFilters - } - - public static func when(_ platformFilters: Set) -> PlatformCondition? { - guard !platformFilters.isEmpty else { return nil } - return PlatformCondition(platformFilters: platformFilters) - } - - public func intersection(_ other: PlatformCondition?) -> CombinationResult { - guard let otherFilters = other?.platformFilters else { return .condition(self) } - let filters = platformFilters.intersection(otherFilters) - - if filters.isEmpty { - return .incompatible - } else { - return .condition(PlatformCondition(platformFilters: filters)) - } - } - - public func union(_ other: PlatformCondition?) -> CombinationResult { - guard let otherFilters = other?.platformFilters else { return .condition(nil) } - let filters = platformFilters.union(otherFilters) - - if filters.isEmpty { - return .condition(nil) - } else { - return .condition(PlatformCondition(platformFilters: filters)) - } - } - - public enum CombinationResult: Equatable { - case incompatible - case condition(PlatformCondition?) - - public func combineWith(_ other: CombinationResult) -> CombinationResult { - switch (self, other) { - case (.incompatible, .incompatible): - return .incompatible - case (_, .incompatible): - return self - case (.incompatible, _): - return other - case let (.condition(lhs), .condition(rhs)): - guard let lhs, let rhs else { return .condition(nil) } - return lhs.union(rhs) - } - } - } -} diff --git a/Sources/XcodeGraph/Models/Plist.swift b/Sources/XcodeGraph/Models/Plist.swift deleted file mode 100644 index 1ac2ff82ab2..00000000000 --- a/Sources/XcodeGraph/Models/Plist.swift +++ /dev/null @@ -1,168 +0,0 @@ -import Foundation -import Path - -// MARK: - Plist - -public enum Plist { - case infoPlist(InfoPlist) - case entitlements(Entitlements) - - public indirect enum Value: Equatable, Codable { - case string(String) - case integer(Int) - case real(Double) - case boolean(Bool) - case dictionary([String: Value]) - case array([Value]) - - public var value: Any { - switch self { - case let .array(array): - return array.map(\.value) - case let .boolean(boolean): - return boolean - case let .dictionary(dictionary): - return dictionary.mapValues { $0.value } - case let .integer(integer): - return integer - case let .string(string): - return string - case let .real(double): - return double - } - } - } -} - -// MARK: - Plist.Value - ExpressibleByStringLiteral - -extension Plist.Value: ExpressibleByStringLiteral { - public init(stringLiteral value: String) { - self = .string(value) - } -} - -// MARK: - Plist.Value - ExpressibleByIntegerLiteral - -extension Plist.Value: ExpressibleByIntegerLiteral { - public init(integerLiteral value: Int) { - self = .integer(value) - } -} - -// MARK: - Plist.Value - ExpressibleByIntegerLiteral - -extension Plist.Value: ExpressibleByFloatLiteral { - public init(floatLiteral value: Double) { - self = .real(value) - } -} - -// MARK: - Plist.Value - ExpressibleByBooleanLiteral - -extension Plist.Value: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = .boolean(value) - } -} - -// MARK: - Plist.Value - ExpressibleByDictionaryLiteral - -extension Plist.Value: ExpressibleByDictionaryLiteral { - public init(dictionaryLiteral elements: (String, Plist.Value)...) { - self = .dictionary(Dictionary(uniqueKeysWithValues: elements)) - } -} - -// MARK: - Plist.Value - ExpressibleByArrayLiteral - -extension Plist.Value: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Plist.Value...) { - self = .array(elements) - } -} - -// MARK: - Dictionary (Plist.Value) - -extension Dictionary where Value == Plist.Value { - public func unwrappingValues() -> [Key: Any] { - mapValues { $0.value } - } -} - -// MARK: - InfoPlist - -public enum InfoPlist: Equatable, Codable { - // Path to a user defined info.plist file (already exists on disk). - case file(path: AbsolutePath) - - // 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) - - // User defined dictionary of keys/values for an info.plist file. - case dictionary([String: Plist.Value]) - - // 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]) - - // MARK: - Public - - public var path: AbsolutePath? { - switch self { - case let .file(path), let .generatedFile(path: path, data: _): - return path - default: - return nil - } - } -} - -// MARK: - InfoPlist - ExpressibleByStringLiteral - -extension InfoPlist: ExpressibleByStringLiteral { - public init(stringLiteral value: String) { - self = .file(path: try! AbsolutePath(validating: value)) // swiftlint:disable:this force_try - } -} - -// MARK: - Entitlements - -public enum Entitlements: Equatable, Codable { - // Path to a user defined .entitlements file (already exists on disk). - case file(path: AbsolutePath) - - // 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) - - // User defined dictionary of keys/values for an .entitlements file. - case dictionary([String: Plist.Value]) - - // A user defined xcconfig variable map to .entitlements file - case variable(String) - - // MARK: - Public - - public var path: AbsolutePath? { - switch self { - case let .file(path), let .generatedFile(path: path, data: _): - return path - default: - return nil - } - } -} - -// MARK: - Entitlements - ExpressibleByStringLiteral - -extension Entitlements: ExpressibleByStringLiteral { - public init(stringLiteral value: String) { - if value.hasPrefix("$(") { - self = .variable(value) - } else { - self = .file(path: try! AbsolutePath(validating: value)) // swiftlint:disable:this force_try - } - } -} diff --git a/Sources/XcodeGraph/Models/Product.swift b/Sources/XcodeGraph/Models/Product.swift deleted file mode 100644 index 322a0683d6b..00000000000 --- a/Sources/XcodeGraph/Models/Product.swift +++ /dev/null @@ -1,241 +0,0 @@ -import Foundation - -public enum Product: String, CustomStringConvertible, CaseIterable, Codable { - case app - case staticLibrary = "static_library" - case dynamicLibrary = "dynamic_library" - case framework - case staticFramework - case unitTests = "unit_tests" - case uiTests = "ui_tests" - case bundle - case commandLineTool - case appExtension = "app_extension" - // case watchApp = "watch_app" - case watch2App = "watch_2_app" - // case watchExtension = "watch_extension" - case watch2Extension = "watch_2_extension" - case tvTopShelfExtension = "tv_top_shelf_extension" - // case tvIntentsExtension = "tv_intents_extension" - // case messagesApplication = "messages_application" - case messagesExtension = "messages_extension" - case stickerPackExtension = "sticker_pack_extension" - case appClip - case xpc - case systemExtension = "system_extension" - case extensionKitExtension = "extension_kit_extension" - case macro - - public var caseValue: String { - switch self { - case .app: - return "app" - case .staticLibrary: - return "staticLibrary" - case .dynamicLibrary: - return "dynamicLibrary" - case .framework: - return "framework" - case .staticFramework: - return "staticFramework" - case .unitTests: - return "unitTests" - case .uiTests: - return "uiTests" - case .bundle: - return "bundle" - case .appExtension: - return "appExtension" - // case .watchApp: - // return "watchApp" - case .watch2App: - return "watch2App" - // case .watchExtension: - // return "watchExtension" - case .watch2Extension: - return "watch2Extension" - case .tvTopShelfExtension: - return "tvTopShelfExtension" - // case .tvIntentsExtension: - // return "tvIntentsExtension" - // case .messagesApplication: - // return "messagesApplication" - case .messagesExtension: - return "messagesExtension" - case .stickerPackExtension: - return "stickerPackExtension" - case .commandLineTool: - return "commandLineTool" - case .appClip: - return "appClip" - case .xpc: - return "xpc" - case .systemExtension: - return "systemExtension" - case .extensionKitExtension: - return "extensionKitExtension" - case .macro: - return "macro" - } - } - - public var description: String { - switch self { - case .app: - return "application" - case .staticLibrary: - return "static library" - case .dynamicLibrary: - return "dynamic library" - case .framework: - return "dynamic framework" - case .staticFramework: - return "static framework" - case .unitTests: - return "unit tests" - case .uiTests: - return "ui tests" - case .bundle: - return "bundle" - case .appExtension: - return "app extension" - // case .watchApp: - // return "watch application" - case .watch2App: - return "watch 2 application" - // case .watchExtension: - // return "watch extension" - case .watch2Extension: - return "watch 2 extension" - case .tvTopShelfExtension: - return "tv top shelf extension" - // case .tvIntentsExtension: - // return "tv intents extension" - // case .messagesApplication: - // return "iMessage application" - case .messagesExtension: - return "iMessage extension" - case .stickerPackExtension: - return "sticker pack extension" - case .commandLineTool: - return "command line tool" - case .appClip: - return "appClip" - case .xpc: - return "xpc" - case .systemExtension: - return "system extension" - case .extensionKitExtension: - return "extensionKit extension" - case .macro: - return "Swift Macro" - } - } - - /// Returns true if the target can be ran. - public var runnable: Bool { - switch self { - case - .app, - .appClip, - .commandLineTool, - .watch2App, - .appExtension, - .messagesExtension, - .stickerPackExtension, - .tvTopShelfExtension, - .watch2Extension, - .extensionKitExtension, - .macro: - return true - case - .bundle, - .systemExtension, - .dynamicLibrary, - .framework, - .staticFramework, - .staticLibrary, - .unitTests, - .uiTests, - .xpc: - return false - } - } - - /// Returns true if the product is a tests bundle. - public var testsBundle: Bool { - self == .uiTests || self == .unitTests - } - - public static func forPlatform(_ platform: Platform) -> Set { - var base: [Product] = [ - .app, - .staticLibrary, - .dynamicLibrary, - .framework, - ] - - if platform == .iOS { - base.append(.stickerPackExtension) - // base.append(.messagesApplication) - base.append(.messagesExtension) - base.append(.appClip) - } - if platform == .iOS || platform == .visionOS { - base.append(.appExtension) - } - - if platform == .tvOS { - base.append(.tvTopShelfExtension) - // base.append(.tvIntentsExtension) - } - - if platform == .macOS || - platform == .tvOS || - platform == .iOS || - platform == .visionOS - { - base.append(.unitTests) - } - - if platform == .macOS || - platform == .tvOS || - platform == .iOS - { - base.append(.uiTests) - } - - if platform == .macOS { - base.append(.commandLineTool) - base.append(.macro) - base.append(.xpc) - base.append(.systemExtension) - } - - // if platform == .watchOS { - // base.append(contentsOf: [ - // .watchApp, - // .watch2App, - // .watchExtension, - // .watch2Extension, - // ]) - // } - return Set(base) - } - - public var isStatic: Bool { - [.staticLibrary, .staticFramework].contains(self) - } - - public var isFramework: Bool { - [.framework, .staticFramework].contains(self) - } - - public var isDynamic: Bool { - [.framework, .dynamicLibrary].contains(self) - } - - public func canHostTests() -> Bool { - [.app, .appClip, .watch2App].contains(self) - } -} diff --git a/Sources/XcodeGraph/Models/Project.swift b/Sources/XcodeGraph/Models/Project.swift deleted file mode 100644 index 1cd9b2c6619..00000000000 --- a/Sources/XcodeGraph/Models/Project.swift +++ /dev/null @@ -1,152 +0,0 @@ -import Foundation -import Path -import TSCUtility - -public struct Project: Hashable, Equatable, CustomStringConvertible, CustomDebugStringConvertible, Codable { - // MARK: - Attributes - - /// Path to the folder that contains the project manifest. - public var path: AbsolutePath - - /// Path to the root of the project sources. - public var sourceRootPath: AbsolutePath - - /// Path to the Xcode project that will be generated. - public var xcodeProjPath: AbsolutePath - - /// Project name. - public var name: String - - /// Organization name. - public var organizationName: String? - - /// Default known regions - public var defaultKnownRegions: [String]? - - /// Development region code e.g. `en`. - public var developmentRegion: String? - - /// Additional project options. - public var options: Options - - /// Project targets. - public var targets: [String: Target] - - /// Project swift packages. - public var packages: [Package] - - /// Project schemes - public var schemes: [Scheme] - - /// Project settings. - public var settings: Settings - - /// The group to place project files within - public var filesGroup: ProjectGroup - - /// Additional files to include in the project - public var additionalFiles: [FileElement] - - /// IDE template macros that represent content of IDETemplateMacros.plist - public var ideTemplateMacros: IDETemplateMacros? - - /// `ResourceSynthesizers` that will be applied on individual target's resources - public var resourceSynthesizers: [ResourceSynthesizer] - - /// The version in which a check happened related to recommended settings after updating Xcode. - public var lastUpgradeCheck: Version? - - /// Indicates whether the project is imported through `Package.swift`. - public var isExternal: Bool - - // MARK: - Init - - /// Initializes the project with its attributes. - /// - /// - Parameters: - /// - path: Path to the folder that contains the project manifest. - /// - sourceRootPath: Path to the directory where the Xcode project will be generated. - /// - xcodeProjPath: Path to the Xcode project that will be generated. - /// - name: Project name. - /// - organizationName: Organization name. - /// - defaultKnownRegions: Default known regions. - /// - developmentRegion: Development region. - /// - options: Additional project options. - /// - settings: The settings to apply at the project level - /// - filesGroup: The root group to place project files within - /// - targets: The project targets - /// *(Those won't be included in any build phases)* - /// - packages: Project swift packages. - /// - schemes: Project schemes. - /// - ideTemplateMacros: IDE template macros that represent content of IDETemplateMacros.plist. - /// - additionalFiles: The additional files to include in the project - /// - resourceSynthesizers: `ResourceSynthesizers` that will be applied on individual target's resources - /// - lastUpgradeCheck: The version in which a check happened related to recommended settings after updating Xcode. - /// - isExternal: Indicates whether the project is imported through `Package.swift`. - public init( - path: AbsolutePath, - sourceRootPath: AbsolutePath, - xcodeProjPath: AbsolutePath, - name: String, - organizationName: String?, - defaultKnownRegions: [String]?, - developmentRegion: String?, - options: Options, - settings: Settings, - filesGroup: ProjectGroup, - targets: [Target], - packages: [Package], - schemes: [Scheme], - ideTemplateMacros: IDETemplateMacros?, - additionalFiles: [FileElement], - resourceSynthesizers: [ResourceSynthesizer], - lastUpgradeCheck: Version?, - isExternal: Bool - ) { - self.path = path - self.sourceRootPath = sourceRootPath - self.xcodeProjPath = xcodeProjPath - self.name = name - self.organizationName = organizationName - self.defaultKnownRegions = defaultKnownRegions - self.developmentRegion = developmentRegion - self.options = options - self.targets = Dictionary(uniqueKeysWithValues: targets.map { ($0.name, $0) }) - self.packages = packages - self.schemes = schemes - self.settings = settings - self.filesGroup = filesGroup - self.ideTemplateMacros = ideTemplateMacros - self.additionalFiles = additionalFiles - self.resourceSynthesizers = resourceSynthesizers - self.lastUpgradeCheck = lastUpgradeCheck - self.isExternal = isExternal - } - - // MARK: - CustomStringConvertible - - public var description: String { - name - } - - // MARK: - CustomDebugStringConvertible - - public var debugDescription: String { - name - } - - // MARK: - Hashable - - public func hash(into hasher: inout Hasher) { - hasher.combine(path) - } - - // MARK: - Public - - /// Returns the name of the default configuration. - public var defaultDebugBuildConfigurationName: String { - let debugConfiguration = settings.defaultDebugBuildConfiguration() - let buildConfiguration = debugConfiguration ?? settings.configurations.keys.first - return buildConfiguration?.name ?? BuildConfiguration.debug.name - } -} diff --git a/Sources/XcodeGraph/Models/RawScriptBuildPhase.swift b/Sources/XcodeGraph/Models/RawScriptBuildPhase.swift deleted file mode 100644 index a1588453550..00000000000 --- a/Sources/XcodeGraph/Models/RawScriptBuildPhase.swift +++ /dev/null @@ -1,40 +0,0 @@ -import Foundation -import Path - -/// It represents a raw script build phase. -public struct RawScriptBuildPhase: Equatable, Codable { - /// The name of the build phase. - public let name: String - - /// Script. - public let script: String - - /// Whether we want the build phase to show the environment variables in the logs. - public let showEnvVarsInLog: Bool - - /// Whether the script should be hashed for caching purposes. - public let hashable: Bool - - /// The path to the shell which shall execute this script. - public let shellPath: String - - /// Initializes the target script. - /// - Parameter name: The name of the build phase. - /// - Parameter script: Script. - /// - Parameter showEnvVarsInLog: Whether we want the build phase to show the environment variables in the logs. - /// - Parameter hashable: Whether the script should be hashed for caching purposes. - /// - Parameter shellPath: The path to the shell which shall execute this script. Default is `/bin/sh`. - public init( - name: String, - script: String, - showEnvVarsInLog: Bool, - hashable: Bool, - shellPath: String = "/bin/sh" - ) { - self.name = name - self.script = script - self.showEnvVarsInLog = showEnvVarsInLog - self.hashable = hashable - self.shellPath = shellPath - } -} diff --git a/Sources/XcodeGraph/Models/ResourceFileElement.swift b/Sources/XcodeGraph/Models/ResourceFileElement.swift deleted file mode 100644 index 5023f01e0d6..00000000000 --- a/Sources/XcodeGraph/Models/ResourceFileElement.swift +++ /dev/null @@ -1,58 +0,0 @@ -import Foundation -import Path - -public enum ResourceFileElement: Equatable, Hashable, Codable { - /// A file path (or glob pattern) to include, a list of file paths (or glob patterns) to exclude, ODR tags list and inclusion - /// condition. - /// For convenience, a string literal can be used as an alternate way to specify this option. - case file(path: AbsolutePath, tags: [String] = [], inclusionCondition: PlatformCondition? = nil) - /// A directory path to include as a folder reference, ODR tags list and inclusion condition. - case folderReference(path: AbsolutePath, tags: [String] = [], inclusionCondition: PlatformCondition? = nil) - - public var path: AbsolutePath { - switch self { - case let .file(path, _, _): - return path - case let .folderReference(path, _, _): - return path - } - } - - public var isReference: Bool { - switch self { - case .file: - return false - case .folderReference: - return true - } - } - - public var tags: [String] { - switch self { - case let .file(_, tags, _): - return tags - case let .folderReference(_, tags, _): - return tags - } - } - - public var inclusionCondition: PlatformCondition? { - switch self { - case let .file(_, _, condition): - return condition - case let .folderReference(_, _, condition): - return condition - } - } - - public init(path: AbsolutePath) { - self = .file(path: path) - } -} - -extension [XcodeGraph.ResourceFileElement] { - public mutating func remove(path: AbsolutePath) { - guard let index = firstIndex(of: XcodeGraph.ResourceFileElement(path: path)) else { return } - remove(at: index) - } -} diff --git a/Sources/XcodeGraph/Models/ResourceSynthesizer.swift b/Sources/XcodeGraph/Models/ResourceSynthesizer.swift deleted file mode 100644 index 67a5e5ac841..00000000000 --- a/Sources/XcodeGraph/Models/ResourceSynthesizer.swift +++ /dev/null @@ -1,96 +0,0 @@ -import AnyCodable -import Foundation -import Path - -public struct ResourceSynthesizer: Equatable, Hashable, Codable { - public let parser: Parser - public let parserOptions: [String: Parser.Option] - public let extensions: Set - public let template: Template - - public enum Template: Equatable, Hashable, Codable { - case file(AbsolutePath) - case defaultTemplate(String) - } - - public enum Parser: String, Equatable, Hashable, Codable { - case strings - case assets - case plists - case fonts - case coreData - case interfaceBuilder - case json - case yaml - case files - - public struct Option: Equatable, Hashable, Codable { - public var value: Any { anyCodableValue.value } - private let anyCodableValue: AnyCodable - - public init(value: some Any) { - anyCodableValue = AnyCodable(value) - } - } - } - - public init( - parser: Parser, - parserOptions: [String: Parser.Option], - extensions: Set, - template: Template - ) { - self.parser = parser - self.parserOptions = parserOptions - self.extensions = extensions - self.template = template - } -} - -// MARK: - ResourceSynthesizer.Parser.Option - ExpressibleByStringInterpolation - -extension ResourceSynthesizer.Parser.Option: ExpressibleByStringInterpolation { - public init(stringLiteral value: String) { - self = .init(value: value) - } -} - -// MARK: - ResourceSynthesizer.Parser.Option - ExpressibleByIntegerLiteral - -extension ResourceSynthesizer.Parser.Option: ExpressibleByIntegerLiteral { - public init(integerLiteral value: Int) { - self = .init(value: value) - } -} - -// MARK: - ResourceSynthesizer.Parser.Option - ExpressibleByFloatLiteral - -extension ResourceSynthesizer.Parser.Option: ExpressibleByFloatLiteral { - public init(floatLiteral value: Double) { - self = .init(value: value) - } -} - -// MARK: - ResourceSynthesizer.Parser.Option - ExpressibleByBooleanLiteral - -extension ResourceSynthesizer.Parser.Option: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = .init(value: value) - } -} - -// MARK: - ResourceSynthesizer.Parser.Option - ExpressibleByDictionaryLiteral - -extension ResourceSynthesizer.Parser.Option: ExpressibleByDictionaryLiteral { - public init(dictionaryLiteral elements: (String, Self)...) { - self = .init(value: Dictionary(uniqueKeysWithValues: elements)) - } -} - -// MARK: - ResourceSynthesizer.Parser.Option - ExpressibleByArrayLiteral - -extension ResourceSynthesizer.Parser.Option: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Self...) { - self = .init(value: elements) - } -} diff --git a/Sources/XcodeGraph/Models/RunAction.swift b/Sources/XcodeGraph/Models/RunAction.swift deleted file mode 100644 index a7ac3aa9934..00000000000 --- a/Sources/XcodeGraph/Models/RunAction.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import Path - -public struct RunAction: Equatable, Codable { - // MARK: - Attributes - - public let configurationName: String - public let attachDebugger: Bool - public let customLLDBInitFile: AbsolutePath? - public let preActions: [ExecutionAction] - public let postActions: [ExecutionAction] - public let executable: TargetReference? - public let filePath: AbsolutePath? - public let arguments: Arguments? - public let options: RunActionOptions - public let diagnosticsOptions: SchemeDiagnosticsOptions - public let expandVariableFromTarget: TargetReference? - public let launchStyle: LaunchStyle - - // MARK: - Init - - public init( - configurationName: String, - attachDebugger: Bool, - customLLDBInitFile: AbsolutePath?, - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [], - executable: TargetReference?, - filePath: AbsolutePath?, - arguments: Arguments?, - options: RunActionOptions = .init(), - diagnosticsOptions: SchemeDiagnosticsOptions, - expandVariableFromTarget: TargetReference? = nil, - launchStyle: LaunchStyle = .automatically - ) { - self.configurationName = configurationName - self.attachDebugger = attachDebugger - self.customLLDBInitFile = customLLDBInitFile - self.preActions = preActions - self.postActions = postActions - self.executable = executable - self.filePath = filePath - self.arguments = arguments - self.options = options - self.diagnosticsOptions = diagnosticsOptions - self.expandVariableFromTarget = expandVariableFromTarget - self.launchStyle = launchStyle - } -} diff --git a/Sources/XcodeGraph/Models/RunActionOptions.swift b/Sources/XcodeGraph/Models/RunActionOptions.swift deleted file mode 100644 index 5cae4294ac3..00000000000 --- a/Sources/XcodeGraph/Models/RunActionOptions.swift +++ /dev/null @@ -1,66 +0,0 @@ -import Foundation -import Path - -/// Options for the `RunAction` action -public struct RunActionOptions: Equatable, Codable { - /// App Language. - public let language: String? - - /// App Region. - public let region: String? - - /// The path of the - /// [StoreKit configuration - /// file](https://developer.apple.com/documentation/xcode/setting_up_storekit_testing_in_xcode#3625700) - public let storeKitConfigurationPath: AbsolutePath? - - /// A simulated location used when running the provided run action. - public let simulatedLocation: SimulatedLocation? - - /// 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. - - public init( - language: String? = nil, - region: String? = nil, - storeKitConfigurationPath: AbsolutePath? = nil, - simulatedLocation: SimulatedLocation? = nil, - enableGPUFrameCaptureMode: GPUFrameCaptureMode = .autoEnabled - ) { - self.language = language - self.region = region - self.storeKitConfigurationPath = storeKitConfigurationPath - self.simulatedLocation = simulatedLocation - self.enableGPUFrameCaptureMode = enableGPUFrameCaptureMode - } -} - -extension RunActionOptions { - public enum GPUFrameCaptureMode: String, Codable, Equatable { - case autoEnabled - case metal - case openGL - case disabled - - public static var `default`: GPUFrameCaptureMode { - .autoEnabled - } - } -} diff --git a/Sources/XcodeGraph/Models/Scheme.swift b/Sources/XcodeGraph/Models/Scheme.swift deleted file mode 100644 index 8440cd14aa3..00000000000 --- a/Sources/XcodeGraph/Models/Scheme.swift +++ /dev/null @@ -1,40 +0,0 @@ -import Foundation -import Path - -public struct Scheme: Equatable, Codable { - // MARK: - Attributes - - public var name: String - public var shared: Bool - public var hidden: Bool - public var buildAction: BuildAction? - public var testAction: TestAction? - public var runAction: RunAction? - public var archiveAction: ArchiveAction? - public var profileAction: ProfileAction? - public var analyzeAction: AnalyzeAction? - - // MARK: - Init - - public init( - name: String, - shared: Bool = false, - hidden: Bool = false, - buildAction: BuildAction? = nil, - testAction: TestAction? = nil, - runAction: RunAction? = nil, - archiveAction: ArchiveAction? = nil, - profileAction: ProfileAction? = nil, - analyzeAction: AnalyzeAction? = nil - ) { - self.name = name - self.shared = shared - self.hidden = hidden - self.buildAction = buildAction - self.testAction = testAction - self.runAction = runAction - self.archiveAction = archiveAction - self.profileAction = profileAction - self.analyzeAction = analyzeAction - } -} diff --git a/Sources/XcodeGraph/Models/Settings.swift b/Sources/XcodeGraph/Models/Settings.swift deleted file mode 100644 index 8e103c3da74..00000000000 --- a/Sources/XcodeGraph/Models/Settings.swift +++ /dev/null @@ -1,201 +0,0 @@ -import Foundation -import Path - -public typealias SettingsDictionary = [String: SettingValue] - -public enum SettingValue: ExpressibleByStringInterpolation, ExpressibleByStringLiteral, ExpressibleByArrayLiteral, Equatable, - Codable -{ - case string(String) - case array([String]) - - public init(stringLiteral value: String) { - self = .string(value) - } - - public init(arrayLiteral elements: String...) { - self = .array(elements) - } - - public func normalize() -> SettingValue { - switch self { - case let .array(currentValue): - if currentValue.count == 1 { - return .string(currentValue[0]) - } - return self - case .string: - return self - } - } -} - -extension SettingsDictionary { - /// Overlays a SettingsDictionary by adding a `[sdk=*]` qualifier - /// e.g. for a multiplatform target - /// `LD_RUNPATH_SEARCH_PATHS = @executable_path/Frameworks` - /// `LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = @executable_path/../Frameworks` - public mutating func overlay( - with other: SettingsDictionary, - for platform: Platform - ) { - for (key, newValue) in other { - if self[key] == nil { - self[key] = newValue - } else if self[key] != newValue { - let newKey = "\(key)[sdk=\(platform.xcodeSdkRoot)*]" - self[newKey] = newValue - if platform.hasSimulators, let simulatorSDK = platform.xcodeSimulatorSDK { - let newKey = "\(key)[sdk=\(simulatorSDK)*]" - self[newKey] = newValue - } - } - } - } - - /// Combines two `SettingsDictionary`. Instead of overriding values for a duplicate key, it combines them. - public func combine(with settings: SettingsDictionary) -> SettingsDictionary { - merging(settings, uniquingKeysWith: { oldValue, newValue in - let newValues: [String] - switch newValue { - case let .string(value): - newValues = [value] - case let .array(values): - newValues = values - } - switch oldValue { - case let .array(values): - return .array(values + newValues) - case let .string(value): - return .array(value.split(separator: " ").map(String.init) + newValues) - } - }) - } -} - -public struct Configuration: Equatable, Codable { - // MARK: - Attributes - - public var settings: SettingsDictionary - public var xcconfig: AbsolutePath? - - // MARK: - Init - - public init(settings: SettingsDictionary = [:], xcconfig: AbsolutePath? = nil) { - self.settings = settings - self.xcconfig = xcconfig - } - - // MARK: - Public - - /// Returns a copy of the configuration with the given settings set. - /// - Parameter settings: SettingsDictionary to be set to the copy. - public func with(settings: SettingsDictionary) -> Configuration { - Configuration( - settings: settings, - xcconfig: xcconfig - ) - } -} - -public enum DefaultSettings: Codable, Equatable { - case recommended(excluding: Set = []) - case essential(excluding: Set = []) - case none -} - -extension DefaultSettings { - public static var recommended: DefaultSettings { - .recommended(excluding: []) - } - - public static var essential: DefaultSettings { - .essential(excluding: []) - } -} - -public struct Settings: Equatable, Codable { - public static let `default` = Settings( - configurations: [.release: nil, .debug: nil], - defaultSettings: .recommended - ) - - // MARK: - Attributes - - public let base: SettingsDictionary - /// Base settings applied only for configurations of `variant == .debug` - public let baseDebug: SettingsDictionary - public let configurations: [BuildConfiguration: Configuration?] - public let defaultSettings: DefaultSettings - - // MARK: - Init - - public init( - base: SettingsDictionary = [:], - baseDebug: SettingsDictionary = [:], - configurations: [BuildConfiguration: Configuration?], - defaultSettings: DefaultSettings = .recommended - ) { - self.base = base - self.baseDebug = baseDebug - self.configurations = configurations - self.defaultSettings = defaultSettings - } - - public func with(base: SettingsDictionary) -> Settings { - .init( - base: base, - configurations: configurations, - defaultSettings: defaultSettings - ) - } -} - -extension Settings { - /// Finds the default debug `BuildConfiguration` if it exists, otherwise returns the first debug configuration available. - /// - /// - Returns: The default debug `BuildConfiguration` - public func defaultDebugBuildConfiguration() -> BuildConfiguration? { - let debugConfigurations = configurations.keys - .filter { $0.variant == .debug } - .sorted() - let defaultConfiguration = debugConfigurations.first(where: { $0 == BuildConfiguration.debug }) - return defaultConfiguration ?? debugConfigurations.first - } - - /// Finds the default release `BuildConfiguration` if it exists, otherwise returns the first release configuration available. - /// - /// - Returns: The default release `BuildConfiguration` - public func defaultReleaseBuildConfiguration() -> BuildConfiguration? { - let releaseConfigurations = configurations.keys - .filter { $0.variant == .release } - .sorted() - let defaultConfiguration = releaseConfigurations.first(where: { $0 == BuildConfiguration.release }) - return defaultConfiguration ?? releaseConfigurations.first - } -} - -extension [BuildConfiguration: Configuration?] { - public func sortedByBuildConfigurationName() -> [(key: BuildConfiguration, value: Configuration?)] { - sorted(by: { first, second -> Bool in first.key < second.key }) - } - - public func xcconfigs() -> [AbsolutePath] { - sortedByBuildConfigurationName() - .map(\.value) - .compactMap { $0?.xcconfig } - } -} - -extension [String: SettingValue] { - public func toAny() -> [String: Any] { - mapValues { value in - switch value { - case let .array(array): - return array - case let .string(string): - return string - } - } - } -} diff --git a/Sources/XcodeGraph/Models/SimulatedLocation.swift b/Sources/XcodeGraph/Models/SimulatedLocation.swift deleted file mode 100644 index 0840c6ed583..00000000000 --- a/Sources/XcodeGraph/Models/SimulatedLocation.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation -import Path - -public enum SimulatedLocation { - case gpxFile(AbsolutePath) - case reference(String) - - /// A unique identifier string for the selected simulated location. - /// - /// In case of Xcode's simulated locations, this is a string representing the location. - /// In case of a custom GPX file, this is a path to that file. - public var identifier: String { - switch self { - case let .gpxFile(path): - return path.pathString - case let .reference(identifier): - return identifier - } - } - - /// A reference type is 1 if using Xcode's built-in simulated locations. - /// Otherwise, it is 0. - public var referenceType: String { - if case .gpxFile = self { return "0" } - return "1" - } -} - -extension SimulatedLocation: Equatable, Codable, Hashable { - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - let value = try container.decode(String.self) - - guard value.hasSuffix(".gpx") else { - self = .reference(value) - return - } - - self = .gpxFile(try AbsolutePath(validating: value)) - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - try container.encode(identifier) - } -} diff --git a/Sources/XcodeGraph/Models/SourceFile.swift b/Sources/XcodeGraph/Models/SourceFile.swift deleted file mode 100644 index 9defe25d3f2..00000000000 --- a/Sources/XcodeGraph/Models/SourceFile.swift +++ /dev/null @@ -1,47 +0,0 @@ -import Foundation -import Path - -/// A type that represents a source file. -public struct SourceFile: ExpressibleByStringLiteral, Equatable, Codable { - /// Source file path. - public var path: AbsolutePath - - /// Compiler flags - /// When source files are added to a target, they can contain compiler flags that Xcode's build system - /// passes to the compiler when compiling those files. By default none is passed. - public var compilerFlags: String? - - /// This is intended to be used by the mappers that generate files through side effects. - /// This attribute is used by the content hasher used by the caching functionality. - public var contentHash: String? - - /// Source file code generation attribute - public let codeGen: FileCodeGen? - - /// Source file condition for platform filters - public let compilationCondition: PlatformCondition? - - public init( - path: AbsolutePath, - compilerFlags: String? = nil, - contentHash: String? = nil, - codeGen: FileCodeGen? = nil, - compilationCondition: PlatformCondition? = nil - ) { - self.path = path - self.compilerFlags = compilerFlags - self.contentHash = contentHash - self.codeGen = codeGen - self.compilationCondition = compilationCondition - } - - // MARK: - ExpressibleByStringLiteral - - public init(stringLiteral value: String) { - path = try! AbsolutePath(validating: value) // swiftlint:disable:this force_try - compilerFlags = nil - contentHash = nil - codeGen = nil - compilationCondition = nil - } -} diff --git a/Sources/XcodeGraph/Models/Target.swift b/Sources/XcodeGraph/Models/Target.swift deleted file mode 100644 index 0216454d2ff..00000000000 --- a/Sources/XcodeGraph/Models/Target.swift +++ /dev/null @@ -1,365 +0,0 @@ -import Foundation -import Path - -// swiftlint:disable:next type_body_length -public struct Target: Equatable, Hashable, Comparable, Codable { - // 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.) - public static let validSourceExtensions: [String] = [ - "m", "swift", "mm", "cpp", "cc", "c", "d", "s", "intentdefinition", "xcmappingmodel", "metal", "mlmodel", "docc", - "playground", "rcproject", "mlpackage", - ] - public static let validFolderExtensions: [String] = [ - "framework", "bundle", "app", "xcassets", "appiconset", "scnassets", - ] - - // MARK: - Attributes - - public var name: String - public var destinations: Destinations - public var product: Product - public var bundleId: String - public var productName: String - public var deploymentTargets: DeploymentTargets - - // An info.plist file is needed for (dynamic) frameworks, applications and executables - // however is not needed for other products such as static libraries. - public var infoPlist: InfoPlist? - public var entitlements: Entitlements? - public var settings: Settings? - public var dependencies: [TargetDependency] - public var sources: [SourceFile] - public var resources: ResourceFileElements - public var copyFiles: [CopyFilesAction] - public var headers: Headers? - public var coreDataModels: [CoreDataModel] - public var scripts: [TargetScript] - public var environmentVariables: [String: EnvironmentVariable] - public var launchArguments: [LaunchArgument] - public var filesGroup: ProjectGroup - public var rawScriptBuildPhases: [RawScriptBuildPhase] - public var playgrounds: [AbsolutePath] - public let additionalFiles: [FileElement] - public var buildRules: [BuildRule] - public var prune: Bool - public let mergedBinaryType: MergedBinaryType - public let mergeable: Bool - public let onDemandResourcesTags: OnDemandResourcesTags? - - // MARK: - Init - - public init( - name: String, - destinations: Destinations, - product: Product, - productName: String?, - bundleId: String, - deploymentTargets: DeploymentTargets = DeploymentTargets(), - infoPlist: InfoPlist? = nil, - entitlements: Entitlements? = nil, - settings: Settings? = nil, - sources: [SourceFile] = [], - resources: ResourceFileElements = .init([]), - copyFiles: [CopyFilesAction] = [], - headers: Headers? = nil, - coreDataModels: [CoreDataModel] = [], - scripts: [TargetScript] = [], - environmentVariables: [String: EnvironmentVariable] = [:], - launchArguments: [LaunchArgument] = [], - filesGroup: ProjectGroup, - dependencies: [TargetDependency] = [], - rawScriptBuildPhases: [RawScriptBuildPhase] = [], - playgrounds: [AbsolutePath] = [], - additionalFiles: [FileElement] = [], - buildRules: [BuildRule] = [], - prune: Bool = false, - mergedBinaryType: MergedBinaryType = .disabled, - mergeable: Bool = false, - onDemandResourcesTags: OnDemandResourcesTags? = nil - ) { - self.name = name - self.product = product - self.destinations = destinations - self.bundleId = bundleId - self.productName = productName ?? name.sanitizedModuleName - self.deploymentTargets = deploymentTargets - self.infoPlist = infoPlist - self.entitlements = entitlements - self.settings = settings - self.sources = sources - self.resources = resources - self.copyFiles = copyFiles - self.headers = headers - self.coreDataModels = coreDataModels - self.scripts = scripts - self.environmentVariables = environmentVariables - self.launchArguments = launchArguments - self.filesGroup = filesGroup - self.dependencies = dependencies - self.rawScriptBuildPhases = rawScriptBuildPhases - self.playgrounds = playgrounds - self.additionalFiles = additionalFiles - self.buildRules = buildRules - self.prune = prune - self.mergedBinaryType = mergedBinaryType - self.mergeable = mergeable - self.onDemandResourcesTags = onDemandResourcesTags - } - - /// Target can be included in the link phase of other targets - public func isLinkable() -> Bool { - [.dynamicLibrary, .staticLibrary, .framework, .staticFramework].contains(product) - } - - /// Returns whether a target is exclusive to a single platform - public func isExclusiveTo(_ platform: Platform) -> Bool { - destinations.map(\.platform).allSatisfy { $0 == platform } - } - - /// Returns whether a target supports a platform - public func supports(_ platform: Platform) -> Bool { - destinations.map(\.platform).contains(platform) - } - - /// List of platforms this target deploys to - public var supportedPlatforms: Set { - Set(destinations.map(\.platform)) - } - - /// Returns target's pre scripts. - public var preScripts: [TargetScript] { - scripts.filter { $0.order == .pre } - } - - /// Returns target's post scripts. - public var postScripts: [TargetScript] { - scripts.filter { $0.order == .post } - } - - /// Returns true if the target supports Mac Catalyst - public var supportsCatalyst: Bool { - destinations.contains(.macCatalyst) - } - - /// Target can link static products (e.g. an app can link a staticLibrary) - public func canLinkStaticProducts() -> Bool { - [ - .framework, - .app, - .commandLineTool, - .xpc, - .unitTests, - .uiTests, - .appExtension, - .watch2Extension, - .messagesExtension, - .appClip, - .tvTopShelfExtension, - .systemExtension, - .extensionKitExtension, - .macro, - ].contains(product) - } - - /// Returns true if the target supports having a headers build phase.. - public var shouldIncludeHeadersBuildPhase: Bool { - switch product { - case .framework, .staticFramework, .staticLibrary, .dynamicLibrary: - return true - default: - return false - } - } - - /// Returns true if the target supports having sources. - public var supportsSources: Bool { - switch product { - case .stickerPackExtension, .watch2App: - return false - case .bundle: - // Bundles only support source when targetting macOS only - return isExclusiveTo(.macOS) - default: - return true - } - } - - /// Returns true if the target deploys to more then one platform - public var isMultiplatform: Bool { - supportedPlatforms.count > 1 - } - - /// Returns true if the target supports hosting resources - public var supportsResources: Bool { - switch product { - case .app, - .framework, - .unitTests, - .uiTests, - .bundle, - .appExtension, - .watch2App, - .watch2Extension, - .tvTopShelfExtension, - .messagesExtension, - .stickerPackExtension, - .appClip, - .systemExtension, - .extensionKitExtension: - return true - - case .commandLineTool, - .macro, - .dynamicLibrary, - .staticLibrary, - .staticFramework, - .xpc: - return false - } - } - - public var legacyPlatform: Platform { - destinations.first?.platform ?? .iOS - } - - /// Returns true if the target is an AppClip - public var isAppClip: Bool { - if case .appClip = product { - return true - } - return false - } - - /// Determines if the target is an embeddable watch application - /// i.e. a product that can be bundled with a host iOS application - public func isEmbeddableWatchApplication() -> Bool { - let isWatchOS = isExclusiveTo(.watchOS) - let isApp = (product == .watch2App || product == .app) - return isWatchOS && isApp - } - - /// Determines if the target is an embeddable xpc service - /// i.e. a product that can be bundled with a host macOS application - public func isEmbeddableXPCService() -> Bool { - product == .xpc - } - - /// Determines if the target is an embeddable system extension - /// i.e. a product that can be bundled with a host macOS application - public func isEmbeddableSystemExtension() -> Bool { - product == .systemExtension - } - - /// Determines if the target is able to embed a watch application - /// i.e. a product that can be bundled with a watchOS application - public func canEmbedWatchApplications() -> Bool { - supports(.iOS) && product == .app - } - - /// Determines if the target is able to embed an system extension - /// i.e. a product that can be bundled with a macOS application - public func canEmbedSystemExtensions() -> Bool { - supports(.macOS) && product == .app - } - - /// Return the a set of PlatformFilters to control linking based on what platform is being compiled - /// This allows a target to link against a dependency conditionally when it is being compiled for a compatible platform - /// E.g. An app linking against CarPlay only when built for iOS. - public var dependencyPlatformFilters: PlatformFilters { - Set(destinations.map(\.platformFilter)) - } - - // MARK: - Equatable - - public static func == (lhs: Target, rhs: Target) -> Bool { - lhs.name == rhs.name && - lhs.destinations == rhs.destinations && - lhs.product == rhs.product && - lhs.bundleId == rhs.bundleId && - lhs.productName == rhs.productName && - lhs.infoPlist == rhs.infoPlist && - lhs.entitlements == rhs.entitlements && - lhs.settings == rhs.settings && - lhs.sources == rhs.sources && - lhs.resources == rhs.resources && - lhs.headers == rhs.headers && - lhs.coreDataModels == rhs.coreDataModels && - lhs.scripts == rhs.scripts && - lhs.dependencies == rhs.dependencies && - lhs.mergedBinaryType == rhs.mergedBinaryType && - lhs.mergeable == rhs.mergeable && - lhs.environmentVariables == rhs.environmentVariables - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - hasher.combine(destinations) - hasher.combine(product) - hasher.combine(bundleId) - hasher.combine(productName) - hasher.combine(environmentVariables) - } - - /// Returns a new copy of the target with the given InfoPlist set. - /// - Parameter infoPlist: InfoPlist to be set to the copied instance. - public func with(infoPlist: InfoPlist) -> Target { - var copy = self - copy.infoPlist = infoPlist - return copy - } - - /// Returns a new copy of the target with the given entitlements set. - /// - Parameter entitlements: entitlements to be set to the copied instance. - public func with(entitlements: Entitlements) -> Target { - var copy = self - copy.entitlements = entitlements - return copy - } - - /// Returns a new copy of the target with the given scripts. - /// - Parameter scripts: Actions to be set to the copied instance. - public func with(scripts: [TargetScript]) -> Target { - var copy = self - copy.scripts = scripts - return copy - } - - /// Returns a new copy of the target with the given additional settings - /// - Parameter additionalSettings: settings to be added. - public func with(additionalSettings: SettingsDictionary) -> Target { - var copy = self - if let oldSettings = copy.settings { - copy.settings = Settings( - base: oldSettings.base.merging(additionalSettings, uniquingKeysWith: { $1 }), - configurations: oldSettings.configurations, - defaultSettings: oldSettings.defaultSettings - ) - } else { - copy.settings = Settings( - base: additionalSettings, - configurations: [:] - ) - } - return copy - } - - // MARK: - Comparable - - public static func < (lhs: Target, rhs: Target) -> Bool { - lhs.name < rhs.name - } -} - -extension Sequence { - /// Filters and returns only the targets that are test bundles. - var testBundles: [Target] { - filter(\.product.testsBundle) - } - - /// Filters and returns only the targets that are apps and app clips. - var apps: [Target] { - filter { $0.product == .app || $0.product == .appClip } - } -} diff --git a/Sources/XcodeGraph/Models/TargetDependency.swift b/Sources/XcodeGraph/Models/TargetDependency.swift deleted file mode 100644 index 05763bc0003..00000000000 --- a/Sources/XcodeGraph/Models/TargetDependency.swift +++ /dev/null @@ -1,74 +0,0 @@ -import Foundation -import Path - -public enum FrameworkStatus: String, Hashable, Codable { - case required - case optional -} - -public enum SDKStatus: String, Codable { - case required - case optional -} - -public enum TargetDependency: Equatable, Hashable, Codable { - public enum PackageType: String, Equatable, Hashable, Codable { - case runtime - case plugin - case macro - } - - case target(name: String, condition: PlatformCondition? = nil) - case project(target: String, path: AbsolutePath, condition: PlatformCondition? = nil) - case framework(path: AbsolutePath, status: FrameworkStatus, condition: PlatformCondition? = nil) - case xcframework(path: AbsolutePath, status: FrameworkStatus, condition: PlatformCondition? = nil) - case library( - path: AbsolutePath, - publicHeaders: AbsolutePath, - swiftModuleMap: AbsolutePath?, - condition: PlatformCondition? = nil - ) - case package(product: String, type: PackageType, condition: PlatformCondition? = nil) - case sdk(name: String, status: SDKStatus, condition: PlatformCondition? = nil) - case xctest - - public var condition: PlatformCondition? { - switch self { - case .target(name: _, condition: let condition): - condition - case .project(target: _, path: _, condition: let condition): - condition - case .framework(path: _, status: _, condition: let condition): - condition - case .xcframework(path: _, status: _, condition: let condition): - condition - case .library(path: _, publicHeaders: _, swiftModuleMap: _, condition: let condition): - condition - case .package(product: _, type: _, condition: let condition): - condition - case .sdk(name: _, status: _, condition: let condition): - condition - case .xctest: nil - } - } - - public func withCondition(_ condition: PlatformCondition?) -> TargetDependency { - switch self { - case .target(name: let name, condition: _): - return .target(name: name, condition: condition) - case .project(target: let target, path: let path, condition: _): - return .project(target: target, path: path, condition: condition) - case .framework(path: let path, status: let status, condition: _): - return .framework(path: path, status: status, condition: condition) - case .xcframework(path: let path, status: let status, condition: _): - return .xcframework(path: path, status: status, condition: condition) - case .library(path: let path, publicHeaders: let headers, swiftModuleMap: let moduleMap, condition: _): - return .library(path: path, publicHeaders: headers, swiftModuleMap: moduleMap, condition: condition) - case .package(product: let product, type: let type, condition: _): - return .package(product: product, type: type, condition: condition) - case .sdk(name: let name, status: let status, condition: _): - return .sdk(name: name, status: status, condition: condition) - case .xctest: return .xctest - } - } -} diff --git a/Sources/XcodeGraph/Models/TargetReference.swift b/Sources/XcodeGraph/Models/TargetReference.swift deleted file mode 100644 index 5ff8b4d76fa..00000000000 --- a/Sources/XcodeGraph/Models/TargetReference.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation -import Path - -public struct TargetReference: Hashable, Codable { - public var projectPath: AbsolutePath - public var name: String - - public init(projectPath: AbsolutePath, name: String) { - self.projectPath = projectPath - self.name = name - } -} diff --git a/Sources/XcodeGraph/Models/TargetScript.swift b/Sources/XcodeGraph/Models/TargetScript.swift deleted file mode 100644 index a9cf89a567f..00000000000 --- a/Sources/XcodeGraph/Models/TargetScript.swift +++ /dev/null @@ -1,152 +0,0 @@ -import Foundation -import Path - -/// It represents a target script build phase -public struct TargetScript: Equatable, Codable { - /// Order when the script gets executed. - /// - /// - pre: Before the sources and resources build phase. - /// - post: After the sources and resources build phase. - public enum Order: String, Equatable, Codable { - case pre - case post - } - - /// Specifies how to execute the target script - /// - /// - tool: Executes the tool with the given arguments. Tuist will look up the tool on the environment's PATH. - /// - scriptPath: Executes the file at the path with the given arguments. - /// - embedded: Executes the embedded script. This should be a short command. - public enum Script: Equatable, Codable { - case tool(path: String, args: [String] = []) - case scriptPath(path: AbsolutePath, args: [String] = []) - case embedded(String) - } - - /// Name of the build phase when the project gets generated - public let name: String - - /// The script to execute in the script - public let script: Script - - /// The text of the embedded script - public var embeddedScript: String? { - if case let Script.embedded(embeddedScript) = script { - return embeddedScript - } - - return nil - } - - /// Name of the tool to execute. Tuist will look up the tool on the environment's PATH. - public var tool: String? { - if case let Script.tool(tool, _) = script { - return tool - } - - return nil - } - - /// Path to the script to execute. - public var path: AbsolutePath? { - if case let Script.scriptPath(path, _) = script { - return path - } - - return nil - } - - /// Target script order - public let order: Order - - /// Arguments that to be passed - public var arguments: [String] { - switch script { - case let .scriptPath(_, args), let .tool(_, args): - return args - - case .embedded: - return [] - } - } - - /// List of input file paths - public let inputPaths: [String] - - /// List of input filelist paths - public let inputFileListPaths: [AbsolutePath] - - /// List of output file paths - public let outputPaths: [String] - - /// List of output filelist paths - public let outputFileListPaths: [AbsolutePath] - - /// Show environment variables in the logs - public var showEnvVarsInLog: Bool - - /// Whether to skip running this script in incremental builds, if nothing has changed - public let basedOnDependencyAnalysis: Bool? - - /// Whether this script only runs on install builds (default is false) - public let runForInstallBuildsOnly: Bool - - /// The path to the shell which shall execute this script. - public let shellPath: String - - /// The path to the dependency file - public let dependencyFile: AbsolutePath? - - /// Initializes a new target script with its attributes using a script at the given path to be executed. - /// - /// - Parameters: - /// - name: Name of the build phase when the project gets generated - /// - order: Target script order - /// - script: The script to execute in the script - /// - inputPaths: List of input file paths - /// - inputFileListPaths: List of input filelist paths - /// - outputPaths: List of output file paths - /// - outputFileListPaths: List of output filelist paths - /// - showEnvVarsInLog: Show environment variables in the logs - /// - basedOnDependencyAnalysis: Whether to skip running this script in incremental builds - /// - runForInstallBuildsOnly: Whether this script only runs on install builds (default is false) - /// - shellPath: The path to the shell which shall execute this script. Default is `/bin/sh`. - /// - dependencyFile: The path to the dependency file. Default is `nil`. - public init( - name: String, - order: Order, - script: Script = .embedded(""), - inputPaths: [String] = [], - inputFileListPaths: [AbsolutePath] = [], - outputPaths: [String] = [], - outputFileListPaths: [AbsolutePath] = [], - showEnvVarsInLog: Bool = true, - basedOnDependencyAnalysis: Bool? = nil, - runForInstallBuildsOnly: Bool = false, - shellPath: String = "/bin/sh", - dependencyFile: AbsolutePath? = nil - ) { - self.name = name - self.order = order - self.script = script - self.inputPaths = inputPaths - self.inputFileListPaths = inputFileListPaths - self.outputPaths = outputPaths - self.outputFileListPaths = outputFileListPaths - self.showEnvVarsInLog = showEnvVarsInLog - self.basedOnDependencyAnalysis = basedOnDependencyAnalysis - self.runForInstallBuildsOnly = runForInstallBuildsOnly - self.shellPath = shellPath - self.dependencyFile = dependencyFile - } -} - -extension [TargetScript] { - public var preScripts: [TargetScript] { - filter { $0.order == .pre } - } - - public var postScripts: [TargetScript] { - filter { $0.order == .post } - } -} diff --git a/Sources/XcodeGraph/Models/TestAction.swift b/Sources/XcodeGraph/Models/TestAction.swift deleted file mode 100644 index 501251afa70..00000000000 --- a/Sources/XcodeGraph/Models/TestAction.swift +++ /dev/null @@ -1,58 +0,0 @@ -import Foundation -import Path - -public struct TestAction: Equatable, Codable { - // MARK: - Attributes - - public var testPlans: [TestPlan]? - public var targets: [TestableTarget] - public var arguments: Arguments? - public var configurationName: String - public var attachDebugger: Bool - public var coverage: Bool - public var codeCoverageTargets: [TargetReference] - public var expandVariableFromTarget: TargetReference? - public var preActions: [ExecutionAction] - public var postActions: [ExecutionAction] - public var diagnosticsOptions: SchemeDiagnosticsOptions - public var language: String? - public var region: String? - public var preferredScreenCaptureFormat: ScreenCaptureFormat? - public var skippedTests: [String]? - - // MARK: - Init - - public init( - targets: [TestableTarget], - arguments: Arguments?, - configurationName: String, - attachDebugger: Bool, - coverage: Bool, - codeCoverageTargets: [TargetReference], - expandVariableFromTarget: TargetReference?, - preActions: [ExecutionAction], - postActions: [ExecutionAction], - diagnosticsOptions: SchemeDiagnosticsOptions, - language: String? = nil, - region: String? = nil, - preferredScreenCaptureFormat: ScreenCaptureFormat? = nil, - testPlans: [TestPlan]? = nil, - skippedTests: [String]? = nil - ) { - self.testPlans = testPlans - self.targets = targets - self.arguments = arguments - self.configurationName = configurationName - self.attachDebugger = attachDebugger - self.coverage = coverage - self.preActions = preActions - self.postActions = postActions - self.codeCoverageTargets = codeCoverageTargets - self.expandVariableFromTarget = expandVariableFromTarget - self.diagnosticsOptions = diagnosticsOptions - self.language = language - self.region = region - self.preferredScreenCaptureFormat = preferredScreenCaptureFormat - self.skippedTests = skippedTests - } -} diff --git a/Sources/XcodeGraph/Models/TestPlan.swift b/Sources/XcodeGraph/Models/TestPlan.swift deleted file mode 100644 index 341603ae3b4..00000000000 --- a/Sources/XcodeGraph/Models/TestPlan.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation -import Path - -public struct TestPlan: Hashable, Codable { - public let name: String - public let path: AbsolutePath - public let testTargets: [TestableTarget] - public let isDefault: Bool - - public init(path: AbsolutePath, testTargets: [TestableTarget], isDefault: Bool) { - name = path.basenameWithoutExt - self.path = path - self.testTargets = testTargets - self.isDefault = isDefault - } -} diff --git a/Sources/XcodeGraph/Models/Workspace.swift b/Sources/XcodeGraph/Models/Workspace.swift deleted file mode 100644 index b384e31127a..00000000000 --- a/Sources/XcodeGraph/Models/Workspace.swift +++ /dev/null @@ -1,150 +0,0 @@ -import Foundation -import Path -import TSCUtility - -public struct Workspace: Equatable, Codable { - // MARK: - Attributes - - /// Path to where the manifest / root directory of this workspace is located - public var path: AbsolutePath - /// Path to where the `.xcworkspace` will be generated - public var xcWorkspacePath: AbsolutePath - public var name: String - public var projects: [AbsolutePath] - public var schemes: [Scheme] - public var ideTemplateMacros: IDETemplateMacros? - public var additionalFiles: [FileElement] - public var generationOptions: GenerationOptions - - // MARK: - Init - - public init( - path: AbsolutePath, - xcWorkspacePath: AbsolutePath, - name: String, - projects: [AbsolutePath], - schemes: [Scheme] = [], - generationOptions: GenerationOptions = .init( - enableAutomaticXcodeSchemes: false, - autogeneratedWorkspaceSchemes: .enabled( - codeCoverageMode: .disabled, - testingOptions: [], - testLanguage: nil, - testRegion: nil, - testScreenCaptureFormat: nil - ), - lastXcodeUpgradeCheck: nil, - renderMarkdownReadme: false - ), - ideTemplateMacros: IDETemplateMacros? = nil, - additionalFiles: [FileElement] = [] - ) { - self.path = path - self.xcWorkspacePath = xcWorkspacePath - self.name = name - self.projects = projects - self.schemes = schemes - self.generationOptions = generationOptions - self.ideTemplateMacros = ideTemplateMacros - self.additionalFiles = additionalFiles - } -} - -extension Workspace { - public func with(name: String) -> Workspace { - var copy = self - copy.name = name - return copy - } - - public func adding(files: [AbsolutePath]) -> Workspace { - Workspace( - path: path, - xcWorkspacePath: xcWorkspacePath, - name: name, - projects: projects, - schemes: schemes, - generationOptions: generationOptions, - ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles + files.map { .file(path: $0) } - ) - } - - public func replacing(projects: [AbsolutePath]) -> Workspace { - Workspace( - path: path, - xcWorkspacePath: xcWorkspacePath, - name: name, - projects: projects, - schemes: schemes, - generationOptions: generationOptions, - ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles - ) - } - - public func merging(projects otherProjects: [AbsolutePath]) -> Workspace { - Workspace( - path: path, - xcWorkspacePath: xcWorkspacePath, - name: name, - projects: Array(Set(projects + otherProjects)), - schemes: schemes, - generationOptions: generationOptions, - ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles - ) - } - - public func codeCoverageTargets(projects: [Project]) -> [TargetReference] { - switch codeCoverageMode { - case .all, .disabled: return [] - case let .targets(targets): return targets - case .relevant: - let allSchemes = schemes + projects.flatMap(\.schemes) - var resultTargets = Set() - - allSchemes.forEach { scheme in - // try to add code coverage targets only if code coverage is enabled - guard let testAction = scheme.testAction, testAction.coverage else { return } - - let schemeCoverageTargets = testAction.codeCoverageTargets - - // having empty `codeCoverageTargets` means that we should gather code coverage for all build targets - if schemeCoverageTargets.isEmpty, let buildAction = scheme.buildAction { - resultTargets.formUnion(buildAction.targets) - } else { - resultTargets.formUnion(schemeCoverageTargets) - } - } - - // if we find no schemes that gather code coverage data, there are no relevant targets, - // so we disable code coverage - if resultTargets.isEmpty { - return [] - } - - return Array(resultTargets) - } - } -} - -extension Workspace { - public var codeCoverageMode: GenerationOptions.AutogeneratedWorkspaceSchemes.CodeCoverageMode { - switch generationOptions.autogeneratedWorkspaceSchemes { - case let .enabled(codeCoverageMode, _, _, _, _): - return codeCoverageMode - case .disabled: - return .disabled - } - } - - public var testingOptions: TestingOptions { - switch generationOptions.autogeneratedWorkspaceSchemes { - case let .enabled(_, testingOptions, _, _, _): - return testingOptions - case .disabled: - return [] - } - } -} diff --git a/Sources/XcodeGraph/Models/XCFrameworkInfoPlist.swift b/Sources/XcodeGraph/Models/XCFrameworkInfoPlist.swift deleted file mode 100644 index 27b56a1f675..00000000000 --- a/Sources/XcodeGraph/Models/XCFrameworkInfoPlist.swift +++ /dev/null @@ -1,72 +0,0 @@ -import Foundation -import Path - -/// It represents th Info.plist contained in an .xcframework bundle. -public struct XCFrameworkInfoPlist: Codable, Hashable, Equatable { - private enum CodingKeys: String, CodingKey { - case libraries = "AvailableLibraries" - } - - /// It represents a library inside an .xcframework - public struct Library: Codable, Hashable, Equatable { - private enum CodingKeys: String, CodingKey { - case identifier = "LibraryIdentifier" - case path = "LibraryPath" - case architectures = "SupportedArchitectures" - case mergeable = "MergeableMetadata" - } - - /// It represents the library's platform. - public enum Platform: String, Hashable, Codable { - case ios - } - - /// Binary name used to import the library - public var binaryName: String { - path.basenameWithoutExt - } - - /// Library identifier. - public let identifier: String - - /// Path to the library. - public let path: RelativePath - - /// Declares if the library is mergeable or not - public let mergeable: Bool - - /// Architectures the binary is built for. - public let architectures: [BinaryArchitecture] - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(identifier, forKey: .identifier) - try container.encode(path, forKey: .path) - try container.encode(mergeable, forKey: .mergeable) - try container.encode(architectures, forKey: .architectures) - } - - public init( - identifier: String, - path: RelativePath, - mergeable: Bool, - architectures: [BinaryArchitecture] - ) { - self.identifier = identifier - self.path = path - self.mergeable = mergeable - self.architectures = architectures - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - identifier = try container.decode(String.self, forKey: .identifier) - path = try container.decode(RelativePath.self, forKey: .path) - architectures = try container.decode([BinaryArchitecture].self, forKey: .architectures) - mergeable = try container.decodeIfPresent(Bool.self, forKey: .mergeable) ?? false - } - } - - /// List of libraries that are part of the .xcframework. - public let libraries: [Library] -} diff --git a/Sources/XcodeGraphTesting/DependenciesGraph/DependenciesGraph+TestData.swift b/Sources/XcodeGraphTesting/DependenciesGraph/DependenciesGraph+TestData.swift deleted file mode 100644 index fe51b9b2970..00000000000 --- a/Sources/XcodeGraphTesting/DependenciesGraph/DependenciesGraph+TestData.swift +++ /dev/null @@ -1,176 +0,0 @@ -import Foundation -import Path -import XcodeGraph - -extension DependenciesGraph { - public static func test( - externalDependencies: [String: [TargetDependency]] = [:], - externalProjects: [AbsolutePath: Project] = [:] - ) -> Self { - .init(externalDependencies: externalDependencies, externalProjects: externalProjects) - } - - public static func testXCFramework( - name: String = "Test", - // swiftlint:disable:next force_try - path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "Test.xcframework")), - status: FrameworkStatus = .required - ) -> DependenciesGraph { - let externalDependencies = [name: [TargetDependency.xcframework(path: path, status: status)]] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } - - public static func test( - packageFolder: AbsolutePath - ) -> Self { - let externalDependencies = [ - "Tuist": [ - TargetDependency.project( - target: "Tuist", - path: packageFolder - ), - ], - ] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } - - public static func aDependency( - packageFolder: AbsolutePath - ) -> Self { - let externalDependencies = [ - "ALibrary": [ - TargetDependency.project( - target: "ALibrary", - path: packageFolder - ), - ], - ] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } - - public static func anotherDependency( - packageFolder: AbsolutePath - ) -> Self { - let externalDependencies = [ - "AnotherLibrary": [ - TargetDependency.project( - target: "AnotherLibrary", - path: packageFolder - ), - ], - ] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } - - public static func alamofire( - packageFolder: AbsolutePath - ) -> Self { - let externalDependencies = [ - "Alamofire": [ - TargetDependency.project( - target: "Alamofire", - path: packageFolder - ), - ], - ] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } - - public static func googleAppMeasurement( - packageFolder: AbsolutePath - ) -> Self { - let externalDependencies = [ - "GoogleAppMeasurement": [ - TargetDependency.project( - target: "GoogleAppMeasurementTarget", - path: packageFolder - ), - ], - "GoogleAppMeasurementWithoutAdIdSupport": [ - TargetDependency.project( - target: "GoogleAppMeasurementWithoutAdIdSupportTarget", - path: packageFolder - ), - ], - ] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } - - public static func googleUtilities( - packageFolder: AbsolutePath - ) -> Self { - let externalDependencies = [ - "GULAppDelegateSwizzler": [ - TargetDependency.project( - target: "GULAppDelegateSwizzler", - path: packageFolder - ), - ], - "GULMethodSwizzler": [ - TargetDependency.project( - target: "GULMethodSwizzler", - path: packageFolder - ), - ], - "GULNSData": [ - TargetDependency.project( - target: "GULNSData", - path: packageFolder - ), - ], - "GULNetwork": [ - TargetDependency.project( - target: "GULNetwork", - path: packageFolder - ), - ], - ] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } - - public static func nanopb( - packageFolder: AbsolutePath - ) -> Self { - let externalDependencies = [ - "nanopb": [ - TargetDependency.project( - target: "nanopb", - path: packageFolder - ), - ], - ] - - return .init( - externalDependencies: externalDependencies, - externalProjects: [:] - ) - } -} diff --git a/Sources/XcodeGraphTesting/Graph/Graph+TestData.swift b/Sources/XcodeGraphTesting/Graph/Graph+TestData.swift deleted file mode 100644 index 266b1c0c126..00000000000 --- a/Sources/XcodeGraphTesting/Graph/Graph+TestData.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import Path -import XcodeGraph - -extension Graph { - public static func test( - name: String = "graph", - path: AbsolutePath = .root, - workspace: Workspace = .test(), - projects: [AbsolutePath: Project] = [:], - packages: [AbsolutePath: [String: Package]] = [:], - dependencies: [GraphDependency: Set] = [:], - dependencyConditions: [GraphEdge: PlatformCondition] = [:] - ) -> Graph { - Graph( - name: name, - path: path, - workspace: workspace, - projects: projects, - packages: packages, - dependencies: dependencies, - dependencyConditions: dependencyConditions - ) - } -} diff --git a/Sources/XcodeGraphTesting/Graph/GraphDependency+TestData.swift b/Sources/XcodeGraphTesting/Graph/GraphDependency+TestData.swift deleted file mode 100644 index 8373926c6a8..00000000000 --- a/Sources/XcodeGraphTesting/Graph/GraphDependency+TestData.swift +++ /dev/null @@ -1,113 +0,0 @@ -import Foundation -import Path - -@testable import XcodeGraph - -// swiftlint:disable force_try - -extension GraphDependency { - public static func testFramework( - path: AbsolutePath = AbsolutePath.root.appending(component: "Test.framework"), - binaryPath: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "Test.framework/Test")), - dsymPath: AbsolutePath? = nil, - bcsymbolmapPaths: [AbsolutePath] = [], - linking: BinaryLinking = .dynamic, - architectures: [BinaryArchitecture] = [.armv7], - status: FrameworkStatus = .required - ) -> GraphDependency { - GraphDependency.framework( - path: path, - binaryPath: binaryPath, - dsymPath: dsymPath, - bcsymbolmapPaths: bcsymbolmapPaths, - linking: linking, - architectures: architectures, - status: status - ) - } - - public static func testMacro( - path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "macro")) - ) -> GraphDependency { - .macro(path: path) - } - - public static func testXCFramework( - path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "Test.xcframework")), - infoPlist: XCFrameworkInfoPlist = .test(), - primaryBinaryPath: AbsolutePath = AbsolutePath.root - .appending(try! RelativePath(validating: "Test.xcframework/Test")), - linking: BinaryLinking = .dynamic, - status: FrameworkStatus = .required, - macroPath: AbsolutePath? = nil - ) -> GraphDependency { - .xcframework( - GraphDependency.XCFramework( - path: path, - infoPlist: infoPlist, - primaryBinaryPath: primaryBinaryPath, - linking: linking, - mergeable: false, - status: status, - macroPath: macroPath - ) - ) - } - - public static func testTarget( - name: String = "Test", - path: AbsolutePath = .root - ) -> GraphDependency { - .target( - name: name, - path: path - ) - } - - public static func testSDK( - name: String = "XCTest.framework", - path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "XCTest.framework")), - status: SDKStatus = .required, - source: SDKSource = .system - ) -> GraphDependency { - .sdk( - name: name, - path: path, - status: status, - source: source - ) - } - - public static func testLibrary( - path: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "libTuist.a")), - publicHeaders: AbsolutePath = AbsolutePath.root.appending(try! RelativePath(validating: "headers")), - linking: BinaryLinking = .dynamic, - architectures: [BinaryArchitecture] = [.armv7], - swiftModuleMap: AbsolutePath? = nil - ) -> GraphDependency { - .library( - path: path, - publicHeaders: publicHeaders, - linking: linking, - architectures: architectures, - swiftModuleMap: swiftModuleMap - ) - } - - public static func testBundle(path: AbsolutePath = .root.appending(component: "test.bundle")) -> GraphDependency { - .bundle(path: path) - } - - public static func testPackageProduct( - path: AbsolutePath = .root, - product: String = "Tuist" - ) -> GraphDependency { - .packageProduct( - path: path, - product: product, - type: .runtime - ) - } -} - -// swiftlint:enable force_try diff --git a/Sources/XcodeGraphTesting/Graph/GraphTarget+TestData.swift b/Sources/XcodeGraphTesting/Graph/GraphTarget+TestData.swift deleted file mode 100644 index 5bf7fc67822..00000000000 --- a/Sources/XcodeGraphTesting/Graph/GraphTarget+TestData.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation -import Path - -@testable import XcodeGraph - -extension GraphTarget { - public static func test( - path: AbsolutePath = .root, - target: Target = .test(), - project: Project = .test() - ) -> GraphTarget { - GraphTarget( - path: path, - target: target, - project: project - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/AnalyzeAction+TestData.swift b/Sources/XcodeGraphTesting/Models/AnalyzeAction+TestData.swift deleted file mode 100644 index 28e1b7edb24..00000000000 --- a/Sources/XcodeGraphTesting/Models/AnalyzeAction+TestData.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension AnalyzeAction { - public static func test(configurationName: String = "Beta Release") -> AnalyzeAction { - AnalyzeAction(configurationName: configurationName) - } -} diff --git a/Sources/XcodeGraphTesting/Models/ArchiveAction+TestData.swift b/Sources/XcodeGraphTesting/Models/ArchiveAction+TestData.swift deleted file mode 100644 index 0e1e91569ee..00000000000 --- a/Sources/XcodeGraphTesting/Models/ArchiveAction+TestData.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension ArchiveAction { - public static func test( - configurationName: String = "Beta Release", - revealArchiveInOrganizer: Bool = true, - customArchiveName: String? = nil, - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [] - ) -> ArchiveAction { - ArchiveAction( - configurationName: configurationName, - revealArchiveInOrganizer: revealArchiveInOrganizer, - customArchiveName: customArchiveName, - preActions: preActions, - postActions: postActions - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Arguments+TestData.swift b/Sources/XcodeGraphTesting/Models/Arguments+TestData.swift deleted file mode 100644 index ed2d6c956bb..00000000000 --- a/Sources/XcodeGraphTesting/Models/Arguments+TestData.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension Arguments { - public static func test( - environmentVariables: [String: EnvironmentVariable] = [:], - launchArguments: [LaunchArgument] = [] - ) -> Arguments { - Arguments( - environmentVariables: environmentVariables, - launchArguments: launchArguments - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/BuildAction+TestData.swift b/Sources/XcodeGraphTesting/Models/BuildAction+TestData.swift deleted file mode 100644 index b361b92e127..00000000000 --- a/Sources/XcodeGraphTesting/Models/BuildAction+TestData.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation -import Path -import TuistSupport -@testable import XcodeGraph - -extension BuildAction { - public static func test( - targets: [TargetReference] = [TargetReference(projectPath: "/Project", name: "App")], - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [] - ) -> BuildAction { - BuildAction(targets: targets, preActions: preActions, postActions: postActions) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Cloud+TestData.swift b/Sources/XcodeGraphTesting/Models/Cloud+TestData.swift deleted file mode 100644 index 06bebd38e9e..00000000000 --- a/Sources/XcodeGraphTesting/Models/Cloud+TestData.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation -import Path -import TuistSupportTesting -@testable import XcodeGraph - -extension Cloud { - public static func test( - url: URL = URL.test(), - projectId: String = "123", - options: [Cloud.Option] = [] - ) -> Cloud { - Cloud(url: url, projectId: projectId, options: options) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Config+TestData.swift b/Sources/XcodeGraphTesting/Models/Config+TestData.swift deleted file mode 100644 index a62d32b5831..00000000000 --- a/Sources/XcodeGraphTesting/Models/Config+TestData.swift +++ /dev/null @@ -1,44 +0,0 @@ -import Foundation -import Path -import TSCUtility -@testable import XcodeGraph - -extension Config { - public static func test( - compatibleXcodeVersions: CompatibleXcodeVersions = .all, - cloud: Cloud? = Cloud.test(), - swiftVersion: Version? = nil, - plugins: [PluginLocation] = [], - generationOptions: GenerationOptions = Config.default.generationOptions, - path: AbsolutePath? = nil - ) -> Config { - .init( - compatibleXcodeVersions: compatibleXcodeVersions, - cloud: cloud, - swiftVersion: swiftVersion, - plugins: plugins, - generationOptions: generationOptions, - path: path - ) - } -} - -extension Config.GenerationOptions { - public static func test( - resolveDependenciesWithSystemScm: Bool = false, - disablePackageVersionLocking: Bool = false, - clonedSourcePackagesDirPath: AbsolutePath? = nil, - staticSideEffectsWarningTargets: XcodeGraph.Config.GenerationOptions.StaticSideEffectsWarningTargets = .all, - enforceExplicitDependencies: Bool = false, - defaultConfiguration: String? = nil - ) -> Self { - .init( - resolveDependenciesWithSystemScm: resolveDependenciesWithSystemScm, - disablePackageVersionLocking: disablePackageVersionLocking, - clonedSourcePackagesDirPath: clonedSourcePackagesDirPath, - staticSideEffectsWarningTargets: staticSideEffectsWarningTargets, - enforceExplicitDependencies: enforceExplicitDependencies, - defaultConfiguration: defaultConfiguration - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Headers+TestData.swift b/Sources/XcodeGraphTesting/Models/Headers+TestData.swift deleted file mode 100644 index 4a6641b54ea..00000000000 --- a/Sources/XcodeGraphTesting/Models/Headers+TestData.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension Headers { - public static func test( - public: [AbsolutePath] = [], - private: [AbsolutePath] = [], - project: [AbsolutePath] = [] - ) -> Headers { - Headers( - public: `public`, - private: `private`, - project: project - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Metadata/FrameworkMetadata+TestData.swift b/Sources/XcodeGraphTesting/Models/Metadata/FrameworkMetadata+TestData.swift deleted file mode 100644 index 6a016067547..00000000000 --- a/Sources/XcodeGraphTesting/Models/Metadata/FrameworkMetadata+TestData.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation -import Path -import TuistSupport -@testable import XcodeGraph - -extension FrameworkMetadata { - public static func test( - path: AbsolutePath = "/Frameworks/TestFramework.xframework", - binaryPath: AbsolutePath = "/Frameworks/TestFramework.xframework/TestFramework", - dsymPath: AbsolutePath? = nil, - bcsymbolmapPaths: [AbsolutePath] = [], - linking: BinaryLinking = .dynamic, - architectures: [BinaryArchitecture] = [.arm64], - status: FrameworkStatus = .required - ) -> FrameworkMetadata { - FrameworkMetadata( - path: path, - binaryPath: binaryPath, - dsymPath: dsymPath, - bcsymbolmapPaths: bcsymbolmapPaths, - linking: linking, - architectures: architectures, - status: status - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Metadata/LibraryMetadata+TestData.swift b/Sources/XcodeGraphTesting/Models/Metadata/LibraryMetadata+TestData.swift deleted file mode 100644 index 266cddc1ed6..00000000000 --- a/Sources/XcodeGraphTesting/Models/Metadata/LibraryMetadata+TestData.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Foundation -import Path -import TuistSupport -@testable import XcodeGraph - -extension LibraryMetadata { - public static func test( - path: AbsolutePath = "/Libraries/libTest/libTest.a", - publicHeaders: AbsolutePath = "/Libraries/libTest/include", - swiftModuleMap: AbsolutePath? = "/Libraries/libTest/libTest.swiftmodule", - architectures: [BinaryArchitecture] = [.arm64], - linking: BinaryLinking = .static - ) -> LibraryMetadata { - LibraryMetadata( - path: path, - publicHeaders: publicHeaders, - swiftModuleMap: swiftModuleMap, - architectures: architectures, - linking: linking - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Metadata/XCFrameworkMetadata+TestData.swift b/Sources/XcodeGraphTesting/Models/Metadata/XCFrameworkMetadata+TestData.swift deleted file mode 100644 index c9ad0312fb1..00000000000 --- a/Sources/XcodeGraphTesting/Models/Metadata/XCFrameworkMetadata+TestData.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation -import Path -import TuistSupport -@testable import XcodeGraph - -extension XCFrameworkMetadata { - public static func test( - path: AbsolutePath = "/XCFrameworks/XCFramework.xcframework", - infoPlist: XCFrameworkInfoPlist = .test(), - primaryBinaryPath: AbsolutePath = "/XCFrameworks/XCFramework.xcframework/ios-arm64/XCFramework", - linking: BinaryLinking = .dynamic, - mergeable: Bool = false, - status: FrameworkStatus = .required, - macroPath: AbsolutePath? = nil - ) -> XCFrameworkMetadata { - XCFrameworkMetadata( - path: path, - infoPlist: infoPlist, - primaryBinaryPath: primaryBinaryPath, - linking: linking, - mergeable: mergeable, - status: status, - macroPath: macroPath - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/PackageSettings+TestData.swift b/Sources/XcodeGraphTesting/Models/PackageSettings+TestData.swift deleted file mode 100644 index cfef21cb722..00000000000 --- a/Sources/XcodeGraphTesting/Models/PackageSettings+TestData.swift +++ /dev/null @@ -1,24 +0,0 @@ -import Foundation -import Path -import TSCUtility -@testable import XcodeGraph - -extension PackageSettings { - public static func test( - productTypes: [String: Product] = [:], - productDestinations: [String: Destinations] = [:], - baseSettings: Settings = .test(), - targetSettings: [String: SettingsDictionary] = [:], - projectOptions: [String: XcodeGraph.Project.Options] = [:], - swiftToolsVersion: Version = Version("5.4.9") - ) -> PackageSettings { - PackageSettings( - productTypes: productTypes, - productDestinations: productDestinations, - baseSettings: baseSettings, - targetSettings: targetSettings, - projectOptions: projectOptions, - swiftToolsVersion: swiftToolsVersion - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Plugins+TestData.swift b/Sources/XcodeGraphTesting/Models/Plugins+TestData.swift deleted file mode 100644 index 073b0ad7b81..00000000000 --- a/Sources/XcodeGraphTesting/Models/Plugins+TestData.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension Plugins { - public static func test( - projectDescriptionHelpers: [ProjectDescriptionHelpersPlugin] = [], - templatePaths: [AbsolutePath] = [], - resourceSynthesizers: [PluginResourceSynthesizer] = [] - ) -> Plugins { - Plugins( - projectDescriptionHelpers: projectDescriptionHelpers, - templatePaths: templatePaths, - resourceSynthesizers: resourceSynthesizers - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/ProfileAction+TestData.swift b/Sources/XcodeGraphTesting/Models/ProfileAction+TestData.swift deleted file mode 100644 index 18e352ba23d..00000000000 --- a/Sources/XcodeGraphTesting/Models/ProfileAction+TestData.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Foundation -import Path -import TuistSupport -@testable import XcodeGraph - -extension ProfileAction { - public static func test( - configurationName: String = "Beta Release", - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [], - executable: TargetReference? = TargetReference(projectPath: "/Project", name: "App"), - arguments: Arguments? = Arguments.test() - ) -> ProfileAction { - ProfileAction( - configurationName: configurationName, - preActions: preActions, - postActions: postActions, - executable: executable, - arguments: arguments - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Project+TestData.swift b/Sources/XcodeGraphTesting/Models/Project+TestData.swift deleted file mode 100644 index 14c83e8f6f4..00000000000 --- a/Sources/XcodeGraphTesting/Models/Project+TestData.swift +++ /dev/null @@ -1,91 +0,0 @@ -import Foundation -import Path -import TSCUtility -@testable import XcodeGraph - -extension Project { - public static func test( - path: AbsolutePath = try! AbsolutePath(validating: "/Project"), // swiftlint:disable:this force_try - sourceRootPath: AbsolutePath = try! AbsolutePath(validating: "/Project"), // swiftlint:disable:this force_try - // swiftlint:disable:next force_try - xcodeProjPath: AbsolutePath = try! AbsolutePath(validating: "/Project/Project.xcodeproj"), - name: String = "Project", - organizationName: String? = nil, - defaultKnownRegions: [String]? = nil, - developmentRegion: String? = nil, - options: Options = .test(automaticSchemesOptions: .disabled), - settings: Settings = Settings.test(), - filesGroup: ProjectGroup = .group(name: "Project"), - targets: [Target] = [Target.test()], - packages: [Package] = [], - schemes: [Scheme] = [], - ideTemplateMacros: IDETemplateMacros? = nil, - additionalFiles: [FileElement] = [], - resourceSynthesizers: [ResourceSynthesizer] = [], - lastUpgradeCheck: Version? = nil, - isExternal: Bool = false - ) -> Project { - Project( - path: path, - sourceRootPath: sourceRootPath, - xcodeProjPath: xcodeProjPath, - name: name, - organizationName: organizationName, - defaultKnownRegions: defaultKnownRegions, - developmentRegion: developmentRegion, - options: options, - settings: settings, - filesGroup: filesGroup, - targets: targets, - packages: packages, - schemes: schemes, - ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles, - resourceSynthesizers: resourceSynthesizers, - lastUpgradeCheck: lastUpgradeCheck, - isExternal: isExternal - ) - } - - public static func empty( - path: AbsolutePath = try! AbsolutePath(validating: "/test/"), // swiftlint:disable:this force_try - sourceRootPath: AbsolutePath = try! AbsolutePath(validating: "/test/"), // swiftlint:disable:this force_try - xcodeProjPath: AbsolutePath = try! AbsolutePath(validating: "/test/text.xcodeproj"), // swiftlint:disable:this force_try - name: String = "Project", - organizationName: String? = nil, - defaultKnownRegions: [String]? = nil, - developmentRegion: String? = nil, - options: Options = .test(automaticSchemesOptions: .disabled), - settings: Settings = .default, - filesGroup: ProjectGroup = .group(name: "Project"), - targets: [Target] = [], - packages: [Package] = [], - schemes: [Scheme] = [], - ideTemplateMacros: IDETemplateMacros? = nil, - additionalFiles: [FileElement] = [], - resourceSynthesizers: [ResourceSynthesizer] = [], - lastUpgradeCheck: Version? = nil, - isExternal: Bool = false - ) -> Project { - Project( - path: path, - sourceRootPath: sourceRootPath, - xcodeProjPath: xcodeProjPath, - name: name, - organizationName: organizationName, - defaultKnownRegions: defaultKnownRegions, - developmentRegion: developmentRegion, - options: options, - settings: settings, - filesGroup: filesGroup, - targets: targets, - packages: packages, - schemes: schemes, - ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles, - resourceSynthesizers: resourceSynthesizers, - lastUpgradeCheck: lastUpgradeCheck, - isExternal: isExternal - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/RawScriptBuildPhase+TestData.swift b/Sources/XcodeGraphTesting/Models/RawScriptBuildPhase+TestData.swift deleted file mode 100644 index 4ed99315d93..00000000000 --- a/Sources/XcodeGraphTesting/Models/RawScriptBuildPhase+TestData.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension RawScriptBuildPhase { - public static func test( - name: String = "Test", - script: String = "", - showEnvVarsInLog: Bool = false, - hashable: Bool = false - ) -> RawScriptBuildPhase { - RawScriptBuildPhase(name: name, script: script, showEnvVarsInLog: showEnvVarsInLog, hashable: hashable) - } -} diff --git a/Sources/XcodeGraphTesting/Models/ResourceSynthesizerPlugin+TestData.swift b/Sources/XcodeGraphTesting/Models/ResourceSynthesizerPlugin+TestData.swift deleted file mode 100644 index a2e33ac2d09..00000000000 --- a/Sources/XcodeGraphTesting/Models/ResourceSynthesizerPlugin+TestData.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension PluginResourceSynthesizer { - public static func test( - name: String = "Plugin", - path: AbsolutePath = try! AbsolutePath(validating: "/test") // swiftlint:disable:this force_try - ) -> Self { - .init( - name: name, - path: path - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/RunAction+TestData.swift b/Sources/XcodeGraphTesting/Models/RunAction+TestData.swift deleted file mode 100644 index 03c5b69bda0..00000000000 --- a/Sources/XcodeGraphTesting/Models/RunAction+TestData.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import Path -import TuistSupport -@testable import XcodeGraph - -extension RunAction { - public static func test( - configurationName: String = BuildConfiguration.debug.name, - attachDebugger: Bool = true, - customLLDBInitFile: AbsolutePath? = nil, - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [], - executable: TargetReference? = TargetReference(projectPath: "/Project", name: "App"), - filePath: AbsolutePath? = nil, - arguments: Arguments? = Arguments.test(), - options: RunActionOptions = .init(), - diagnosticsOptions: SchemeDiagnosticsOptions = XcodeGraph.SchemeDiagnosticsOptions( - mainThreadCheckerEnabled: true, - performanceAntipatternCheckerEnabled: true - ), - expandVariableFromTarget: TargetReference? = nil, - launchStyle: LaunchStyle = .automatically - ) -> RunAction { - RunAction( - configurationName: configurationName, - attachDebugger: attachDebugger, - customLLDBInitFile: customLLDBInitFile, - preActions: preActions, - postActions: postActions, - executable: executable, - filePath: filePath, - arguments: arguments, - options: options, - diagnosticsOptions: diagnosticsOptions, - expandVariableFromTarget: expandVariableFromTarget, - launchStyle: launchStyle - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Scheme+TestData.swift b/Sources/XcodeGraphTesting/Models/Scheme+TestData.swift deleted file mode 100644 index 4a9b51f8067..00000000000 --- a/Sources/XcodeGraphTesting/Models/Scheme+TestData.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension Scheme { - public static func test( - name: String = "Test", - shared: Bool = false, - buildAction: BuildAction? = BuildAction.test(), - testAction: TestAction? = TestAction.test(), - runAction: RunAction? = RunAction.test(), - archiveAction: ArchiveAction? = ArchiveAction.test(), - profileAction: ProfileAction? = ProfileAction.test(), - analyzeAction: AnalyzeAction? = AnalyzeAction.test() - ) -> Scheme { - Scheme( - name: name, - shared: shared, - buildAction: buildAction, - testAction: testAction, - runAction: runAction, - archiveAction: archiveAction, - profileAction: profileAction, - analyzeAction: analyzeAction - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Settings+TestData.swift b/Sources/XcodeGraphTesting/Models/Settings+TestData.swift deleted file mode 100644 index 950a79ad5ba..00000000000 --- a/Sources/XcodeGraphTesting/Models/Settings+TestData.swift +++ /dev/null @@ -1,48 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension Configuration { - public static func test( - settings: SettingsDictionary = [:], - xcconfig: AbsolutePath? = try! AbsolutePath(validating: "/Config.xcconfig") // swiftlint:disable:this force_try - ) -> Configuration { - Configuration(settings: settings, xcconfig: xcconfig) - } -} - -extension Settings { - public static func test( - base: SettingsDictionary, - debug: Configuration, - release: Configuration - ) -> Settings { - Settings( - base: base, - configurations: [.debug: debug, .release: release] - ) - } - - public static func test( - base: SettingsDictionary = [:], - baseDebug: SettingsDictionary = [:], - configurations: [BuildConfiguration: Configuration?] = [:] - ) -> Settings { - Settings( - base: base, - baseDebug: baseDebug, - configurations: configurations - ) - } - - public static func test(defaultSettings: DefaultSettings) -> Settings { - Settings( - base: [:], - configurations: [ - .debug: Configuration(settings: [:]), - .release: Configuration(settings: [:]), - ], - defaultSettings: defaultSettings - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Target+TestData.swift b/Sources/XcodeGraphTesting/Models/Target+TestData.swift deleted file mode 100644 index ca648e6e495..00000000000 --- a/Sources/XcodeGraphTesting/Models/Target+TestData.swift +++ /dev/null @@ -1,184 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension Target { - /// Creates a Target with test data - /// Note: Referenced paths may not exist - public static func test( - name: String = "Target", - destinations: Destinations = [.iPhone, .iPad], - product: Product = .app, - productName: String? = nil, - bundleId: String? = nil, - deploymentTargets: DeploymentTargets = .iOS("13.1"), - infoPlist: InfoPlist? = nil, - entitlements: Entitlements? = nil, - settings: Settings? = Settings.test(), - sources: [SourceFile] = [], - resources: ResourceFileElements = .init([]), - copyFiles: [CopyFilesAction] = [], - coreDataModels: [CoreDataModel] = [], - headers: Headers? = nil, - scripts: [TargetScript] = [], - environmentVariables: [String: EnvironmentVariable] = [:], - filesGroup: ProjectGroup = .group(name: "Project"), - dependencies: [TargetDependency] = [], - rawScriptBuildPhases: [RawScriptBuildPhase] = [], - launchArguments: [LaunchArgument] = [], - playgrounds: [AbsolutePath] = [], - additionalFiles: [FileElement] = [], - prune: Bool = false, - mergedBinaryType: MergedBinaryType = .disabled, - mergeable: Bool = false - ) -> Target { - Target( - name: name, - destinations: destinations, - product: product, - productName: productName, - bundleId: bundleId ?? "io.tuist.\(name)", - deploymentTargets: deploymentTargets, - infoPlist: infoPlist, - entitlements: entitlements, - settings: settings, - sources: sources, - resources: resources, - copyFiles: copyFiles, - headers: headers, - coreDataModels: coreDataModels, - scripts: scripts, - environmentVariables: environmentVariables, - launchArguments: launchArguments, - filesGroup: filesGroup, - dependencies: dependencies, - rawScriptBuildPhases: rawScriptBuildPhases, - playgrounds: playgrounds, - additionalFiles: additionalFiles, - prune: prune, - mergedBinaryType: mergedBinaryType, - mergeable: mergeable - ) - } - - /// Creates a Target with test data - /// Note: Referenced paths may not exist - public static func test( - name: String = "Target", - platform: Platform, - product: Product = .app, - productName: String? = nil, - bundleId: String? = nil, - deploymentTarget: DeploymentTargets = .iOS("13.1"), - infoPlist: InfoPlist? = nil, - entitlements: Entitlements? = nil, - settings: Settings? = Settings.test(), - sources: [SourceFile] = [], - resources: ResourceFileElements = .init([]), - copyFiles: [CopyFilesAction] = [], - coreDataModels: [CoreDataModel] = [], - headers: Headers? = nil, - scripts: [TargetScript] = [], - environmentVariables: [String: EnvironmentVariable] = [:], - filesGroup: ProjectGroup = .group(name: "Project"), - dependencies: [TargetDependency] = [], - rawScriptBuildPhases: [RawScriptBuildPhase] = [], - launchArguments: [LaunchArgument] = [], - playgrounds: [AbsolutePath] = [], - additionalFiles: [FileElement] = [], - prune: Bool = false, - mergedBinaryType: MergedBinaryType = .disabled, - mergeable: Bool = false - ) -> Target { - Target( - name: name, - destinations: destinationsFrom(platform), - product: product, - productName: productName, - bundleId: bundleId ?? "io.tuist.\(name)", - deploymentTargets: deploymentTarget, - infoPlist: infoPlist, - entitlements: entitlements, - settings: settings, - sources: sources, - resources: resources, - copyFiles: copyFiles, - headers: headers, - coreDataModels: coreDataModels, - scripts: scripts, - environmentVariables: environmentVariables, - launchArguments: launchArguments, - filesGroup: filesGroup, - dependencies: dependencies, - rawScriptBuildPhases: rawScriptBuildPhases, - playgrounds: playgrounds, - additionalFiles: additionalFiles, - prune: prune, - mergedBinaryType: mergedBinaryType, - mergeable: mergeable - ) - } - - /// Creates a bare bones Target with as little data as possible - public static func empty( - name: String = "Target", - destinations: Destinations = [.iPhone, .iPad], - product: Product = .app, - productName: String? = nil, - bundleId: String? = nil, - deploymentTargets: DeploymentTargets = .init(), - infoPlist: InfoPlist? = nil, - entitlements: Entitlements? = nil, - settings: Settings? = nil, - sources: [SourceFile] = [], - resources: ResourceFileElements = .init([]), - copyFiles: [CopyFilesAction] = [], - coreDataModels: [CoreDataModel] = [], - headers: Headers? = nil, - scripts: [TargetScript] = [], - environmentVariables: [String: EnvironmentVariable] = [:], - filesGroup: ProjectGroup = .group(name: "Project"), - dependencies: [TargetDependency] = [], - rawScriptBuildPhases: [RawScriptBuildPhase] = [], - onDemandResourcesTags: OnDemandResourcesTags? = nil - ) -> Target { - Target( - name: name, - destinations: destinations, - product: product, - productName: productName, - bundleId: bundleId ?? "io.tuist.\(name)", - deploymentTargets: deploymentTargets, - infoPlist: infoPlist, - entitlements: entitlements, - settings: settings, - sources: sources, - resources: resources, - copyFiles: copyFiles, - headers: headers, - coreDataModels: coreDataModels, - scripts: scripts, - environmentVariables: environmentVariables, - filesGroup: filesGroup, - dependencies: dependencies, - rawScriptBuildPhases: rawScriptBuildPhases, - onDemandResourcesTags: onDemandResourcesTags - ) - } - - // Maps a platform to a set of Destinations. For migration purposes - private static func destinationsFrom(_ platform: Platform) -> Destinations { - switch platform { - case .iOS: - return .iOS - case .macOS: - return .macOS - case .tvOS: - return .tvOS - case .watchOS: - return .watchOS - case .visionOS: - return .visionOS - } - } -} diff --git a/Sources/XcodeGraphTesting/Models/Template+TestData.swift b/Sources/XcodeGraphTesting/Models/Template+TestData.swift deleted file mode 100644 index 020b6abdac0..00000000000 --- a/Sources/XcodeGraphTesting/Models/Template+TestData.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation -import Path -@testable import XcodeGraph - -extension Template { - public static func test( - description: String = "Template", - attributes: [Attribute] = [], - items: [Template.Item] = [] - ) -> Template { - Template( - description: description, - attributes: attributes, - items: items - ) - } -} - -extension Template.Item { - public static func test( - path: RelativePath, - contents: Template.Contents = .string("test content") - ) -> Template.Item { - Template.Item( - path: path, - contents: contents - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/TestAction+TestData.swift b/Sources/XcodeGraphTesting/Models/TestAction+TestData.swift deleted file mode 100644 index 1459baaa4b1..00000000000 --- a/Sources/XcodeGraphTesting/Models/TestAction+TestData.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation -import Path -import TuistSupport -@testable import XcodeGraph - -extension TestAction { - public static func test( - targets: [TestableTarget] = [TestableTarget(target: TargetReference(projectPath: "/Project", name: "AppTests"))], - arguments: Arguments? = Arguments.test(), - configurationName: String = BuildConfiguration.debug.name, - attachDebugger: Bool = true, - coverage: Bool = false, - codeCoverageTargets: [TargetReference] = [], - expandVariableFromTarget: TargetReference? = nil, - preActions: [ExecutionAction] = [], - postActions: [ExecutionAction] = [], - diagnosticsOptions: SchemeDiagnosticsOptions = SchemeDiagnosticsOptions(mainThreadCheckerEnabled: true), - language: String? = nil, - region: String? = nil, - preferredScreenCaptureFormat: ScreenCaptureFormat? = nil, - testPlans: [TestPlan]? = nil, - skippedTests: [String]? = nil - ) -> TestAction { - TestAction( - targets: targets, - arguments: arguments, - configurationName: configurationName, - attachDebugger: attachDebugger, - coverage: coverage, - codeCoverageTargets: codeCoverageTargets, - expandVariableFromTarget: expandVariableFromTarget, - preActions: preActions, - postActions: postActions, - diagnosticsOptions: diagnosticsOptions, - language: language, - region: region, - preferredScreenCaptureFormat: preferredScreenCaptureFormat, - testPlans: testPlans, - skippedTests: skippedTests - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/TestableTarget+TestData.swift b/Sources/XcodeGraphTesting/Models/TestableTarget+TestData.swift deleted file mode 100644 index ef3a8ad6235..00000000000 --- a/Sources/XcodeGraphTesting/Models/TestableTarget+TestData.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Path -import TuistSupport -import XcodeGraph - -extension TestableTarget { - public static func test( - target: TargetReference = TargetReference(projectPath: "/Project", name: "App"), - skipped: Bool = false, - parallelizable: Bool = false, - randomExecutionOrdering: Bool = false, - simulatedLocation: SimulatedLocation? = nil - ) -> TestableTarget { - TestableTarget( - target: target, - skipped: skipped, - parallelizable: parallelizable, - randomExecutionOrdering: randomExecutionOrdering, - simulatedLocation: simulatedLocation - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/Workspace+TestData.swift b/Sources/XcodeGraphTesting/Models/Workspace+TestData.swift deleted file mode 100644 index f197dafdc68..00000000000 --- a/Sources/XcodeGraphTesting/Models/Workspace+TestData.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import Path -import TSCUtility -@testable import XcodeGraph - -extension Workspace { - public static func test( - path: AbsolutePath = try! AbsolutePath(validating: "/"), // swiftlint:disable:this force_try - xcWorkspacePath: AbsolutePath = try! AbsolutePath(validating: "/"), // swiftlint:disable:this force_try - name: String = "test", - projects: [AbsolutePath] = [], - schemes: [Scheme] = [], - ideTemplateMacros: IDETemplateMacros? = nil, - additionalFiles: [FileElement] = [], - generationOptions: GenerationOptions = .test() - ) -> Workspace { - Workspace( - path: path, - xcWorkspacePath: xcWorkspacePath, - name: name, - projects: projects, - schemes: schemes, - generationOptions: generationOptions, - ideTemplateMacros: ideTemplateMacros, - additionalFiles: additionalFiles - ) - } -} - -extension Workspace.GenerationOptions { - public static func test( - enableAutomaticXcodeSchemes: Bool? = false, - autogeneratedWorkspaceSchemes: AutogeneratedWorkspaceSchemes = .enabled( - codeCoverageMode: .disabled, - testingOptions: [], - testLanguage: nil, - testRegion: nil, - testScreenCaptureFormat: nil - ), - lastXcodeUpgradeCheck: Version? = nil - ) -> Self { - .init( - enableAutomaticXcodeSchemes: enableAutomaticXcodeSchemes, - autogeneratedWorkspaceSchemes: autogeneratedWorkspaceSchemes, - lastXcodeUpgradeCheck: lastXcodeUpgradeCheck, - renderMarkdownReadme: false - ) - } -} diff --git a/Sources/XcodeGraphTesting/Models/XCFrameworkInfoPlist+TestData.swift b/Sources/XcodeGraphTesting/Models/XCFrameworkInfoPlist+TestData.swift deleted file mode 100644 index 832f09e2676..00000000000 --- a/Sources/XcodeGraphTesting/Models/XCFrameworkInfoPlist+TestData.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import Path - -@testable import XcodeGraph - -extension XCFrameworkInfoPlist { - public static func test(libraries: [XCFrameworkInfoPlist.Library] = [.test()]) -> XCFrameworkInfoPlist { - XCFrameworkInfoPlist(libraries: libraries) - } -} - -extension XCFrameworkInfoPlist.Library { - public static func test( - identifier: String = "test", - // swiftlint:disable:next force_try - path: RelativePath = try! RelativePath(validating: "relative/to/library"), - mergeable: Bool = false, - architectures: [BinaryArchitecture] = [.i386] - ) -> XCFrameworkInfoPlist.Library { - XCFrameworkInfoPlist.Library( - identifier: identifier, - path: path, - mergeable: mergeable, - architectures: architectures - ) - } -} diff --git a/Tests/TuistCoreTests/Graph/GraphTraverserTests.swift b/Tests/TuistCoreTests/Graph/GraphTraverserTests.swift index 83d539464e4..cb44cae5686 100644 --- a/Tests/TuistCoreTests/Graph/GraphTraverserTests.swift +++ b/Tests/TuistCoreTests/Graph/GraphTraverserTests.swift @@ -6,7 +6,6 @@ import XCTest @testable import TuistCore @testable import TuistCoreTesting @testable import TuistSupportTesting -@testable import XcodeGraphTesting final class GraphTraverserTests: TuistUnitTestCase { func test_dependsOnXCTest_when_is_framework() { @@ -3869,7 +3868,7 @@ final class GraphTraverserTests: TuistUnitTestCase { ], ], dependencyConditions: [ - GraphEdge(from: appkGraphDependency, to: staticFrameworkGraphDependency): try .test([.ios]), + GraphEdge(from: appkGraphDependency, to: staticFrameworkGraphDependency): try XCTUnwrap(.test([.ios])), ] ) let subject = GraphTraverser(graph: graph) @@ -3910,8 +3909,8 @@ final class GraphTraverserTests: TuistUnitTestCase { ], ], dependencyConditions: [ - GraphEdge(from: appkGraphDependency, to: staticFrameworkGraphDependency): try .test([.macos]), - GraphEdge(from: staticFrameworkGraphDependency, to: sdkGraphDependency): try .test([.ios]), + GraphEdge(from: appkGraphDependency, to: staticFrameworkGraphDependency): try XCTUnwrap(.test([.macos])), + GraphEdge(from: staticFrameworkGraphDependency, to: sdkGraphDependency): try XCTUnwrap(.test([.ios])), ] ) let subject = GraphTraverser(graph: graph) @@ -3950,7 +3949,7 @@ final class GraphTraverserTests: TuistUnitTestCase { ], ], dependencyConditions: [ - GraphEdge(from: staticFrameworkGraphDependency, to: sdkGraphDependency): try .test([.ios]), + GraphEdge(from: staticFrameworkGraphDependency, to: sdkGraphDependency): try XCTUnwrap(.test([.ios])), ] ) let subject = GraphTraverser(graph: graph) @@ -4007,7 +4006,7 @@ final class GraphTraverserTests: TuistUnitTestCase { ], ], dependencyConditions: [ - GraphEdge(from: staticFrameworkAGraphDependency, to: sdkGraphDependency): try .test([.ios]), + GraphEdge(from: staticFrameworkAGraphDependency, to: sdkGraphDependency): try XCTUnwrap(.test([.ios])), ] ) let subject = GraphTraverser(graph: graph) @@ -4077,7 +4076,7 @@ final class GraphTraverserTests: TuistUnitTestCase { ], ], dependencyConditions: [ - GraphEdge(from: appkGraphDependency, to: staticFrameworkBGraphDependency): try .test([.macos]), + GraphEdge(from: appkGraphDependency, to: staticFrameworkBGraphDependency): try XCTUnwrap(.test([.macos])), ] ) let subject = GraphTraverser(graph: graph) @@ -4285,7 +4284,7 @@ final class GraphTraverserTests: TuistUnitTestCase { appDependency: Set([frameworkDependency]), frameworkDependency: Set([]), ] - let platformCondition = try PlatformCondition.test([.ios]) + let platformCondition = try XCTUnwrap(PlatformCondition.test([.ios])) // Given: Value Graph let graph = Graph.test( @@ -4333,7 +4332,7 @@ final class GraphTraverserTests: TuistUnitTestCase { frameworkBDependency: Set([frameworkCDependency]), frameworkCDependency: Set([frameworkDDependency]), ] - let platformCondition = try PlatformCondition.test([.ios]) + let platformCondition = try XCTUnwrap(PlatformCondition.test([.ios])) // Given: Value Graph let graph = Graph.test( diff --git a/Tests/TuistDependenciesTests/Mappers/ExternalProjectsPlatformNarrowerGraphMapperTests.swift b/Tests/TuistDependenciesTests/Mappers/ExternalProjectsPlatformNarrowerGraphMapperTests.swift index 7236eab4dd5..a02716138f0 100644 --- a/Tests/TuistDependenciesTests/Mappers/ExternalProjectsPlatformNarrowerGraphMapperTests.swift +++ b/Tests/TuistDependenciesTests/Mappers/ExternalProjectsPlatformNarrowerGraphMapperTests.swift @@ -1,6 +1,5 @@ import Foundation import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistDependencies diff --git a/Tests/TuistDependenciesTests/Mappers/PruneOrphanExternalTargetsGraphMapperTests.swift b/Tests/TuistDependenciesTests/Mappers/PruneOrphanExternalTargetsGraphMapperTests.swift index f40b56a80b9..5596ce249eb 100644 --- a/Tests/TuistDependenciesTests/Mappers/PruneOrphanExternalTargetsGraphMapperTests.swift +++ b/Tests/TuistDependenciesTests/Mappers/PruneOrphanExternalTargetsGraphMapperTests.swift @@ -1,7 +1,6 @@ import Foundation import Path import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistDependencies diff --git a/Tests/TuistGeneratorIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift b/Tests/TuistGeneratorIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift index 0b82e0fce58..8a6156aa34c 100644 --- a/Tests/TuistGeneratorIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift +++ b/Tests/TuistGeneratorIntegrationTests/Generator/MultipleConfigurationsIntegrationTests.swift @@ -4,7 +4,6 @@ import TSCBasic import TuistCore import TuistLoaderTesting import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorIntegrationTests/Generator/SwiftPackageManagerInteractorTests.swift b/Tests/TuistGeneratorIntegrationTests/Generator/SwiftPackageManagerInteractorTests.swift index 21b216a0d56..1d1c96a3b65 100644 --- a/Tests/TuistGeneratorIntegrationTests/Generator/SwiftPackageManagerInteractorTests.swift +++ b/Tests/TuistGeneratorIntegrationTests/Generator/SwiftPackageManagerInteractorTests.swift @@ -5,7 +5,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorIntegrationTests/Generator/WorkspaceGeneratorIntegrationTests.swift b/Tests/TuistGeneratorIntegrationTests/Generator/WorkspaceGeneratorIntegrationTests.swift index a4c56b337fe..ec7fad19bb0 100644 --- a/Tests/TuistGeneratorIntegrationTests/Generator/WorkspaceGeneratorIntegrationTests.swift +++ b/Tests/TuistGeneratorIntegrationTests/Generator/WorkspaceGeneratorIntegrationTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift b/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift index b41ffe8f516..c63f567ca24 100644 --- a/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift +++ b/Tests/TuistGeneratorTests/Extensions/Xcodeproj+ExtrasTests.swift @@ -2,7 +2,6 @@ import XcodeGraph import XcodeProj import XCTest @testable import TuistGenerator -@testable import XcodeGraphTesting class XcodeprojExtrasTests: XCTestCase { func test_pbxFileElement_sort() { @@ -37,7 +36,7 @@ class XcodeprojExtrasTests: XCTestCase { // Given let target = Target.test(destinations: [.iPhone, .iPad, .mac]) let buildFile = PBXBuildFile() - let dependencyCondition: PlatformCondition = try .test([.ios, .macos]) + let dependencyCondition: PlatformCondition = try XCTUnwrap(.test([.ios, .macos])) // When buildFile.applyCondition(dependencyCondition, applicableTo: target) @@ -64,7 +63,7 @@ class XcodeprojExtrasTests: XCTestCase { // Given let target = Target.test(destinations: [.mac]) let buildFile = PBXBuildFile() - let dependencyCondition: PlatformCondition = try .test([.ios, .macos]) + let dependencyCondition: PlatformCondition = try XCTUnwrap(.test([.ios, .macos])) // When buildFile.applyCondition(dependencyCondition, applicableTo: target) @@ -78,7 +77,7 @@ class XcodeprojExtrasTests: XCTestCase { // Given let target = Target.test(destinations: [.iPhone, .iPad, .mac, .appleVision]) let buildFile = PBXBuildFile() - let dependencyCondition: PlatformCondition = try .test([.ios, .macos]) + let dependencyCondition: PlatformCondition = try XCTUnwrap(.test([.ios, .macos])) // When buildFile.applyCondition(dependencyCondition, applicableTo: target) @@ -92,7 +91,7 @@ class XcodeprojExtrasTests: XCTestCase { // Given let target = Target.test(destinations: [.iPhone, .iPad, .appleVision]) let buildFile = PBXBuildFile() - let dependencyCondition: PlatformCondition = try .test([.ios, .macos]) + let dependencyCondition: PlatformCondition = try XCTUnwrap(.test([.ios, .macos])) // When buildFile.applyCondition(dependencyCondition, applicableTo: target) @@ -106,7 +105,7 @@ class XcodeprojExtrasTests: XCTestCase { // Given let target = Target.test(destinations: [.appleVision]) let buildFile = PBXBuildFile() - let dependencyCondition: PlatformCondition = try .test([.macos]) + let dependencyCondition: PlatformCondition = try XCTUnwrap(.test([.macos])) // When buildFile.applyCondition(dependencyCondition, applicableTo: target) diff --git a/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift index c429e86bf3d..76a3e4f6ac4 100644 --- a/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/BuildPhaseGeneratorTests.swift @@ -4,7 +4,6 @@ import Path import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/ConfigGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/ConfigGeneratorTests.swift index ba23a8187cc..aadafaa7b3b 100644 --- a/Tests/TuistGeneratorTests/Generator/ConfigGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/ConfigGeneratorTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/InfoPlistContentProviderTests.swift b/Tests/TuistGeneratorTests/Generator/InfoPlistContentProviderTests.swift index 8f225123b63..8db215c389b 100644 --- a/Tests/TuistGeneratorTests/Generator/InfoPlistContentProviderTests.swift +++ b/Tests/TuistGeneratorTests/Generator/InfoPlistContentProviderTests.swift @@ -2,7 +2,6 @@ import Foundation import TuistCore import TuistCoreTesting import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift index 379940d6621..e573a08b001 100644 --- a/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistCoreTesting diff --git a/Tests/TuistGeneratorTests/Generator/Mocks/MockInfoPlistContentProvider.swift b/Tests/TuistGeneratorTests/Generator/Mocks/MockInfoPlistContentProvider.swift index f6182df8faa..318dd434b7b 100644 --- a/Tests/TuistGeneratorTests/Generator/Mocks/MockInfoPlistContentProvider.swift +++ b/Tests/TuistGeneratorTests/Generator/Mocks/MockInfoPlistContentProvider.swift @@ -2,7 +2,6 @@ import Foundation import TuistCore import TuistCoreTesting import XcodeGraph -import XcodeGraphTesting @testable import TuistGenerator final class MockInfoPlistContentProvider: InfoPlistContentProviding { diff --git a/Tests/TuistGeneratorTests/Generator/Mocks/MockProjectDescriptorGenerator.swift b/Tests/TuistGeneratorTests/Generator/Mocks/MockProjectDescriptorGenerator.swift index 8a59a14c3aa..929899b4ead 100644 --- a/Tests/TuistGeneratorTests/Generator/Mocks/MockProjectDescriptorGenerator.swift +++ b/Tests/TuistGeneratorTests/Generator/Mocks/MockProjectDescriptorGenerator.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/Mocks/MockSchemeDescriptorsGenerator.swift b/Tests/TuistGeneratorTests/Generator/Mocks/MockSchemeDescriptorsGenerator.swift index e88adda9653..1f8a399896c 100644 --- a/Tests/TuistGeneratorTests/Generator/Mocks/MockSchemeDescriptorsGenerator.swift +++ b/Tests/TuistGeneratorTests/Generator/Mocks/MockSchemeDescriptorsGenerator.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistCoreTesting import XcodeGraph -import XcodeGraphTesting @testable import TuistGenerator final class MockSchemeDescriptorsGenerator: SchemeDescriptorsGenerating { diff --git a/Tests/TuistGeneratorTests/Generator/Mocks/MockTargetGenerator.swift b/Tests/TuistGeneratorTests/Generator/Mocks/MockTargetGenerator.swift index a221447b250..3cd3dbfc5fe 100644 --- a/Tests/TuistGeneratorTests/Generator/Mocks/MockTargetGenerator.swift +++ b/Tests/TuistGeneratorTests/Generator/Mocks/MockTargetGenerator.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/Mocks/MockWorkspaceDescriptorGenerator.swift b/Tests/TuistGeneratorTests/Generator/Mocks/MockWorkspaceDescriptorGenerator.swift index 28bd7d34f1c..789b1bb606f 100644 --- a/Tests/TuistGeneratorTests/Generator/Mocks/MockWorkspaceDescriptorGenerator.swift +++ b/Tests/TuistGeneratorTests/Generator/Mocks/MockWorkspaceDescriptorGenerator.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift index 633d4d3a55f..61651456f9e 100644 --- a/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/ProjectDescriptorGeneratorTests.swift @@ -6,7 +6,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift b/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift index 5fc01f42ac7..c51234e0bc8 100644 --- a/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift +++ b/Tests/TuistGeneratorTests/Generator/ProjectFileElementsTests.swift @@ -4,7 +4,6 @@ import Path import TuistCore import TuistCoreTesting import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift b/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift index 3f705074e24..edec22b6eb3 100644 --- a/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift +++ b/Tests/TuistGeneratorTests/Generator/ProjectGroupsTests.swift @@ -4,7 +4,6 @@ import PathKit import TuistCore import TuistCoreTesting import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift index ca18ad5b80d..a6a48b48d9a 100644 --- a/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/SchemeDescriptorsGeneratorTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest diff --git a/Tests/TuistGeneratorTests/Generator/TargetGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/TargetGeneratorTests.swift index 5a232ac5389..25c99206ef8 100644 --- a/Tests/TuistGeneratorTests/Generator/TargetGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/TargetGeneratorTests.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistCoreTesting import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift index 01d8e585d00..834057763e5 100644 --- a/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/WorkspaceDescriptorGeneratorTests.swift @@ -5,7 +5,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift index 2b2e34147d6..370dfd95e3e 100644 --- a/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/WorkspaceSettingsDescriptorGeneratorTests.swift @@ -5,7 +5,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XcodeProj import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Generator/WorkspaceStructureGeneratorTests.swift b/Tests/TuistGeneratorTests/Generator/WorkspaceStructureGeneratorTests.swift index f45801b0b5a..fb297be002b 100644 --- a/Tests/TuistGeneratorTests/Generator/WorkspaceStructureGeneratorTests.swift +++ b/Tests/TuistGeneratorTests/Generator/WorkspaceStructureGeneratorTests.swift @@ -3,7 +3,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator @testable import TuistSupportTesting diff --git a/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift b/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift index 84607206c62..27e47d7d531 100644 --- a/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift +++ b/Tests/TuistGeneratorTests/GraphMappers/AutogeneratedWorkspaceSchemeWorkspaceMapperTests.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift b/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift index b43db168c07..d3dc34d23a4 100644 --- a/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift +++ b/Tests/TuistGeneratorTests/GraphViz/GraphToGraphVizMapperTests.swift @@ -3,7 +3,6 @@ import GraphViz import Path import TuistCore import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Linter/EnvironmentLinterTests.swift b/Tests/TuistGeneratorTests/Linter/EnvironmentLinterTests.swift index 41c5d869fb3..bc7c6ed5a0b 100644 --- a/Tests/TuistGeneratorTests/Linter/EnvironmentLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/EnvironmentLinterTests.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift b/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift index 87d3cf2c9a3..f4d5703473b 100644 --- a/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/GraphLinterTests.swift @@ -9,7 +9,6 @@ import XCTest @testable import TuistCoreTesting @testable import TuistGenerator @testable import TuistSupportTesting -@testable import XcodeGraphTesting final class GraphLinterTests: TuistUnitTestCase { var subject: GraphLinter! @@ -1765,7 +1764,7 @@ final class GraphLinterTests: TuistUnitTestCase { GraphEdge( from: .target(name: iOSAndMacTarget.name, path: path), to: .target(name: macOnlyTarget.name, path: path) - ): try .test([.macos]), + ): try XCTUnwrap(.test([.macos])), ] ) let config = Config.test() diff --git a/Tests/TuistGeneratorTests/Linter/Mocks/MockPackageLinter.swift b/Tests/TuistGeneratorTests/Linter/Mocks/MockPackageLinter.swift index fe095280015..318297d8786 100644 --- a/Tests/TuistGeneratorTests/Linter/Mocks/MockPackageLinter.swift +++ b/Tests/TuistGeneratorTests/Linter/Mocks/MockPackageLinter.swift @@ -2,7 +2,6 @@ import Foundation import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting @testable import TuistGenerator class MockPackageLinter: PackageLinting { diff --git a/Tests/TuistGeneratorTests/Linter/Mocks/MockProjectLinter.swift b/Tests/TuistGeneratorTests/Linter/Mocks/MockProjectLinter.swift index 89c5dd4b9bf..8c2aef7389c 100644 --- a/Tests/TuistGeneratorTests/Linter/Mocks/MockProjectLinter.swift +++ b/Tests/TuistGeneratorTests/Linter/Mocks/MockProjectLinter.swift @@ -3,7 +3,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting @testable import TuistGenerator class MockProjectLinter: ProjectLinting { diff --git a/Tests/TuistGeneratorTests/Linter/Mocks/MockSchemeLinter.swift b/Tests/TuistGeneratorTests/Linter/Mocks/MockSchemeLinter.swift index f6db4388376..b2987edaec2 100644 --- a/Tests/TuistGeneratorTests/Linter/Mocks/MockSchemeLinter.swift +++ b/Tests/TuistGeneratorTests/Linter/Mocks/MockSchemeLinter.swift @@ -2,7 +2,6 @@ import Foundation import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting @testable import TuistGenerator class MockSchemeLinter: SchemeLinting { diff --git a/Tests/TuistGeneratorTests/Linter/Mocks/MockSettingsLinter.swift b/Tests/TuistGeneratorTests/Linter/Mocks/MockSettingsLinter.swift index f4c6e85fe20..9deb38a314c 100644 --- a/Tests/TuistGeneratorTests/Linter/Mocks/MockSettingsLinter.swift +++ b/Tests/TuistGeneratorTests/Linter/Mocks/MockSettingsLinter.swift @@ -2,7 +2,6 @@ import Foundation import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting @testable import TuistGenerator class MockSettingsLinter: SettingsLinting { diff --git a/Tests/TuistGeneratorTests/Linter/Mocks/MockStaticProductsGraphLinter.swift b/Tests/TuistGeneratorTests/Linter/Mocks/MockStaticProductsGraphLinter.swift index 53254515db4..68582eafccf 100644 --- a/Tests/TuistGeneratorTests/Linter/Mocks/MockStaticProductsGraphLinter.swift +++ b/Tests/TuistGeneratorTests/Linter/Mocks/MockStaticProductsGraphLinter.swift @@ -1,6 +1,5 @@ import Foundation import TuistCore -import XcodeGraph @testable import TuistGenerator class MockStaticProductsGraphLinter: StaticProductsGraphLinting { diff --git a/Tests/TuistGeneratorTests/Linter/Mocks/MockTargetLinter.swift b/Tests/TuistGeneratorTests/Linter/Mocks/MockTargetLinter.swift index 4e32776d6eb..f62868f7f1d 100644 --- a/Tests/TuistGeneratorTests/Linter/Mocks/MockTargetLinter.swift +++ b/Tests/TuistGeneratorTests/Linter/Mocks/MockTargetLinter.swift @@ -2,7 +2,6 @@ import Foundation import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting @testable import TuistGenerator class MockTargetLinter: TargetLinting { diff --git a/Tests/TuistGeneratorTests/Linter/PackageLinterTests.swift b/Tests/TuistGeneratorTests/Linter/PackageLinterTests.swift index fbae149394f..e638ad7e897 100644 --- a/Tests/TuistGeneratorTests/Linter/PackageLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/PackageLinterTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator @testable import TuistSupportTesting diff --git a/Tests/TuistGeneratorTests/Linter/ProjectLinterTests.swift b/Tests/TuistGeneratorTests/Linter/ProjectLinterTests.swift index 4e43a76edba..78dad9dbff8 100644 --- a/Tests/TuistGeneratorTests/Linter/ProjectLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/ProjectLinterTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/Linter/SchemeLinterTests.swift b/Tests/TuistGeneratorTests/Linter/SchemeLinterTests.swift index 707c0935545..08900b93eb6 100644 --- a/Tests/TuistGeneratorTests/Linter/SchemeLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/SchemeLinterTests.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator @testable import TuistSupportTesting diff --git a/Tests/TuistGeneratorTests/Linter/SettingsLinterTests.swift b/Tests/TuistGeneratorTests/Linter/SettingsLinterTests.swift index 401e793e27a..82fe6adbfb4 100644 --- a/Tests/TuistGeneratorTests/Linter/SettingsLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/SettingsLinterTests.swift @@ -6,7 +6,6 @@ import XcodeGraph import XCTest @testable import TuistGenerator @testable import TuistSupportTesting -@testable import XcodeGraphTesting final class SettingsLinterTests: TuistUnitTestCase { var subject: SettingsLinter! diff --git a/Tests/TuistGeneratorTests/Linter/StaticProductsGraphLinterTests.swift b/Tests/TuistGeneratorTests/Linter/StaticProductsGraphLinterTests.swift index e85b5c19641..c940f38a334 100644 --- a/Tests/TuistGeneratorTests/Linter/StaticProductsGraphLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/StaticProductsGraphLinterTests.swift @@ -6,7 +6,6 @@ import XCTest @testable import TuistCoreTesting @testable import TuistGenerator @testable import TuistSupportTesting -@testable import XcodeGraphTesting class StaticProductsGraphLinterTests: XCTestCase { var subject: StaticProductsGraphLinter! diff --git a/Tests/TuistGeneratorTests/Linter/TargetLinterTests.swift b/Tests/TuistGeneratorTests/Linter/TargetLinterTests.swift index d16df7b42eb..008370851ae 100644 --- a/Tests/TuistGeneratorTests/Linter/TargetLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/TargetLinterTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator @testable import TuistSupportTesting diff --git a/Tests/TuistGeneratorTests/Linter/TargetScriptLinterTests.swift b/Tests/TuistGeneratorTests/Linter/TargetScriptLinterTests.swift index 9cf10736619..d2c44b7980b 100644 --- a/Tests/TuistGeneratorTests/Linter/TargetScriptLinterTests.swift +++ b/Tests/TuistGeneratorTests/Linter/TargetScriptLinterTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator @testable import TuistSupportTesting diff --git a/Tests/TuistGeneratorTests/ProjectMappers/AutogeneratedSchemesProjectMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/AutogeneratedSchemesProjectMapperTests.swift index c909de001b0..f3a2f52dd63 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/AutogeneratedSchemesProjectMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/AutogeneratedSchemesProjectMapperTests.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/ProjectMappers/DeleteDerivedDirectoryProjectMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/DeleteDerivedDirectoryProjectMapperTests.swift index 853ab6c6d3f..ef5c4a25d5e 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/DeleteDerivedDirectoryProjectMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/DeleteDerivedDirectoryProjectMapperTests.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/ProjectMappers/GenerateInfoPlistProjectMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/GenerateInfoPlistProjectMapperTests.swift index ae19123aeec..72113aa6624 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/GenerateInfoPlistProjectMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/GenerateInfoPlistProjectMapperTests.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting @testable import TuistGenerator diff --git a/Tests/TuistGeneratorTests/ProjectMappers/ResourcesProjectMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/ResourcesProjectMapperTests.swift index 74ca7f1302d..5976641f069 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/ResourcesProjectMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/ResourcesProjectMapperTests.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting diff --git a/Tests/TuistGeneratorTests/ProjectMappers/SynthesizedResourceInterfaceProjectMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/SynthesizedResourceInterfaceProjectMapperTests.swift index fe21bb16561..cd5c5250f08 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/SynthesizedResourceInterfaceProjectMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/SynthesizedResourceInterfaceProjectMapperTests.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting diff --git a/Tests/TuistGeneratorTests/ProjectMappers/TargetActionDisableShowEnvVarsProjectMapperTests.swift b/Tests/TuistGeneratorTests/ProjectMappers/TargetActionDisableShowEnvVarsProjectMapperTests.swift index 52f490b4d05..73ff03cf7d4 100644 --- a/Tests/TuistGeneratorTests/ProjectMappers/TargetActionDisableShowEnvVarsProjectMapperTests.swift +++ b/Tests/TuistGeneratorTests/ProjectMappers/TargetActionDisableShowEnvVarsProjectMapperTests.swift @@ -1,6 +1,5 @@ import TuistCore import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator @testable import TuistSupportTesting diff --git a/Tests/TuistGeneratorTests/Settings/DefaultSettingsProviderTests.swift b/Tests/TuistGeneratorTests/Settings/DefaultSettingsProviderTests.swift index 86686a85f3e..cbf6ebe07f9 100644 --- a/Tests/TuistGeneratorTests/Settings/DefaultSettingsProviderTests.swift +++ b/Tests/TuistGeneratorTests/Settings/DefaultSettingsProviderTests.swift @@ -2,7 +2,6 @@ import struct TSCUtility.Version import TuistCore import TuistCoreTesting import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistGenerator @testable import TuistSupportTesting diff --git a/Tests/TuistKitTests/Cloud/CloudAuthServiceTests.swift b/Tests/TuistKitTests/Cloud/CloudAuthServiceTests.swift index 5697e1242b1..f5a8958e96f 100644 --- a/Tests/TuistKitTests/Cloud/CloudAuthServiceTests.swift +++ b/Tests/TuistKitTests/Cloud/CloudAuthServiceTests.swift @@ -8,7 +8,6 @@ import TuistLoaderTesting import TuistServer import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistKit @testable import TuistSupportTesting diff --git a/Tests/TuistKitTests/Cloud/CloudCleanServiceTests.swift b/Tests/TuistKitTests/Cloud/CloudCleanServiceTests.swift index 0c58191f42f..ab99e2998e1 100644 --- a/Tests/TuistKitTests/Cloud/CloudCleanServiceTests.swift +++ b/Tests/TuistKitTests/Cloud/CloudCleanServiceTests.swift @@ -1,9 +1,9 @@ import MockableTest +import TuistCore import TuistLoader import TuistServer import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistKit diff --git a/Tests/TuistKitTests/Cloud/CloudInitServiceTests.swift b/Tests/TuistKitTests/Cloud/CloudInitServiceTests.swift index 655872634ab..204865c9f6f 100644 --- a/Tests/TuistKitTests/Cloud/CloudInitServiceTests.swift +++ b/Tests/TuistKitTests/Cloud/CloudInitServiceTests.swift @@ -1,10 +1,10 @@ import MockableTest import Path +import TuistCore import TuistLoader import TuistServer import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistKit diff --git a/Tests/TuistKitTests/Cloud/CloudLogoutServiceTests.swift b/Tests/TuistKitTests/Cloud/CloudLogoutServiceTests.swift index 69873e06f90..1bc48d40305 100644 --- a/Tests/TuistKitTests/Cloud/CloudLogoutServiceTests.swift +++ b/Tests/TuistKitTests/Cloud/CloudLogoutServiceTests.swift @@ -8,7 +8,6 @@ import TuistLoaderTesting import TuistServer import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistKit diff --git a/Tests/TuistKitTests/Cloud/CloudSessionServiceTests.swift b/Tests/TuistKitTests/Cloud/CloudSessionServiceTests.swift index be02c82e377..dfbd6a6a039 100644 --- a/Tests/TuistKitTests/Cloud/CloudSessionServiceTests.swift +++ b/Tests/TuistKitTests/Cloud/CloudSessionServiceTests.swift @@ -8,7 +8,6 @@ import TuistLoaderTesting import TuistServer import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistKit diff --git a/Tests/TuistKitTests/Generator/Mocks/MockGenerator.swift b/Tests/TuistKitTests/Generator/Mocks/MockGenerator.swift new file mode 100644 index 00000000000..7412f32b8a4 --- /dev/null +++ b/Tests/TuistKitTests/Generator/Mocks/MockGenerator.swift @@ -0,0 +1,71 @@ +import Foundation +import Path +import TuistCore +import TuistGenerator +import XcodeGraph +@testable import TuistKit + +final class MockGenerator: Generating { + enum MockError: Error { + case stubNotImplemented + } + + var generateCalls: [AbsolutePath] = [] + var generateStub: ((AbsolutePath) throws -> AbsolutePath)? + func generate(path: AbsolutePath) throws -> AbsolutePath { + guard let generateStub else { + throw MockError.stubNotImplemented + } + + generateCalls.append(path) + return try generateStub(path) + } + + var generateWithGraphCalls: [AbsolutePath] = [] + var generateWithGraphStub: ((AbsolutePath) throws -> (AbsolutePath, Graph))? + func generateWithGraph(path: AbsolutePath) throws -> (AbsolutePath, Graph) { + guard let generateWithGraphStub else { + throw MockError.stubNotImplemented + } + generateWithGraphCalls.append(path) + return try generateWithGraphStub(path) + } + + var invokedGenerateProjectWorkspace = false + var invokedGenerateProjectWorkspaceCount = 0 + var invokedGenerateProjectWorkspaceParameters: (path: AbsolutePath, Void)? + var invokedGenerateProjectWorkspaceParametersList = [(path: AbsolutePath, Void)]() + var stubbedGenerateProjectWorkspaceError: Error? + var stubbedGenerateProjectWorkspaceResult: (AbsolutePath, Graph)! + + func generateProjectWorkspace(path: AbsolutePath) throws -> (AbsolutePath, Graph) { + invokedGenerateProjectWorkspace = true + invokedGenerateProjectWorkspaceCount += 1 + invokedGenerateProjectWorkspaceParameters = (path, ()) + invokedGenerateProjectWorkspaceParametersList.append((path, ())) + if let error = stubbedGenerateProjectWorkspaceError { + throw error + } + return stubbedGenerateProjectWorkspaceResult + } + + var invokedLoadParameterPath: AbsolutePath? + var loadStub: ((AbsolutePath) throws -> Graph)? + func load(path: AbsolutePath) throws -> Graph { + invokedLoadParameterPath = path + if let loadStub { + return try loadStub(path) + } else { + return Graph.test() + } + } + + var loadProjectStub: ((AbsolutePath) throws -> (Project, Graph, [SideEffectDescriptor]))? + func loadProject(path: AbsolutePath) throws -> (Project, Graph, [SideEffectDescriptor]) { + if let loadProjectStub { + return try loadProjectStub(path) + } else { + return (Project.test(), Graph.test(), []) + } + } +} diff --git a/Tests/TuistKitTests/Mappers/Graph/UpdateWorkspaceProjectsGraphMapperTests.swift b/Tests/TuistKitTests/Mappers/Graph/UpdateWorkspaceProjectsGraphMapperTests.swift index cbcfcdd9cd8..5ba7abcf2b7 100644 --- a/Tests/TuistKitTests/Mappers/Graph/UpdateWorkspaceProjectsGraphMapperTests.swift +++ b/Tests/TuistKitTests/Mappers/Graph/UpdateWorkspaceProjectsGraphMapperTests.swift @@ -4,7 +4,6 @@ import TuistCoreTesting import TuistGenerator import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCore diff --git a/Tests/TuistKitTests/Mocks/MockManifestGraphLoader.swift b/Tests/TuistKitTests/Mocks/MockManifestGraphLoader.swift index b54e575d12c..216a1eb5026 100644 --- a/Tests/TuistKitTests/Mocks/MockManifestGraphLoader.swift +++ b/Tests/TuistKitTests/Mocks/MockManifestGraphLoader.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import XcodeGraph -import XcodeGraphTesting @testable import TuistKit final class MockManifestGraphLoader: ManifestGraphLoading { diff --git a/Tests/TuistKitTests/ProjectEditor/Mocks/MockProjectEditorMapper.swift b/Tests/TuistKitTests/ProjectEditor/Mocks/MockProjectEditorMapper.swift index c1be7d1dd18..aa0c2fa7ed5 100644 --- a/Tests/TuistKitTests/ProjectEditor/Mocks/MockProjectEditorMapper.swift +++ b/Tests/TuistKitTests/ProjectEditor/Mocks/MockProjectEditorMapper.swift @@ -3,7 +3,6 @@ import Path import TuistCore import TuistLoader import XcodeGraph -import XcodeGraphTesting @testable import TuistCoreTesting @testable import TuistKit diff --git a/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift b/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift index dfbe022f48a..d304de5cc66 100644 --- a/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift +++ b/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift @@ -6,7 +6,6 @@ import TuistCore import TuistLoader import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistKit diff --git a/Tests/TuistKitTests/ProjectEditor/ProjectEditorTests.swift b/Tests/TuistKitTests/ProjectEditor/ProjectEditorTests.swift index 71052ba16d6..6877e31d428 100644 --- a/Tests/TuistKitTests/ProjectEditor/ProjectEditorTests.swift +++ b/Tests/TuistKitTests/ProjectEditor/ProjectEditorTests.swift @@ -7,7 +7,6 @@ import TuistPlugin import TuistPluginTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting diff --git a/Tests/TuistKitTests/Services/BuildServiceTests.swift b/Tests/TuistKitTests/Services/BuildServiceTests.swift index af79e047678..2b9f1568b52 100644 --- a/Tests/TuistKitTests/Services/BuildServiceTests.swift +++ b/Tests/TuistKitTests/Services/BuildServiceTests.swift @@ -7,7 +7,6 @@ import TuistCore import TuistServer import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistAutomationTesting diff --git a/Tests/TuistKitTests/Services/InitServiceTests.swift b/Tests/TuistKitTests/Services/InitServiceTests.swift index 7a574ee45cb..28e04211c48 100644 --- a/Tests/TuistKitTests/Services/InitServiceTests.swift +++ b/Tests/TuistKitTests/Services/InitServiceTests.swift @@ -1,5 +1,6 @@ import Foundation import Path +import TuistCore import TuistScaffold import TuistSupport import XcodeGraph @@ -67,12 +68,12 @@ final class InitServiceTests: TuistUnitTestCase { let tuistVersion = "4.0.3" tuistVersionLoader.getVersionStub = tuistVersion - let expectedAttributes: [String: XcodeGraph.Template.Attribute.Value] = [ + let expectedAttributes: [String: Template.Attribute.Value] = [ "name": .string("Name"), "platform": .string("macOS"), "tuist_version": .string(tuistVersion), ] - var generatorAttributes: [String: XcodeGraph.Template.Attribute.Value] = [:] + var generatorAttributes: [String: Template.Attribute.Value] = [:] templateGenerator.generateStub = { _, _, attributes in generatorAttributes = attributes } @@ -94,12 +95,12 @@ final class InitServiceTests: TuistUnitTestCase { let tuistVersion = "4.0.3" tuistVersionLoader.getVersionStub = tuistVersion - let expectedAttributes: [String: XcodeGraph.Template.Attribute.Value] = [ + let expectedAttributes: [String: Template.Attribute.Value] = [ "name": .string("Name"), "platform": .string("iOS"), "tuist_version": .string(tuistVersion), ] - var generatorAttributes: [String: XcodeGraph.Template.Attribute.Value] = [:] + var generatorAttributes: [String: Template.Attribute.Value] = [:] templateGenerator.generateStub = { _, _, attributes in generatorAttributes = attributes } @@ -127,14 +128,14 @@ final class InitServiceTests: TuistUnitTestCase { let tuistVersion = "4.0.3" tuistVersionLoader.getVersionStub = tuistVersion - let expectedAttributes: [String: XcodeGraph.Template.Attribute.Value] = [ + let expectedAttributes: [String: Template.Attribute.Value] = [ "name": .string("Name"), "platform": .string("macOS"), "tuist_version": .string(tuistVersion), "required": .string("requiredValue"), "optional": .string("optionalValue"), ] - var generatorAttributes: [String: XcodeGraph.Template.Attribute.Value] = [:] + var generatorAttributes: [String: Template.Attribute.Value] = [:] templateGenerator.generateStub = { _, _, attributes in generatorAttributes = attributes } @@ -155,7 +156,7 @@ final class InitServiceTests: TuistUnitTestCase { func test_optional_dictionary_attribute_is_taken_from_template() async throws { // Given - let context: XcodeGraph.Template.Attribute.Value = .dictionary([ + let context: Template.Attribute.Value = .dictionary([ "key1": .string("value1"), "key2": .string("value2"), ]) @@ -174,14 +175,14 @@ final class InitServiceTests: TuistUnitTestCase { [defaultTemplatePath] } - let expectedAttributes: [String: XcodeGraph.Template.Attribute.Value] = [ + let expectedAttributes: [String: Template.Attribute.Value] = [ "name": .string("Name"), "platform": .string("iOS"), "tuist_version": .string(tuistVersion), "optional": context, ] - var generatorAttributes: [String: XcodeGraph.Template.Attribute.Value] = [:] + var generatorAttributes: [String: Template.Attribute.Value] = [:] templateGenerator.generateStub = { _, _, attributes in generatorAttributes = attributes } @@ -195,7 +196,7 @@ final class InitServiceTests: TuistUnitTestCase { func test_optional_integer_attribute_is_taken_from_template() async throws { // Given - let defaultIntegerValue: XcodeGraph.Template.Attribute.Value = .integer(999) + let defaultIntegerValue: Template.Attribute.Value = .integer(999) templateLoader.loadTemplateStub = { _ in Template.test(attributes: [ @@ -211,14 +212,14 @@ final class InitServiceTests: TuistUnitTestCase { [defaultTemplatePath] } - let expectedAttributes: [String: XcodeGraph.Template.Attribute.Value] = [ + let expectedAttributes: [String: Template.Attribute.Value] = [ "name": .string("Name"), "platform": .string("iOS"), "tuist_version": .string(tuistVersion), "optional": defaultIntegerValue, ] - var generatorAttributes: [String: XcodeGraph.Template.Attribute.Value] = [:] + var generatorAttributes: [String: Template.Attribute.Value] = [:] templateGenerator.generateStub = { _, _, attributes in generatorAttributes = attributes } diff --git a/Tests/TuistKitTests/Services/InstallServiceTests.swift b/Tests/TuistKitTests/Services/InstallServiceTests.swift index 9d6b7e04082..e4a3b874e9e 100644 --- a/Tests/TuistKitTests/Services/InstallServiceTests.swift +++ b/Tests/TuistKitTests/Services/InstallServiceTests.swift @@ -9,7 +9,6 @@ import TuistPluginTesting import TuistSupport import TuistSupportTesting import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistKit diff --git a/Tests/TuistKitTests/Services/ListServiceTests.swift b/Tests/TuistKitTests/Services/ListServiceTests.swift index 2c41b62deaa..c7347b5aed8 100644 --- a/Tests/TuistKitTests/Services/ListServiceTests.swift +++ b/Tests/TuistKitTests/Services/ListServiceTests.swift @@ -1,7 +1,7 @@ import Path +import TuistCore import TuistPluginTesting import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCore diff --git a/Tests/TuistKitTests/Services/RunServiceTests.swift b/Tests/TuistKitTests/Services/RunServiceTests.swift index b76c93f7ffc..01a8482b3ad 100644 --- a/Tests/TuistKitTests/Services/RunServiceTests.swift +++ b/Tests/TuistKitTests/Services/RunServiceTests.swift @@ -6,7 +6,6 @@ import TuistAutomation import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistAutomationTesting diff --git a/Tests/TuistKitTests/Services/ScaffoldServiceTests.swift b/Tests/TuistKitTests/Services/ScaffoldServiceTests.swift index 11724e9b363..f0ac7dfc5e5 100644 --- a/Tests/TuistKitTests/Services/ScaffoldServiceTests.swift +++ b/Tests/TuistKitTests/Services/ScaffoldServiceTests.swift @@ -6,7 +6,6 @@ import TuistLoader import TuistScaffold import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting diff --git a/Tests/TuistKitTests/Services/TestServiceTests.swift b/Tests/TuistKitTests/Services/TestServiceTests.swift index 0e26e76910d..9f8ef42e0a4 100644 --- a/Tests/TuistKitTests/Services/TestServiceTests.swift +++ b/Tests/TuistKitTests/Services/TestServiceTests.swift @@ -6,7 +6,6 @@ import TuistCore import TuistLoader import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistAutomationTesting diff --git a/Tests/TuistKitTests/Utils/TuistAnalyticsDispatcherTests.swift b/Tests/TuistKitTests/Utils/TuistAnalyticsDispatcherTests.swift index 19f1c67553b..45ea8b68b7f 100644 --- a/Tests/TuistKitTests/Utils/TuistAnalyticsDispatcherTests.swift +++ b/Tests/TuistKitTests/Utils/TuistAnalyticsDispatcherTests.swift @@ -4,7 +4,6 @@ import TuistCore import TuistServer import TuistSupport import XcodeGraph - import XCTest @testable import TuistAnalytics @testable import TuistCoreTesting diff --git a/Tests/TuistLoaderIntegrationTests/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilderIntegrationTests.swift b/Tests/TuistLoaderIntegrationTests/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilderIntegrationTests.swift index eaf80198392..bebd3feb151 100644 --- a/Tests/TuistLoaderIntegrationTests/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilderIntegrationTests.swift +++ b/Tests/TuistLoaderIntegrationTests/ProjectDescriptionHelpers/ProjectDescriptionHelpersBuilderIntegrationTests.swift @@ -2,7 +2,6 @@ import Foundation import Path import TuistCore import TuistSupport -import XcodeGraph import XCTest @testable import TuistLoader diff --git a/Tests/TuistLoaderTests/Loaders/CachedManifestLoaderTests.swift b/Tests/TuistLoaderTests/Loaders/CachedManifestLoaderTests.swift index 460143f6fc4..5778cb7e325 100644 --- a/Tests/TuistLoaderTests/Loaders/CachedManifestLoaderTests.swift +++ b/Tests/TuistLoaderTests/Loaders/CachedManifestLoaderTests.swift @@ -3,8 +3,8 @@ import MockableTest import Path import ProjectDescription import TuistCore +import struct TuistCore.Plugins import TuistSupport -import struct XcodeGraph.Plugins import XCTest @testable import TuistCoreTesting @@ -21,8 +21,8 @@ final class CachedManifestLoaderTests: TuistUnitTestCase { private var cacheDirectoriesProviderFactory: MockCacheDirectoriesProviderFactoring! private var workspaceManifests: [AbsolutePath: Workspace] = [:] private var projectManifests: [AbsolutePath: Project] = [:] - private var configManifests: [AbsolutePath: Config] = [:] - private var pluginManifests: [AbsolutePath: Plugin] = [:] + private var configManifests: [AbsolutePath: ProjectDescription.Config] = [:] + private var pluginManifests: [AbsolutePath: ProjectDescription.Plugin] = [:] private var recordedLoadWorkspaceCalls: Int = 0 private var recordedLoadProjectCalls: Int = 0 private var recordedLoadConfigCalls: Int = 0 @@ -337,7 +337,7 @@ final class CachedManifestLoaderTests: TuistUnitTestCase { } private func stub( - deprecatedManifest manifest: Config, + deprecatedManifest manifest: ProjectDescription.Config, at path: AbsolutePath ) throws { let manifestPath = path.appending(component: Manifest.config.fileName(path)) @@ -356,7 +356,7 @@ final class CachedManifestLoaderTests: TuistUnitTestCase { } private func stubPlugins(withHash hash: String) throws { - let plugin = Plugin(name: "TestPlugin") + let plugin = ProjectDescription.Plugin(name: "TestPlugin") let path = try temporaryPath().appending(component: "TestPlugin") let manifestPath = path.appending(component: Manifest.plugin.fileName(path)) try fileHandler.touch(manifestPath) diff --git a/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift b/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift index af30ac64399..c43dfe642d6 100644 --- a/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift +++ b/Tests/TuistLoaderTests/Loaders/ConfigLoaderTests.swift @@ -1,9 +1,9 @@ import Foundation import Path import ProjectDescription +import TuistCore import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistCoreTesting @testable import TuistLoader @@ -71,7 +71,7 @@ final class ConfigLoaderTests: TuistUnitTestCase { let result = try subject.loadConfig(path: path) // Then - XCTAssertEqual(result, XcodeGraph.Config( + XCTAssertEqual(result, TuistCore.Config( compatibleXcodeVersions: .all, cloud: nil, swiftVersion: nil, @@ -111,7 +111,7 @@ final class ConfigLoaderTests: TuistUnitTestCase { let result = try subject.loadConfig(path: "/project/Module/A/") // Then - XCTAssertEqual(result, XcodeGraph.Config( + XCTAssertEqual(result, TuistCore.Config( compatibleXcodeVersions: .all, cloud: nil, swiftVersion: nil, diff --git a/Tests/TuistLoaderTests/Loaders/PackageSettingsLoaderTests.swift b/Tests/TuistLoaderTests/Loaders/PackageSettingsLoaderTests.swift index 2b457df0404..fa8ba2e949e 100644 --- a/Tests/TuistLoaderTests/Loaders/PackageSettingsLoaderTests.swift +++ b/Tests/TuistLoaderTests/Loaders/PackageSettingsLoaderTests.swift @@ -6,7 +6,6 @@ import TuistCore import TuistCoreTesting import TuistSupport import XcodeGraph -import XcodeGraphTesting import XCTest @testable import ProjectDescription @@ -58,7 +57,7 @@ final class PackageSettingsLoaderTests: TuistUnitTestCase { let got = try subject.loadPackageSettings(at: temporaryPath, with: plugins) // Then - let expected: XcodeGraph.PackageSettings = .init( + let expected: TuistCore.PackageSettings = .init( productTypes: [:], productDestinations: [:], baseSettings: XcodeGraph.Settings( diff --git a/Tests/TuistLoaderTests/Loaders/SwiftPackageManagerDependenciesTests.swift b/Tests/TuistLoaderTests/Loaders/SwiftPackageManagerDependenciesTests.swift deleted file mode 100644 index 4e0d872d0eb..00000000000 --- a/Tests/TuistLoaderTests/Loaders/SwiftPackageManagerDependenciesTests.swift +++ /dev/null @@ -1,146 +0,0 @@ -import Foundation -import XCTest -@testable import TuistSupportTesting -@testable import XcodeGraph - -final class SwiftPackageManagerDependenciesTests: TuistUnitTestCase { - func test_manifestValue_singleDependency() throws { - // Given - let subject = SwiftPackageManagerDependencies( - .packages([ - .remote(url: "url/url/url", requirement: .branch("branch")), - ]), - productTypes: [:], - baseSettings: .init(configurations: [:]), - targetSettings: [:], - projectOptions: [:] - ) - - // When - let got = subject.manifest(isLegacy: false, packageManifestFolder: "/") - - // Then - let expected = SwiftPackageManagerDependencies.Manifest.content(""" - import PackageDescription - - let package = Package( - name: "PackageName", - dependencies: [ - .package(url: "url/url/url", branch: "branch"), - ] - ) - """) - XCTAssertEqual(got, expected) - } - - func test_manifestValue_multipleDependencies() throws { - // Given - let subject = SwiftPackageManagerDependencies( - .packages([ - .remote(url: "xyz", requirement: .exact("10.10.10")), - .remote(url: "foo/foo", requirement: .upToNextMinor("1.2.3")), - .remote(url: "bar/bar", requirement: .upToNextMajor("3.2.1")), - .remote(url: "http://xyz.com", requirement: .branch("develop")), - .remote(url: "https://www.google.com/", requirement: .revision("a083aa1435eb35d8a1cb369115a7636cb4b65135")), - .remote(url: "url/url/url", requirement: .range(from: "1.2.3", to: "5.2.1")), - .local(path: "/path/path/path"), - ]), - productTypes: [:], - baseSettings: .init(configurations: [:]), - targetSettings: [:], - projectOptions: [:] - ) - - // When - let got = subject.manifest(isLegacy: false, packageManifestFolder: "/path") - - // Then - let expected = SwiftPackageManagerDependencies.Manifest.content(""" - import PackageDescription - - let package = Package( - name: "PackageName", - dependencies: [ - .package(url: "xyz", exact: "10.10.10"), - .package(url: "foo/foo", .upToNextMinor(from: "1.2.3")), - .package(url: "bar/bar", from: "3.2.1"), - .package(url: "http://xyz.com", branch: "develop"), - .package(url: "https://www.google.com/", revision: "a083aa1435eb35d8a1cb369115a7636cb4b65135"), - .package(url: "url/url/url", "1.2.3" ..< "5.2.1"), - .package(path: "path/path"), - ] - ) - """) - XCTAssertEqual(got, expected) - } - - func test_legacyManifest_singleDependency() throws { - // Given - let subject = SwiftPackageManagerDependencies( - .packages([ - .remote(url: "url/url/url", requirement: .branch("branch")), - ]), - productTypes: [:], - baseSettings: .init(configurations: [:]), - targetSettings: [:], - projectOptions: [:] - ) - - // When - let got = subject.manifest(isLegacy: true, packageManifestFolder: "/path") - - // Then - let expected = SwiftPackageManagerDependencies.Manifest.content(""" - import PackageDescription - - let package = Package( - name: "PackageName", - dependencies: [ - .package(url: "url/url/url", .branch("branch")), - ] - ) - """) - XCTAssertEqual(got, expected) - } - - func test_legacyManifest_multipleDependencies() throws { - // Given - let subject = SwiftPackageManagerDependencies( - .packages([ - .remote(url: "xyz", requirement: .exact("10.10.10")), - .remote(url: "foo/foo", requirement: .upToNextMinor("1.2.3")), - .remote(url: "bar/bar", requirement: .upToNextMajor("3.2.1")), - .remote(url: "http://xyz.com", requirement: .branch("develop")), - .remote(url: "https://www.google.com/", requirement: .revision("a083aa1435eb35d8a1cb369115a7636cb4b65135")), - .remote(url: "url/url/url", requirement: .range(from: "1.2.3", to: "5.2.1")), - .local(path: "/path/path/path"), - ]), - productTypes: [:], - baseSettings: .init(configurations: [:]), - targetSettings: [:], - projectOptions: [:] - ) - - // When - let got = subject.manifest(isLegacy: true, packageManifestFolder: "/path") - - // Then - let expected = SwiftPackageManagerDependencies.Manifest.content(""" - import PackageDescription - - let package = Package( - name: "PackageName", - dependencies: [ - .package(url: "xyz", .exact("10.10.10")), - .package(url: "foo/foo", .upToNextMinor(from: "1.2.3")), - .package(url: "bar/bar", .upToNextMajor(from: "3.2.1")), - .package(url: "http://xyz.com", .branch("develop")), - .package(url: "https://www.google.com/", .revision("a083aa1435eb35d8a1cb369115a7636cb4b65135")), - .package(url: "url/url/url", "1.2.3" ..< "5.2.1"), - .package(path: "path/path"), - ] - ) - """) - XCTAssertEqual(got, expected) - } -} diff --git a/Tests/TuistLoaderTests/Loaders/TemplateGitLoaderTests.swift b/Tests/TuistLoaderTests/Loaders/TemplateGitLoaderTests.swift index 3cb4fe7050a..f01420076c8 100644 --- a/Tests/TuistLoaderTests/Loaders/TemplateGitLoaderTests.swift +++ b/Tests/TuistLoaderTests/Loaders/TemplateGitLoaderTests.swift @@ -1,7 +1,6 @@ import Path import TuistCore import TuistSupport -import XcodeGraph import XCTest @testable import ProjectDescription @@ -43,7 +42,7 @@ final class TemplateGitLoaderTests: TuistUnitTestCase { var pathToLoadTemplateFrom: AbsolutePath? templateLoader.loadTemplateStub = { path in pathToLoadTemplateFrom = path - return XcodeGraph.Template( + return TuistCore.Template( description: "" ) } diff --git a/Tests/TuistLoaderTests/Loaders/TemplateLoaderTests.swift b/Tests/TuistLoaderTests/Loaders/TemplateLoaderTests.swift index f59607fc77b..ca308d6b93c 100644 --- a/Tests/TuistLoaderTests/Loaders/TemplateLoaderTests.swift +++ b/Tests/TuistLoaderTests/Loaders/TemplateLoaderTests.swift @@ -1,7 +1,6 @@ import Path import TuistCore import TuistSupport -import XcodeGraph import XCTest @testable import ProjectDescription @@ -56,7 +55,7 @@ final class TemplateLoaderTests: TuistUnitTestCase { let got = try subject.loadTemplate(at: temporaryPath, plugins: .none) // Then - XCTAssertEqual(got, XcodeGraph.Template( + XCTAssertEqual(got, TuistCore.Template( description: "desc", items: [Template.Item( path: try RelativePath(validating: "generateOne"), diff --git a/Tests/TuistLoaderTests/Models+ManifestMappers/Cloud+ManifestMapperTests.swift b/Tests/TuistLoaderTests/Models+ManifestMappers/Cloud+ManifestMapperTests.swift index f90d555b59c..96775125c38 100644 --- a/Tests/TuistLoaderTests/Models+ManifestMappers/Cloud+ManifestMapperTests.swift +++ b/Tests/TuistLoaderTests/Models+ManifestMappers/Cloud+ManifestMapperTests.swift @@ -1,5 +1,5 @@ import Foundation -import XcodeGraph +import TuistCore import XCTest @testable import TuistLoader @@ -8,7 +8,7 @@ import XCTest final class CloudManifestMapperTests: TuistUnitTestCase { func test_removes_trailing_back_slash_if_present_in_url() throws { // When - let got = try XcodeGraph.Cloud.from( + let got = try TuistCore.Cloud.from( manifest: .cloud( projectId: "tuist/tuist", url: "https://cloud.tuist.io/" diff --git a/Tests/TuistLoaderTests/Models+ManifestMappers/ResourceSynthesizer+ManifestMapperTests.swift b/Tests/TuistLoaderTests/Models+ManifestMappers/ResourceSynthesizer+ManifestMapperTests.swift index 455281a36ec..a4235b867ff 100644 --- a/Tests/TuistLoaderTests/Models+ManifestMappers/ResourceSynthesizer+ManifestMapperTests.swift +++ b/Tests/TuistLoaderTests/Models+ManifestMappers/ResourceSynthesizer+ManifestMapperTests.swift @@ -126,7 +126,7 @@ final class ResourceSynthesizerManifestMapperTests: TuistUnitTestCase { let manifestDirectory = try temporaryPath() var invokedPluginNames: [String] = [] var invokedResourceNames: [String] = [] - var invokedResourceSynthesizerPlugins: [PluginResourceSynthesizer] = [] + var invokedResourceSynthesizerPlugins: [TuistCore.PluginResourceSynthesizer] = [] resourceSynthesizerPathLocator.templatePathStub = { pluginName, resourceName, resourceSynthesizerPlugins in invokedPluginNames.append(pluginName) invokedResourceNames.append(resourceName) diff --git a/Tests/TuistLoaderTests/SwiftPackageManager/PackageInfoMapperTests.swift b/Tests/TuistLoaderTests/SwiftPackageManager/PackageInfoMapperTests.swift index 4063d32bc50..36650c25a56 100644 --- a/Tests/TuistLoaderTests/SwiftPackageManager/PackageInfoMapperTests.swift +++ b/Tests/TuistLoaderTests/SwiftPackageManager/PackageInfoMapperTests.swift @@ -3329,7 +3329,7 @@ extension PackageInfoMapping { basePath: AbsolutePath = "/", packageType: PackageType? = nil, packageInfos: [String: PackageInfo] = [:], - packageSettings: XcodeGraph.PackageSettings = .test( + packageSettings: TuistCore.PackageSettings = .test( baseSettings: .default ) ) throws -> ProjectDescription.Project? { diff --git a/Tests/TuistLoaderTests/Utils/PluginsHelperTests.swift b/Tests/TuistLoaderTests/Utils/PluginsHelperTests.swift index 2e9c2a45194..674fc0763d1 100644 --- a/Tests/TuistLoaderTests/Utils/PluginsHelperTests.swift +++ b/Tests/TuistLoaderTests/Utils/PluginsHelperTests.swift @@ -1,5 +1,6 @@ import Foundation import Path +import TuistCore import TuistSupport import XCTest diff --git a/Tests/TuistPluginTests/PluginServiceTests.swift b/Tests/TuistPluginTests/PluginServiceTests.swift index 49b10f4d1db..f6ead93f450 100644 --- a/Tests/TuistPluginTests/PluginServiceTests.swift +++ b/Tests/TuistPluginTests/PluginServiceTests.swift @@ -12,9 +12,7 @@ import TuistScaffoldTesting import TuistSupport import TuistSupportTesting import XcodeGraph -import XcodeGraphTesting import XCTest - @testable import TuistPlugin final class PluginServiceTests: TuistUnitTestCase { @@ -255,7 +253,7 @@ final class PluginServiceTests: TuistUnitTestCase { ProjectDescription.Plugin(name: pluginName) } - let config = mockConfig(plugins: [XcodeGraph.PluginLocation.local(path: pluginPath.pathString)]) + let config = mockConfig(plugins: [TuistCore.PluginLocation.local(path: pluginPath.pathString)]) try fileHandler.createFolder( pluginPath.appending(component: Constants.helpersDirectoryName) @@ -296,7 +294,7 @@ final class PluginServiceTests: TuistUnitTestCase { try fileHandler.createFolder(cachedPluginPath.appending(component: Constants.helpersDirectoryName)) let config = mockConfig(plugins: [ - XcodeGraph.PluginLocation.git( + TuistCore.PluginLocation.git( url: pluginGitUrl, gitReference: .tag(pluginGitReference), directory: nil, @@ -333,7 +331,7 @@ final class PluginServiceTests: TuistUnitTestCase { ProjectDescription.Plugin(name: pluginName) } - let config = mockConfig(plugins: [XcodeGraph.PluginLocation.local(path: pluginPath.pathString)]) + let config = mockConfig(plugins: [TuistCore.PluginLocation.local(path: pluginPath.pathString)]) // When let plugins = try await subject.loadPlugins(using: config) @@ -370,7 +368,7 @@ final class PluginServiceTests: TuistUnitTestCase { let config = mockConfig(plugins: [ - XcodeGraph.PluginLocation.git( + TuistCore.PluginLocation.git( url: pluginGitUrl, gitReference: .tag(pluginGitReference), directory: nil, @@ -410,7 +408,7 @@ final class PluginServiceTests: TuistUnitTestCase { ProjectDescription.Plugin(name: pluginName) } - let config = mockConfig(plugins: [XcodeGraph.PluginLocation.local(path: pluginPath.pathString)]) + let config = mockConfig(plugins: [TuistCore.PluginLocation.local(path: pluginPath.pathString)]) // Then let plugins = try await subject.loadPlugins(using: config) @@ -449,7 +447,7 @@ final class PluginServiceTests: TuistUnitTestCase { let config = mockConfig(plugins: [ - XcodeGraph.PluginLocation + TuistCore.PluginLocation .git(url: pluginGitUrl, gitReference: .tag(pluginGitReference), directory: nil, releaseUrl: nil), ]) @@ -459,8 +457,8 @@ final class PluginServiceTests: TuistUnitTestCase { XCTAssertEqual(plugins, expectedPlugins) } - private func mockConfig(plugins: [XcodeGraph.PluginLocation]) -> XcodeGraph.Config { - Config( + private func mockConfig(plugins: [TuistCore.PluginLocation]) -> TuistCore.Config { + TuistCore.Config( compatibleXcodeVersions: .all, cloud: nil, swiftVersion: nil, diff --git a/Tests/TuistScaffoldTests/TemplateGeneratorTests.swift b/Tests/TuistScaffoldTests/TemplateGeneratorTests.swift index 892d84109e0..b8bb4733f46 100644 --- a/Tests/TuistScaffoldTests/TemplateGeneratorTests.swift +++ b/Tests/TuistScaffoldTests/TemplateGeneratorTests.swift @@ -1,7 +1,7 @@ import Foundation import Path +import TuistCore import TuistSupport -import XcodeGraph import XCTest @testable import TuistCore diff --git a/Tests/TuistServerTests/Services/AnalyticsArtifactUploadServiceTests.swift b/Tests/TuistServerTests/Services/AnalyticsArtifactUploadServiceTests.swift index bd93a6d72dc..a9d76d5fcc1 100644 --- a/Tests/TuistServerTests/Services/AnalyticsArtifactUploadServiceTests.swift +++ b/Tests/TuistServerTests/Services/AnalyticsArtifactUploadServiceTests.swift @@ -3,7 +3,6 @@ import MockableTest import TuistSupport import TuistSupportTesting import XcodeGraph -import XcodeGraphTesting import XCTest @testable import TuistServer diff --git a/Tests/XcodeGraphTests/Models/TargetTests.swift b/Tests/XcodeGraphTests/Models/TargetTests.swift index d9ada08cfbc..ebbe512dba8 100644 --- a/Tests/XcodeGraphTests/Models/TargetTests.swift +++ b/Tests/XcodeGraphTests/Models/TargetTests.swift @@ -5,7 +5,6 @@ import TuistSupport import XCTest @testable import TuistSupportTesting @testable import XcodeGraph -@testable import XcodeGraphTesting final class TargetErrorTests: TuistUnitTestCase { func test_description() { diff --git a/Tuist/ProjectDescriptionHelpers/Module.swift b/Tuist/ProjectDescriptionHelpers/Module.swift index 45da26790b9..ff9914dc497 100644 --- a/Tuist/ProjectDescriptionHelpers/Module.swift +++ b/Tuist/ProjectDescriptionHelpers/Module.swift @@ -386,14 +386,11 @@ public enum Module: String, CaseIterable { .external(name: "ArgumentParser"), .external(name: "GraphViz"), .external(name: "AnyCodable"), - .external(name: "XcodeGraphTesting"), ] case .core: [ .target(name: Module.support.targetName), .target(name: Module.support.testingTargetName!), - .external(name: "XcodeGraph"), - .external(name: "XcodeGraphTesting"), ] case .generator: [ @@ -401,25 +398,21 @@ public enum Module: String, CaseIterable { .target(name: Module.support.testingTargetName!), .external(name: "XcodeProj"), .external(name: "GraphViz"), - .external(name: "XcodeGraphTesting"), ] case .scaffold: [ .target(name: Module.support.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .loader: [ .target(name: Module.support.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .asyncQueue: [ .target(name: Module.support.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), .external(name: "Queuer"), ] case .plugin: @@ -431,32 +424,27 @@ public enum Module: String, CaseIterable { .target(name: Module.support.testingTargetName!), .target(name: Module.scaffold.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .analytics: [ .target(name: Module.support.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .migration: [ .target(name: Module.support.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .dependencies: [ .target(name: Module.core.testingTargetName!), .target(name: Module.loader.testingTargetName!), .target(name: Module.support.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .automation: [ .target(name: Module.support.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .app: [ @@ -493,19 +481,16 @@ public enum Module: String, CaseIterable { .target(name: Module.support.targetName), .target(name: Module.support.testingTargetName!), .external(name: "XcodeGraph"), - .external(name: "XcodeGraphTesting"), ] case .generator: [ .target(name: Module.core.testingTargetName!), .target(name: Module.support.testingTargetName!), - .external(name: "XcodeGraphTesting"), .external(name: "XcodeProj"), ] case .scaffold: [ .external(name: "XcodeGraph"), - .external(name: "XcodeGraphTesting"), ] case .loader: [ @@ -513,11 +498,9 @@ public enum Module: String, CaseIterable { .target(name: Module.projectDescription.targetName), .target(name: Module.support.testingTargetName!), .external(name: "XcodeGraph"), - .external(name: "XcodeGraphTesting"), ] case .asyncQueue: [ - .external(name: "XcodeGraphTesting"), ] case .plugin: [ @@ -527,12 +510,10 @@ public enum Module: String, CaseIterable { [] case .migration: [ - .external(name: "XcodeGraphTesting"), ] case .dependencies: [ .target(name: Module.projectDescription.targetName), - .external(name: "XcodeGraphTesting"), ] case .automation: [ @@ -540,7 +521,6 @@ public enum Module: String, CaseIterable { .target(name: Module.core.testingTargetName!), .target(name: Module.projectDescription.targetName), .target(name: Module.support.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .app: [] @@ -559,7 +539,6 @@ public enum Module: String, CaseIterable { .target(name: Module.support.targetName), .target(name: Module.core.testingTargetName!), .target(name: Module.loader.testingTargetName!), - .external(name: "XcodeGraphTesting"), .external(name: "SwiftToolsSupport"), .external(name: "XcodeProj"), ] @@ -570,7 +549,6 @@ public enum Module: String, CaseIterable { .target(name: Module.projectDescription.targetName), .target(name: Module.automation.targetName), .target(name: Module.loader.testingTargetName!), - .external(name: "XcodeGraphTesting"), .external(name: "XcodeProj"), ] case .core: @@ -581,19 +559,16 @@ public enum Module: String, CaseIterable { [ .target(name: Module.core.testingTargetName!), .target(name: Module.support.testingTargetName!), - .external(name: "XcodeGraphTesting"), .external(name: "XcodeProj"), ] case .scaffold: [ .target(name: Module.support.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .loader: [ .target(name: Module.support.testingTargetName!), .target(name: Module.projectDescription.targetName), - .external(name: "XcodeGraphTesting"), ] case .asyncQueue: [] @@ -605,14 +580,12 @@ public enum Module: String, CaseIterable { [ .target(name: Module.support.testingTargetName!), .target(name: Module.core.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .dependencies: [] case .automation: [ .target(name: Module.support.testingTargetName!), - .external(name: "XcodeGraphTesting"), ] case .app: []