Skip to content

Commit

Permalink
Merge pull request #117 from Team-HMH/refactor/#116
Browse files Browse the repository at this point in the history
[Refactor] #116 Test/Release Config 분리 및 Tuist 세팅코드 리펙토링
  • Loading branch information
HELLOHIDI authored Nov 25, 2024
2 parents df150b6 + 15e1173 commit 73dfa9a
Show file tree
Hide file tree
Showing 38 changed files with 869 additions and 586 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@
ReferencedContainer = "container:Projects/Features/ChallengeFeature/ChallengeFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2538C1AD7CF9D7896689AB84"
BuildableName = "ChallengeFeatureInterface.framework"
BlueprintName = "ChallengeFeatureInterface"
ReferencedContainer = "container:Projects/Features/ChallengeFeature/ChallengeFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down Expand Up @@ -258,20 +244,6 @@
ReferencedContainer = "container:Projects/Features/HomeFeature/HomeFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "854D3E4EFF471C42EE44119B"
BuildableName = "HomeFeatureInterface.framework"
BlueprintName = "HomeFeatureInterface"
ReferencedContainer = "container:Projects/Features/HomeFeature/HomeFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down Expand Up @@ -454,20 +426,6 @@
ReferencedContainer = "container:Projects/Features/LoginFeature/LoginFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CF6F649789711DC92E8F827C"
BuildableName = "LoginFeatureInterface.framework"
BlueprintName = "LoginFeatureInterface"
ReferencedContainer = "container:Projects/Features/LoginFeature/LoginFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down Expand Up @@ -524,20 +482,6 @@
ReferencedContainer = "container:Projects/Features/MyPageFeature/MyPageFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "309D06068DD1002D94B61781"
BuildableName = "MyPageFeatureInterface.framework"
BlueprintName = "MyPageFeatureInterface"
ReferencedContainer = "container:Projects/Features/MyPageFeature/MyPageFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down Expand Up @@ -594,20 +538,6 @@
ReferencedContainer = "container:Projects/Features/OnboardingFeature/OnboardingFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "192C7ACBD5A03867D013EBF3"
BuildableName = "OnboardingFeatureInterface.framework"
BlueprintName = "OnboardingFeatureInterface"
ReferencedContainer = "container:Projects/Features/OnboardingFeature/OnboardingFeature.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,64 @@ import ProjectDescription
/// Target 분리 (The Modular Architecture 기반으로 분리했습니다)


/// DEV : 테스트 BaseURL을 사용하는 debug scheme
/// PROD : 실제 프로덕트 BaseURL을 사용하는 release scheme

public struct XCConfig {
static func path(for target: BuildTarget) -> ProjectDescription.Path {
.relativeToRoot("./XCConfig/\(target.rawValue).xcconfig")
}

public static let configurations: [Configuration] = [
.build(.dev),
.build(.qa),
.build(.prod)
]
}

public enum BuildTarget: String {
case dev = "DEV"
case qa = "QA"
case prod = "PROD"
}

public extension Configuration {
static func build(_ target: BuildTarget) -> Self {
switch target {
case .dev:
return .debug(
name: "Development",
xcconfig: XCConfig.path(for: .dev)
)
case .qa:
return .release(
name: "QA",
xcconfig: XCConfig.path(for: .qa)
)
case .prod:
return .release(
name: "PROD",
xcconfig: XCConfig.path(for: .prod)
)
}
}
}

//
// Configurations.swift
// MyPlugin
//
// Created by 류희재 on 7/13/24.
//

import Foundation
import ProjectDescription

/// 빌드할 환경에 대한 설정

/// Target 분리 (The Modular Architecture 기반으로 분리했습니다)


/// DEV : 실제 프로덕트 BaseURL을 사용하는 debug scheme
/// TEST : 테스트 BaseURL을 사용하는 debug scheme
/// QA : 테스트 BaseURL을 사용하는 release scheme
Expand All @@ -23,38 +81,45 @@ import ProjectDescription
/// 2) TEST, QA -> 테스트 BaseURL


