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 8e31ff9
Show file tree
Hide file tree
Showing 6 changed files with 72 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
<!-- REPLACE WITH GoogleService-Info.plist IN STAGING -->
13 changes: 13 additions & 0 deletions {PROJECT_NAME}/Configurations/XCConfigs/DebugDev.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BUILD_ACTIVE_RESOURCES_ONLY = YES
DEBUG_INFORMATION_FORMAT = dwarf
ENABLE_NS_ASSERTIONS = YES
ENABLE_TESTABILITY = YES
GCC_OPTIMIZATION_LEVEL = 0
ONLY_ACTIVE_ARCH = YES
SWIFT_OPTIMIZATION_LEVEL = -Onone

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1 DEV=1
APP_DISPLAY_NAME = $(TARGET_NAME) Dev
PRODUCT_BUNDLE_IDENTIFIER = {BUNDLE_ID_DEV}
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG DEV
OTHER_SWIFT_FLAGS = $(inherited) -Xfrontend -warn-long-expression-type-checking=300 -Xfrontend -warn-long-function-bodies=300
12 changes: 12 additions & 0 deletions {PROJECT_NAME}/Configurations/XCConfigs/ReleaseDev.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
ENABLE_NS_ASSERTIONS = NO
GCC_OPTIMIZATION_LEVEL = s
SWIFT_COMPILATION_MODE = wholemodule
SWIFT_OPTIMIZATION_LEVEL = -O
ENABLE_BITCODE = NO

ENABLE_BITCODE = NO
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEV=1
APP_DISPLAY_NAME = $(TARGET_NAME) DEV
PRODUCT_BUNDLE_IDENTIFIER = {BUNDLE_ID_DEV}
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEV RELEASE

0 comments on commit 8e31ff9

Please sign in to comment.