From 812bbe9dd5462d877358917cee28ec41bb3290c8 Mon Sep 17 00:00:00 2001 From: Jisu Kim Date: Thu, 19 Sep 2024 01:03:28 +0900 Subject: [PATCH] =?UTF-8?q?[Infra]=20Build=20Configuration=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80,=20Setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Project.swift | 8 ++++++++ Projects/App/Sources/ThreeDaysApp.swift | 4 ++-- Projects/Core/Project.swift | 5 +++++ Projects/DesignSystem/Project.swift | 5 +++++ Tuist/Package.swift | 9 ++++++++- .../Project+extensions.swift | 19 +++++++++++++++++++ .../Target+extensions.swift | 11 ++++++++++- Workspace.swift | 2 +- 8 files changed, 58 insertions(+), 5 deletions(-) diff --git a/Projects/App/Project.swift b/Projects/App/Project.swift index d515fad..500525f 100644 --- a/Projects/App/Project.swift +++ b/Projects/App/Project.swift @@ -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 @@ -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 diff --git a/Projects/App/Sources/ThreeDaysApp.swift b/Projects/App/Sources/ThreeDaysApp.swift index 6a630bb..4dd6c04 100644 --- a/Projects/App/Sources/ThreeDaysApp.swift +++ b/Projects/App/Sources/ThreeDaysApp.swift @@ -12,7 +12,7 @@ struct ThreeDaysApp: App { WindowGroup { ZStack(alignment: .bottomLeading) { rootView - #if DEBUG + #if STAGING || DEBUG debugMenuPicker .padding(.leading, 16) .padding(.bottom, 16) @@ -31,7 +31,7 @@ struct ThreeDaysApp: App { } } - #if DEBUG + #if STAGING || DEBUG @ViewBuilder var debugMenuPicker: some View { Menu("🚀 개발모드") { diff --git a/Projects/Core/Project.swift b/Projects/Core/Project.swift index 04ad0e5..e602a71 100644 --- a/Projects/Core/Project.swift +++ b/Projects/Core/Project.swift @@ -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), diff --git a/Projects/DesignSystem/Project.swift b/Projects/DesignSystem/Project.swift index 7746373..f4e4ace 100644 --- a/Projects/DesignSystem/Project.swift +++ b/Projects/DesignSystem/Project.swift @@ -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, diff --git a/Tuist/Package.swift b/Tuist/Package.swift index 0ffcf37..a71fa46 100644 --- a/Tuist/Package.swift +++ b/Tuist/Package.swift @@ -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 diff --git a/Tuist/ProjectDescriptionHelpers/Project+extensions.swift b/Tuist/ProjectDescriptionHelpers/Project+extensions.swift index 4d32565..dbd2f38 100644 --- a/Tuist/ProjectDescriptionHelpers/Project+extensions.swift +++ b/Tuist/ProjectDescriptionHelpers/Project+extensions.swift @@ -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", @@ -42,3 +57,7 @@ extension Project { ) } } + +fileprivate func configCompilation(_ value: String) -> SettingsDictionary { + return ["SWIFT_ACTIVE_COMPILATION_CONDITIONS": .string(value)] +} diff --git a/Tuist/ProjectDescriptionHelpers/Target+extensions.swift b/Tuist/ProjectDescriptionHelpers/Target+extensions.swift index 1bfb787..20bb313 100644 --- a/Tuist/ProjectDescriptionHelpers/Target+extensions.swift +++ b/Tuist/ProjectDescriptionHelpers/Target+extensions.swift @@ -42,6 +42,10 @@ extension Target { ) } + targetSettings?.base.merge( + ["SWIFT_ACTIVE_COMPILATION_CONDITIONS": "$(inherited)"] + ) + return .target( name: name, destinations: destinations, @@ -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) + ]) ) } diff --git a/Workspace.swift b/Workspace.swift index 9884bde..a884388 100644 --- a/Workspace.swift +++ b/Workspace.swift @@ -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) ),