public struct XCConfig {
private struct Path {
static var framework: ProjectDescription.Path { .relativeToRoot("Configurations/Targets/iOS-Framework.xcconfig") }
static var demo: ProjectDescription.Path { .relativeToRoot("Configurations/Targets/iOS-Demo.xcconfig") }
static var tests: ProjectDescription.Path { .relativeToRoot("Configurations/Targets/iOS-Tests.xcconfig") }
static func project(_ config: String) -> ProjectDescription.Path { .relativeToRoot("Configurations/Base/Projects/Project-\(config).xcconfig") }
}

public static let framework: [Configuration] = [
.debug(name: "Development", xcconfig: Path.framework),
.debug(name: "Test", xcconfig: Path.framework),
.release(name: "QA", xcconfig: Path.framework),
.release(name: "PROD", xcconfig: Path.framework),
]

public static let tests: [Configuration] = [
.debug(name: "Development", xcconfig: Path.tests),
.debug(name: "Test", xcconfig: Path.tests),
.release(name: "QA", xcconfig: Path.tests),
.release(name: "PROD", xcconfig: Path.tests),
]
public static let demo: [Configuration] = [
.debug(name: "Development", xcconfig: Path.demo),
.debug(name: "Test", xcconfig: Path.demo),
.release(name: "QA", xcconfig: Path.demo),
.release(name: "PROD", xcconfig: Path.demo),
]
public static let project: [Configuration] = [
.debug(name: "Development", xcconfig: Path.project("Development")),
.debug(name: "Test", xcconfig: Path.project("Test")),
.release(name: "QA", xcconfig: Path.project("QA")),
.release(name: "PROD", xcconfig: Path.project("PROD")),
]
}

//public struct XCConfig {
// private struct Path {
// static var framework: ProjectDescription.Path { .relativeToRoot("Configurations/Targets/iOS-Framework.xcconfig") }
// static var demo: ProjectDescription.Path { .relativeToRoot("Configurations/Targets/iOS-Demo.xcconfig") }
// static var tests: ProjectDescription.Path { .relativeToRoot("Configurations/Targets/iOS-Tests.xcconfig") }
// static func project(_ config: String) -> ProjectDescription.Path { .relativeToRoot("Configurations/Base/Projects/Project-\(config).xcconfig") }
// }
//
// public static let framework: [Configuration] = [
// .debug(name: "Development", xcconfig: .relativeToRoot("XCConfig/DEV.xcconfig")),
// .release(name: "PROD", xcconfig: .relativeToRoot("XCConfig/PROD.xcconfig"))
//// .debug(name: "Development", xcconfig: Path.framework),
//// .debug(name: "Test", xcconfig: Path.framework),
//// .release(name: "QA", xcconfig: Path.framework),
//// .release(name: "PROD", xcconfig: Path.framework),
// ]
//
// public static let tests: [Configuration] = [
// .debug(name: "Development", xcconfig: .relativeToRoot("XCConfig/DEV.xcconfig")),
// .release(name: "PROD", xcconfig: .relativeToRoot("XCConfig/PROD.xcconfig"))
//// .debug(name: "Development", xcconfig: Path.tests),
////// .debug(name: "Test", xcconfig: Path.tests),
////// .release(name: "QA", xcconfig: Path.tests),
//// .release(name: "PROD", xcconfig: Path.tests),
// ]
// public static let demo: [Configuration] = [
// .debug(name: "Development", xcconfig: .relativeToRoot("XCConfig/DEV.xcconfig")),
// .release(name: "PROD", xcconfig: .relativeToRoot("XCConfig/PROD.xcconfig"))
//// .debug(name: "Development", xcconfig: Path.demo),
////// .debug(name: "Test", xcconfig: Path.demo),
////// .release(name: "QA", xcconfig: Path.demo),
//// .release(name: "PROD", xcconfig: Path.demo),
// ]
// public static let project: [Configuration] = [
// .debug(name: "Development", xcconfig: .relativeToRoot("XCConfig/DEV.xcconfig")),
// .release(name: "PROD", xcconfig: .relativeToRoot("XCConfig/PROD.xcconfig"))
//// .debug(name: "Development", xcconfig: Path.project("Development")),
////// .debug(name: "Test", xcconfig: Path.project("Test")),
////// .release(name: "QA", xcconfig: Path.project("QA")),
//// .release(name: "PROD", xcconfig: Path.project("PROD")),
// ]
//}
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,68 @@ public extension SettingsDictionary {
]
]

///역할: Objective-C 카테고리 및 클래스를 정적으로 링크하도록 보장.
///사용 사례: Objective-C 기반 라이브러리를 사용할 때 기본적으로 필요.
static let baseSettings: Self = [
"OTHER_LDFLAGS" : [
"$(inherited)",
"-ObjC"
]
]

///번들 ID를 설정합니다.
func setProductBundleIdentifier(_ value: String = "com.iOS$(BUNDLE_ID_SUFFIX)") -> SettingsDictionary {
merging(["PRODUCT_BUNDLE_IDENTIFIER": SettingValue(stringLiteral: value)])
}

