Skip to content

Commit

Permalink
xcconfig 관리 용이성 개선
Browse files Browse the repository at this point in the history
build settgins levels 참고
  • Loading branch information
devMinseok committed Jul 15, 2024
1 parent 7acd29c commit 2247800
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@
import Foundation
import ProjectDescription

public extension ProjectDescription.Path {
static let pomonyangAppXCConfig: Path = .relativeToRoot("XCConfig/App/PomoNyang.xcconfig")
extension ProjectDescription.Path {
public static let pomonyangAppXCConfig: Path = .relativeToRoot("XCConfig/Project/PomoNyang.xcconfig")

static func targetXCConfig(type: Product) -> Self {
public static func targetXCConfig(type: Product) -> Self {
return .relativeToRoot("XCConfig/Target/\(type.rawValue).xcconfig")
}

static func projectXCConfig(type: BuildConfiguration) -> Self {
return .relativeToRoot("XCConfig/Project/\(type.name).xcconfig")
}
}
4 changes: 2 additions & 2 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let appTarget: Target = .target(
.dependency(module: PomoNyang.Feature.AppFeature),
.dependency(module: PomoNyang.Shared.DesignSystem)
],
settings: .appTargetSettings(xcconfig: .pomonyangAppXCConfig)
settings: .targetSettings(product: .app)
)

// MARK: - Scheme
Expand All @@ -60,7 +60,7 @@ let project: Project = .init(
name: "App",
organizationName: AppEnv.organizationName,
options: .options(automaticSchemesOptions: .disabled, disableSynthesizedResourceAccessors: true),
settings: .projectSettings,
settings: .projectSettings(xcconfig: .pomonyangAppXCConfig),
targets: [appTarget],
schemes: [appScheme]
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension InfoPlist {
// MARK: - Core Foundation

"CFBundleDevelopmentRegion": "ko_KR",
"CFBundleDisplayName": "?",
"CFBundleDisplayName": "$(APP_NAME)",
"CFBundleExecutable": "$(EXECUTABLE_NAME)",
"CFBundleIdentifier": "$(PRODUCT_BUNDLE_IDENTIFIER)",
"CFBundleInfoDictionaryVersion": "6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extension Project {
organizationName: AppEnv.organizationName,
options: options,
packages: packages,
settings: .projectSettings,
settings: .projectSettings(),
targets: projectTargets,
schemes: schemes,
fileHeaderTemplate: nil,
Expand Down
40 changes: 10 additions & 30 deletions Tuist/ProjectDescriptionHelpers/Templates/Settings+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import UtilityPlugin
import ProjectDescription

extension ProjectDescription.Settings {
public static func appTargetSettings(xcconfig: Path) -> Self {
let prodConfig = BuildConfiguration.prod
/// 프로젝트 설정
public static func projectSettings(
xcconfig: Path? = nil
) -> Self {
let devConfig = BuildConfiguration.dev
let prodConfig = BuildConfiguration.prod

return .settings(
configurations: [
Expand All @@ -36,52 +39,29 @@ extension ProjectDescription.Settings {
)
}

public static var projectSettings: Self {
let devConfig = BuildConfiguration.dev
let prodConfig = BuildConfiguration.prod

return .settings(
configurations: [
.debug(
name: devConfig.configurationName,
xcconfig: .projectXCConfig(type: devConfig)
),
.release(
name: prodConfig.configurationName,
xcconfig: .projectXCConfig(type: prodConfig)
)
],
defaultSettings: .essential
)
}

public static func targetSettings(product: Product) -> Self {
/// 타겟 설정
public static func targetSettings(
product: Product
) -> Self {
let devConfig = BuildConfiguration.dev
let prodConfig = BuildConfiguration.prod

return .settings(
configurations: [
.debug(
name: devConfig.configurationName,
settings: [:]
.otherSwiftFlags(["$(inherited)", "-D\(devConfig.name)"])
.swiftActiveCompilationConditions([devConfig.name, "DEBUG"])
,
xcconfig: .targetXCConfig(type: product)
),
.release(
name: prodConfig.configurationName,
settings: [:]
.otherSwiftFlags(["$(inherited)", "-D\(prodConfig.name)"])
.swiftActiveCompilationConditions([prodConfig.name])
,
xcconfig: .targetXCConfig(type: product)
)
],
defaultSettings: .essential
)
}

/// 패키지 설정
public static var packageSettings: Self {
let devConfig = BuildConfiguration.dev
let prodConfig = BuildConfiguration.prod
Expand Down
1 change: 0 additions & 1 deletion XCConfig/Project/DEV.xcconfig

This file was deleted.

1 change: 0 additions & 1 deletion XCConfig/Project/PROD.xcconfig

This file was deleted.

7 changes: 7 additions & 0 deletions XCConfig/Project/PomoNyang.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "../Shared.xcconfig"

APP_NAME = 뽀모냥

MARKETING_VERSION = 0.0.1
CURRENT_PROJECT_VERSION = 1
DEVELOPMENT_TEAM =
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
BUILD_LIBRARY_FOR_DISTRIBUTION = NO
CODE_SIGN_IDENTITY = Apple Development
CODE_SIGN_STYLE = Automatic
CURRENT_PROJECT_VERSION = 1
DEVELOPMENT_TEAM =
FRAMEWORK_SEARCH_PATHS = $(inherited)
MARKETING_VERSION = 0.0.1
PRODUCT_NAME = $(TARGET_NAME)
PROVISIONING_PROFILE_SPECIFIER =
SWIFT_VERSION = 5.0
TARGETED_DEVICE_FAMILY = 1


// Firebase requires this
Expand Down
5 changes: 0 additions & 5 deletions XCConfig/Target/app_extension.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@

#include "../Shared.xcconfig"

DEVELOPMENT_TEAM =

// Xcode needs this to find archived headers if SKIP_INSTALL is set
HEADER_SEARCH_PATHS = $(inherited) $(OBJROOT)/UninstalledProducts/include

// The base SDK to use (if no version is specified, the latest version is
// assumed)
SDKROOT = iphoneos

// Supported device families (1 is iPhone, 2 is iPad)
TARGETED_DEVICE_FAMILY = 1,2

// Sets the @rpath for the application such that it can include frameworks in
// the application bundle two levels up, inside the "Frameworks" folder.
//
Expand Down
3 changes: 0 additions & 3 deletions XCConfig/Target/unit_tests.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/
// assumed)
SDKROOT = iphoneos

// Supported device families (1 is iPhone, 2 is iPad)
TARGETED_DEVICE_FAMILY = 1,2

SWIFT_COMPILATION_MODE = wholemodule

SWIFT_INCLUDE_PATHS = $(inherited)
Expand Down

0 comments on commit 2247800

Please sign in to comment.