Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] #18 - 트위스트 세팅 리펙토링하기 #19

Merged
merged 21 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7abfedf
[Chore] Tuist 파일 내부 변경
HELLOHIDI Jun 6, 2024
fd602c6
[Fix] CFBundleIdentifier와 PRODUCT_BUNDLE_IDENTIFIER 불일치 문제 해결
HELLOHIDI Jun 6, 2024
09d639c
[Fix] Detaitl 피쳐 에러 해결하기
HELLOHIDI Jun 6, 2024
8b61bb8
[Setting] ReactorKit 세팅하기 #17
HELLOHIDI Jun 6, 2024
3a53b41
[Feat] ReactorKit 적용하기 #17
HELLOHIDI Jun 6, 2024
4ec53cc
Merge pull request #1 from HELLOHIDI/Feat/#17
HELLOHIDI Jun 24, 2024
123bceb
[Refactor] 테스트 코드 모듈 생성 후 적용 코드 세팅 #18
HELLOHIDI Jun 25, 2024
725db85
[Setting] Configuration 코드 추가 #18
HELLOHIDI Jun 26, 2024
b3e70ec
[Chore] makeModule 메소드 수정
HELLOHIDI Jun 28, 2024
6971bc7
[Feat] ConfigPlugin 추가하기 #18
HELLOHIDI Jun 28, 2024
422f65b
[Refacotr] makeModule 메소드 리펙토링 #18
HELLOHIDI Jun 28, 2024
932c480
[Refactor] makeModule 메소드 변경에 따른 project 코드 수정 #18
HELLOHIDI Jun 28, 2024
f528eaf
[Refactor] 모듈화 아키텍쳐 적용 완료 #18
HELLOHIDI Jun 28, 2024
08ae865
[Refactor] Configuration 설정 #18
HELLOHIDI Jun 28, 2024
23962ae
[Feat] SourceFile+Template 추가 및 수정 #18
HELLOHIDI Jul 1, 2024
642b55f
[Feat] Scheme+Template으로 Scheme 분리 #18
HELLOHIDI Jul 1, 2024
c12de37
[Chore] 중복 파라미터 생략 #18
HELLOHIDI Jul 1, 2024
ccf34a4
[Fix] BaseFeatureDependecny 의존성 오류 해결 #18
HELLOHIDI Jul 3, 2024
953cf4a
[Comment] DependencyPlugIn 주석 추가 #18
HELLOHIDI Jul 4, 2024
b0caf56
[Comment] PlugIn 폴더 파일들 주석 완료 #18
HELLOHIDI Jul 4, 2024
1425994
[Comment] Manifetst 주석 추가 #18
HELLOHIDI Jul 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Configurations/Targets/iOS-Demo.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// iOS-Demo.xcconfig
// Manifests
//
// Created by 류희재 on 6/28/24.
//

// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974
9 changes: 9 additions & 0 deletions Configurations/Targets/iOS-Framework.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// iOS-Framework.xcconfig
// Manifests
//
// Created by 류희재 on 6/28/24.
//

// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974
9 changes: 9 additions & 0 deletions Configurations/Targets/iOS-Tests.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// iOS-Tests.xcconfig
// Manifests
//
// Created by 류희재 on 6/28/24.
//

// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974
3 changes: 3 additions & 0 deletions Plugins/ConfigPlugin/Plugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ProjectDescription

let configPlugin = Plugin(name: "ConfigPlugin")
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import Foundation
import ProjectDescription

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

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


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


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")),
]
}
2 changes: 1 addition & 1 deletion Plugins/DependencyPlugin/Plugin.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import ProjectDescription

let dependencyPlugin = Plugin(name: "DependencyPlugin")
let dependencyPlugin = Plugin(name: "DependencyPlugin")
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

import ProjectDescription

/// 프로젝트 내 모듈 및 기능별 종속성을 체계적으로 관리하기 위한 유틸리티를 제공
/// 새로운 모듈이나 기능이 추가되더라도 해당 파일만 업데이트하면 되어 유지보수가 용이합니다.

