Skip to content

Commit

Permalink
[#558] Add dev scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhoangpq committed Dec 31, 2024
1 parent 7262852 commit e31c42b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
1 change: 1 addition & 0 deletions Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extension Project {
schemes: [
.productionScheme(name: name),
.stagingScheme(name: name),
.devScheme(name: name),
.kifUITestsScheme(name: name)
]
)
Expand Down
36 changes: 22 additions & 14 deletions Tuist/ProjectDescriptionHelpers/BuildConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,48 @@ import ProjectDescription

public enum BuildConfiguration: CaseIterable {

case debugDev
case releaseDev
case debugStaging
case releaseStaging
case debugProduction
case releaseProduction

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)
}
}
Expand Down
17 changes: 17 additions & 0 deletions Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e31c42b

Please sign in to comment.