///앱 아이콘 이름을 설정합니다.
func setAssetcatalogCompilerAppIconName(_ value: String = "AppIcon$(BUNDLE_ID_SUFFIX)") -> SettingsDictionary {
merging(["ASSETCATALOG_COMPILER_APPICON_NAME": SettingValue(stringLiteral: value)])
}

///활성화된 아키텍처만 빌드할지 설정 (ONLY_ACTIVE_ARCH).
func setBuildActiveArchitectureOnly(_ value: Bool) -> SettingsDictionary {
merging(["ONLY_ACTIVE_ARCH": SettingValue(stringLiteral: value ? "YES" : "NO")])
}

///특정 SDK에서 제외할 아키텍처를 설정 (EXCLUDED_ARCHS).
func setExcludedArchitectures(sdk: String = "iphonesimulator*", _ value: String = "arm64") -> SettingsDictionary {
merging(["EXCLUDED_ARCHS[sdk=\(sdk)]": SettingValue(stringLiteral: value)])
}

///Swift 활성 컴파일 조건을 설정 (SWIFT_ACTIVE_COMPILATION_CONDITIONS).
func setSwiftActiveComplationConditions(_ value: String) -> SettingsDictionary {
merging(["SWIFT_ACTIVE_COMPILATION_CONDITIONS": SettingValue(stringLiteral: value)])
}

///사용자 경로를 항상 검색할지 설정 (ALWAYS_SEARCH_USER_PATHS).
func setAlwaysSearchUserPath(_ value: String = "NO") -> SettingsDictionary {
merging(["ALWAYS_SEARCH_USER_PATHS": SettingValue(stringLiteral: value)])
}

///복사 과정에서 디버그 심볼 제거 여부를 설정 (COPY_PHASE_STRIP).
func setStripDebugSymbolsDuringCopy(_ value: String = "NO") -> SettingsDictionary {
merging(["COPY_PHASE_STRIP": SettingValue(stringLiteral: value)])
}

///동적 라이브러리 기본 설치 경로 설정 (DYLIB_INSTALL_NAME_BASE).
func setDynamicLibraryInstallNameBase(_ value: String = "@rpath") -> SettingsDictionary {
merging(["DYLIB_INSTALL_NAME_BASE": SettingValue(stringLiteral: value)])
}

///설치 대상 여부를 설정 (SKIP_INSTALL).
func setSkipInstall(_ value: Bool = false) -> SettingsDictionary {
merging(["SKIP_INSTALL": SettingValue(stringLiteral: value ? "YES" : "NO")])
}

///코드 서명을 수동으로 설정합니다.
func setCodeSignManual() -> SettingsDictionary {
merging(["CODE_SIGN_STYLE": SettingValue(stringLiteral: "Manual")])
.merging(["DEVELOPMENT_TEAM": SettingValue(stringLiteral: "9K86FQHDLU")])
.merging(["CODE_SIGN_IDENTITY": SettingValue(stringLiteral: "$(CODE_SIGN_IDENTITY)")])
}

///프로비저닝 프로파일 설정.
func setProvisioning() -> SettingsDictionary {
merging(["PROVISIONING_PROFILE_SPECIFIER": SettingValue(stringLiteral: "$(APP_PROVISIONING_PROFILE)")])
.merging(["PROVISIONING_PROFILE": SettingValue(stringLiteral: "$(APP_PROVISIONING_PROFILE)")])
Expand Down
3 changes: 2 additions & 1 deletion HMH_Tuist_iOS/Projects/Data/Sources/Test/DataTestApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import KakaoSDKAuth

@main
struct DataTestApp: App {
let kakaoAPIKey = "36f13382883fc31f22b7d34148a1be2b"
let kakaoAPIKey = Networks.Config.appKey
init() {
KakaoSDK.initSDK(appKey: kakaoAPIKey)
print(Networks.Config.baseURL)
}

var body: some Scene {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension HMHNetworkError {
.invalidRequest(.parameterEncodingFailed(.missingURL)),
.invalidRequest(.unknownErr),
.decodingFailed(.dataIsNil),
.decodingFailed(.failed)
.decodingFailed(.decodingFailed)
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import DependencyPlugin

let project = Project.makeModule(
name: "BaseFeatureDependency",
targets: [.dynamicFramework],
targets: [.staticFramework],
internalDependencies: [
.domain,
.Modules.dsKit,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import DependencyPlugin
//TODO: 나머지 4개의 모듈 여기로 주입
let project = Project.makeModule(
name: "ChallengeFeature",
targets: [.staticFramework, .demo, .interface],
interfaceDependencies: [
targets: [.staticFramework, .demo],
internalDependencies: [
.Features.BaseFeatureDependency
]
)
Loading

0 comments on commit 73dfa9a

Please sign in to comment.