public extension Dep {
struct Features {
public struct Main {}
Expand All @@ -17,36 +20,58 @@ public extension Dep {
struct Modules {}
}

// MARK: - Root
// MARK: - Root: 프로젝트의 핵심 모듈에 대한 종속성을 정의

public extension Dep {
static let data = Dep.project(target: "Data", path: .data)

static let domain = Dep.project(target: "Domain", path: .domain)

static let core = Dep.project(target: "Core", path: .core)
}

// MARK: - Modules
// MARK: - Modules: 프로젝트 내 모듈 단위 종속성을 정의

public extension Dep.Modules {
static let dsKit = Dep.project(target: "DSKit", path: .relativeToModules("DSKit"))
static let dsKit = Dep.project(
target: "DSKit",
path: .relativeToModules("DSKit")
)

static let networks = Dep.project(target: "Networks", path: .relativeToModules("Networks"))
static let networks = Dep.project(
target: "Networks",
path: .relativeToModules("Networks")
)

static let thirdPartyLibs = Dep.project(target: "ThirdPartyLibs", path: .relativeToModules("ThirdPartyLibs"))
static let thirdPartyLibs = Dep.project(
target: "ThirdPartyLibs",
path: .relativeToModules("ThirdPartyLibs")
)
}

// MARK: - Features

public extension Dep.Features {
static func project(name: String, group: String) -> Dep { .project(target: "\(group)\(name)", path: .relativeToFeature("\(group)\(name)")) }
static func project(name: String, group: String) -> Dep {
.project(
target: "\(group)\(name)",
path: .relativeToFeature("\(group)\(name)")
)
}

static let BaseFeatureDependency = TargetDependency.project(target: "BaseFeatureDependency", path: .relativeToFeature("BaseFeatureDependency"))
static let BaseFeatureDependency = Dep.project(
target: "BaseFeatureDependency",
path: .relativeToFeature("BaseFeatureDependency")
)

static let RootFeature = TargetDependency.project(target: "RootFeature", path: .relativeToFeature("RootFeature"))
static let RootFeature = Dep.project(
target: "RootFeature",
path: .relativeToFeature("RootFeature")
)
}

//TODO: 폴더별로 분기처리하기 위해서 이런식으로 했다면 하나의 그룹이름만 주입해서 만드는게 좋지않나?

public extension Dep.Features.Main {
static let group = "Main"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

import ProjectDescription

/// TargetDependency의 확장을 통해
/// 프로젝트 내 외부 라이브러리 종속성을 보다 체계적으로 관리하기 위한 유틸리티를 제공하는 파일

public extension TargetDependency {
enum SPM {}
enum Carthage {}
Expand All @@ -21,4 +24,5 @@ public extension TargetDependency.SPM {
static let RxSwift = TargetDependency.external(name: "RxSwift")
static let RxCocoa = TargetDependency.external(name: "RxCocoa")
static let RxRelay = TargetDependency.external(name: "RxRelay")
static let ReactorKit = TargetDependency.external(name: "ReactorKit")
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,36 @@

import ProjectDescription

/// ProjectDescription.Path의 확장을 통해
/// 프로젝트 내 경로를 보다 간결하고 직관적으로 관리하기 위한 유틸리티를 제공하는 파일

public extension ProjectDescription.Path {
/// 기능 폴더에 대한 상대 경로를 생성
static func relativeToFeature(_ path: String) -> Self {
return .relativeToRoot("Projects/Features/\(path)")
}

/// 모듈 폴더에 대한 상대 경로를 생성
static func relativeToModules(_ path: String) -> Self {
return .relativeToRoot("Projects/Modules/\(path)")
}

/// 각각 앱 폴더에 대한 경로를 반환하는 속성
static var app: Self {
return .relativeToRoot("Projects/App")
}

/// 각각 데이터 폴더에 대한 경로를 반환하는 속성
static var data: Self {
return .relativeToRoot("Projects/Data")
}

/// 각각 도메인 폴더에 대한 경로를 반환하는 속성
static var domain: Self {
return .relativeToRoot("Projects/Domain")
}

/// 각각 코어 폴더에 대한 경로를 반환하는 속성
static var core: Self {
return .relativeToRoot("Projects/Core")
}
Expand Down
23 changes: 13 additions & 10 deletions Plugins/EnvPlugin/ProjectDescriptionHelpers/Enviroment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@

import ProjectDescription

public enum Environment {
public static let workspaceName = "Weather-iOS"
}
/// 프로젝트 환경 관련 파일입니다

public extension Project {
enum Environment {
public static let workspaceName = "Weather-iOS"
public static let deploymentTarget = DeploymentTarget.iOS(targetVersion: "16.0", devices: [.iphone])
public static let platform = Platform.iOS
public static let bundlePrefix = "com.Weather-iOS"
}
public struct ProjectEnvironment {
public let workspaceName: String
public let deploymentTarget: DeploymentTarget
public let platform: Platform
public let bundlePrefix: String
}

public let env = ProjectEnvironment(
workspaceName: "Weather-iOS",
deploymentTarget: DeploymentTarget.iOS(targetVersion: "17.0", devices: [.iphone]),
platform: .iOS,
bundlePrefix: "com.Weather-iOS"
)
17 changes: 5 additions & 12 deletions Plugins/EnvPlugin/ProjectDescriptionHelpers/InfoPlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@

import ProjectDescription

/// InfoPList를 정리해둔 파일이빈다
///
public extension Project {
static let appInfoPlist: [String: InfoPlist.Value] = [
static let appInfoPlist: [String: Plist.Value] = [
"BASE_URL": "https://api.openweathermap.org/data/2.5",
"API_KEY": "7618d35ff394f5dd39212928a3a4692f",
"CFBundleShortVersionString": "1.0.0",
"CFBundleDevelopmentRegion": "ko",
"CFBundleVersion": "1",
"CFBundleIdentifier": "com.Weather-iOS.release",
"CFBundleIdentifier": "com.Weather-iOS.$(PRODUCT_MODULE_NAME)",
"CFBundleDisplayName": "Weather-iOS",
"UILaunchStoryboardName": "LaunchScreen",
"UIApplicationSceneManifest": [
Expand All @@ -38,18 +40,9 @@ public extension Project {
"App Transport Security Settings": ["Allow Arbitrary Loads": true],
"NSAppTransportSecurity": ["NSAllowsArbitraryLoads": true],
"ITSAppUsesNonExemptEncryption": false,
// "UIUserInterfaceStyle": "Dark",
// "CFBundleURLTypes": [
// [
// "CFBundleTypeRole": "Editor",
// "CFBundleURLName": "sopt-makers",
// "CFBundleURLSchemes": ["sopt-makers"]
// ]
// ],
// "UIBackgroundModes": ["remote-notification"]
]

static let demoInfoPlist: [String: InfoPlist.Value] = [
static let demoInfoPlist: [String: Plist.Value] = [
"CFBundleShortVersionString": "1.0.0",
"CFBundleDevelopmentRegion": "ko",
"CFBundleVersion": "1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// SettingDictionary+.swift
// EnvPlugin
//
// Created by 류희재 on 6/26/24.
//

import ProjectDescription

// 아직 여기의 필요성은 못 느끼는중 무슨 역할을 하게 될지 궁금하다!

public extension SettingsDictionary {
// allLoadSettings와 baseSettings는 빌드 설정 딕셔너리의 기본값을 정의
static let allLoadSettings: Self = [
"OTHER_LDFLAGS" : [
"$(inherited) -all_load",
"-Xlinker -interposable"
]
]

static let baseSettings: Self = [
"OTHER_LDFLAGS" : [
"$(inherited)",
"-ObjC"
]
]

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)])
}

func setBuildActiveArchitectureOnly(_ value: Bool) -> SettingsDictionary {
merging(["ONLY_ACTIVE_ARCH": SettingValue(stringLiteral: value ? "YES" : "NO")])
}

func setExcludedArchitectures(sdk: String = "iphonesimulator*", _ value: String = "arm64") -> SettingsDictionary {
merging(["EXCLUDED_ARCHS[sdk=\(sdk)]": SettingValue(stringLiteral: value)])
}

func setSwiftActiveComplationConditions(_ value: String) -> SettingsDictionary {
merging(["SWIFT_ACTIVE_COMPILATION_CONDITIONS": SettingValue(stringLiteral: value)])
}

func setAlwaysSearchUserPath(_ value: String = "NO") -> SettingsDictionary {
merging(["ALWAYS_SEARCH_USER_PATHS": SettingValue(stringLiteral: value)])
}

func setStripDebugSymbolsDuringCopy(_ value: String = "NO") -> SettingsDictionary {
merging(["COPY_PHASE_STRIP": SettingValue(stringLiteral: value)])
}

func setDynamicLibraryInstallNameBase(_ value: String = "@rpath") -> SettingsDictionary {
merging(["DYLIB_INSTALL_NAME_BASE": SettingValue(stringLiteral: value)])
}

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)")])
}
}
14 changes: 6 additions & 8 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ import DependencyPlugin
import EnvPlugin

let project = Project.makeModule(
name: Environment.workspaceName,
product: .app,
dependencies: [
.Features.RootFeature,
.data
],
sources: ["Sources/**"],
resources: ["Resources/**"]
name: env.workspaceName,
targets: [.app, .unitTest],
internalDependencies: [
.data,
.Features.RootFeature
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading