From eb58626e1c3d64e3acc96040383fa9ba6db6d6d0 Mon Sep 17 00:00:00 2001 From: Huy Hoang Date: Tue, 31 Dec 2024 10:26:20 +0700 Subject: [PATCH] Add dev scheme --- Project.swift | 1 + .../BuildConfiguration.swift | 36 +++++++++++-------- .../Scheme+Initializing.swift | 17 +++++++++ 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/Project.swift b/Project.swift index c58b5cd2..d0b84f8e 100644 --- a/Project.swift +++ b/Project.swift @@ -22,6 +22,7 @@ extension Project { schemes: [ .productionScheme(name: name), .stagingScheme(name: name), + .devScheme(name: name) .kifUITestsScheme(name: name) ] ) diff --git a/Tuist/ProjectDescriptionHelpers/BuildConfiguration.swift b/Tuist/ProjectDescriptionHelpers/BuildConfiguration.swift index 930edded..eb2686be 100644 --- a/Tuist/ProjectDescriptionHelpers/BuildConfiguration.swift +++ b/Tuist/ProjectDescriptionHelpers/BuildConfiguration.swift @@ -2,6 +2,8 @@ import ProjectDescription public enum BuildConfiguration: CaseIterable { + case debugDev + case releaseDev case debugStaging case releaseStaging case debugProduction @@ -9,33 +11,39 @@ public enum BuildConfiguration: CaseIterable { var name: ConfigurationName { switch self { - case .debugStaging: return .configuration("Debug Staging") - case .releaseStaging: return .configuration("Release Staging") - case .debugProduction: return .configuration("Debug Production") - case .releaseProduction: return .configuration("Release Production") + case .debugDev: .configuration("Debug Dev") + case .releaseDev: .configuration("Release Dev") + case .debugStaging: .configuration("Debug Staging") + case .releaseStaging: .configuration("Release Staging") + case .debugProduction: .configuration("Debug Production") + case .releaseProduction: .configuration("Release Production") } } private var path: String { let rootPath = "Configurations/XCConfigs/" switch self { - case .debugStaging: - return "\(rootPath)DebugStaging.xcconfig" - case .releaseStaging: - return "\(rootPath)ReleaseStaging.xcconfig" - case .debugProduction: - return "\(rootPath)DebugProduction.xcconfig" - case .releaseProduction: - return "\(rootPath)ReleaseProduction.xcconfig" + case .debugDev: + return "\(rootPath)DebugDev.xcconfig" + case .releaseDev: + return "\(rootPath)DebugDev.xcconfig" + case .debugStaging: + return "\(rootPath)DebugStaging.xcconfig" + case .releaseStaging: + return "\(rootPath)ReleaseStaging.xcconfig" + case .debugProduction: + return "\(rootPath)DebugProduction.xcconfig" + case .releaseProduction: + return "\(rootPath)ReleaseProduction.xcconfig" } } public func createConfiguration(projectName: String) -> Configuration { let xcconfig = Path("\(projectName)/\(path)") switch self { - case .debugStaging, .debugProduction: + case .debugDev, .debugStaging, .debugProduction: return .debug(name: name, xcconfig: xcconfig) - case .releaseStaging, .releaseProduction: + case .releaseDev, .releaseStaging, .releaseProduction: return .release(name: name, xcconfig: xcconfig) } } diff --git a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift index cda644fd..1813f9c6 100644 --- a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift @@ -36,6 +36,23 @@ extension Scheme { ) } + public static func devScheme(name: String) -> Scheme { + let debugConfigName = BuildConfiguration.debugDev.name + let releaseConfigName = BuildConfiguration.releaseDev.name + let testModules = testSchemes(name) + + return Scheme( + name: "\(name) Dev", + shared: true, + buildAction: .buildAction(targets: ["\(name)"]), + testAction: .targets(testModules, configuration: debugConfigName), + runAction: .runAction(configuration: debugConfigName), + archiveAction: .archiveAction(configuration: releaseConfigName), + profileAction: .profileAction(configuration: debugConfigName), + analyzeAction: .analyzeAction(configuration: debugConfigName) + ) + } + public static func kifUITestsScheme(name: String) -> Scheme { return Scheme( name: "\(name)KIFUITests",