Skip to content

Commit

Permalink
[Infra] Build Configuration 추가, Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jisu15-kim committed Sep 18, 2024
1 parent ad3e747 commit 812bbe9
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ let project: Project = .make(
name: .debug,
settings: BuildSetting.App.dev_debug
),
.release(
name: .configuration("Staging"),
settings: BuildSetting.App.dev_release
),
.release(
name: .release,
settings: BuildSetting.App.dev_release
Expand All @@ -52,6 +56,10 @@ let project: Project = .make(
name: .debug,
settings: BuildSetting.App.prod_debug
),
.release(
name: .configuration("Staging"),
settings: BuildSetting.App.prod_release
),
.release(
name: .release,
settings: BuildSetting.App.prod_release
Expand Down
4 changes: 2 additions & 2 deletions Projects/App/Sources/ThreeDaysApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct ThreeDaysApp: App {
WindowGroup {
ZStack(alignment: .bottomLeading) {
rootView
#if DEBUG
#if STAGING || DEBUG
debugMenuPicker
.padding(.leading, 16)
.padding(.bottom, 16)
Expand All @@ -31,7 +31,7 @@ struct ThreeDaysApp: App {
}
}

#if DEBUG
#if STAGING || DEBUG
@ViewBuilder
var debugMenuPicker: some View {
Menu("🚀 개발모드") {
Expand Down
5 changes: 5 additions & 0 deletions Projects/Core/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import ProjectDescriptionHelpers

let project: Project = .make(
name: "Core",
settings: .settings(configurations: [
.debug(name: .debug),
.release(name: .configuration("Staging")),
.release(name: .release)
]),
targets: [
.make(target: .coreKit),
.make(target: .model),
Expand Down
5 changes: 5 additions & 0 deletions Projects/DesignSystem/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import ProjectDescriptionHelpers

let project: Project = .make(
name: "DesignSystem",
settings: .settings(configurations: [
.debug(name: .debug),
.release(name: .configuration("Staging")),
.release(name: .release)
]),
targets: [
.make(
target: .DesignCore,
Expand Down
9 changes: 8 additions & 1 deletion Tuist/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import PackageDescription
// Customize the product types for specific package product
// Default is .staticFramework
// productTypes: ["Alamofire": .framework,]
productTypes: [:]
productTypes: [:],
baseSettings: .settings(
configurations: [
.debug(name: .debug),
.release(name: .configuration("Staging")),
.release(name: .release)
]
)
)
#endif

Expand Down
19 changes: 19 additions & 0 deletions Tuist/ProjectDescriptionHelpers/Project+extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ extension Project {
)
}

targetSettings?.configurations = [
.debug(
name: .debug,
settings: configCompilation("DEBUG")
),
.release(
name: .configuration("Staging"),
settings: configCompilation("STAGING")
),
.release(
name: .release,
settings: configCompilation("RELEASE")
)
]

return Project(
name: name,
organizationName: "com.weave",
Expand All @@ -42,3 +57,7 @@ extension Project {
)
}
}

fileprivate func configCompilation(_ value: String) -> SettingsDictionary {
return ["SWIFT_ACTIVE_COMPILATION_CONDITIONS": .string(value)]
}
11 changes: 10 additions & 1 deletion Tuist/ProjectDescriptionHelpers/Target+extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ extension Target {
)
}

targetSettings?.base.merge(
["SWIFT_ACTIVE_COMPILATION_CONDITIONS": "$(inherited)"]
)

return .target(
name: name,
destinations: destinations,
Expand Down Expand Up @@ -80,7 +84,12 @@ extension Target {
bundleId: "com.weave.three-days-\(target.name)",
sources: ["\(target.sources)"],
resources: useResource ? ["\(target.resources)"] : nil,
dependencies: dependencies
dependencies: dependencies,
settings: .settings(configurations: [
.debug(name: .debug),
.release(name: .configuration("Staging")),
.release(name: .release)
])
)
}

Expand Down
2 changes: 1 addition & 1 deletion Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let workspace = Workspace(
configuration: .debug,
arguments: .arguments(environmentVariables: ["IDEPreferLogStreaming": "YES"])
),
archiveAction: .archiveAction(configuration: .debug),
archiveAction: .archiveAction(configuration: .configuration("Staging")),
profileAction: .profileAction(configuration: .debug),
analyzeAction: .analyzeAction(configuration: .debug)
),
Expand Down

0 comments on commit 812bbe9

Please sign in to comment.