Skip to content

Commit

Permalink
Merge pull request #2 from ondosee/feature/project-setting
Browse files Browse the repository at this point in the history
[Feature] :: 프로젝트 세팅
  • Loading branch information
uuuunseo authored Aug 20, 2024
2 parents 260161e + 919ac31 commit 0282954
Show file tree
Hide file tree
Showing 78 changed files with 1,960 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno

### Projects ###
*.xcodeproj
*.xcworkspace

### Tuist derived files ###
graph.dot
Derived/

### Tuist managed dependencies ###
Tuist/.build
2 changes: 2 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
tuist = "4.23.0"
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
generate:
tuist install
tuist generate

ci_generate:
tuist install
TUIST_ENV=CI tuist generate

cd_generate:
tuist install
TUIST_ENV=CD tuist generate

clean:
rm -rf **/*.xcodeproj
rm -rf *.xcworkspace

reset:
tuist clean
rm -rf **/*.xcodeproj
rm -rf *.xcworkspace
3 changes: 3 additions & 0 deletions Plugin/ConfigurationPlugin/Plugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ProjectDescription

let configurationPlugin = Plugin(name: "ConfigurationPlugin")
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import ProjectDescription

public extension ConfigurationName {
static var dev: ConfigurationName { configuration(ProjectDeployTarget.dev.rawValue) }
static var stage: ConfigurationName { configuration(ProjectDeployTarget.stage.rawValue) }
static var prod: ConfigurationName { configuration(ProjectDeployTarget.prod.rawValue) }
}

public extension Array where Element == Configuration {
static let `default`: [Configuration] = [
.debug(name: .dev, xcconfig: .shared),
.debug(name: .stage, xcconfig: .shared),
.release(name: .prod, xcconfig: .shared)
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ProjectDescription

public extension ProjectDescription.Path {
static func relativeToXCConfig(type: ProjectDeployTarget, name: String) -> Self {
return .relativeToRoot("XCConfig/\(name)/\(type.rawValue).xcconfig")
}
static var shared: Self {
return .relativeToRoot("XCConfig/Shared.xcconfig")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation
import ProjectDescription

public enum ProjectDeployTarget: String {
case dev = "DEV"
case stage = "STAGE"
case prod = "PROD"

public var configurationName: ConfigurationName {
ConfigurationName.configuration(self.rawValue)
}
}
3 changes: 3 additions & 0 deletions Plugin/DependencyPlugin/Plugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ProjectDescription

let dependencyPlugin = Plugin(name: "DependencyPlugin")
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import ProjectDescription

public extension TargetDependency {
struct SPM {}
}

public extension TargetDependency.SPM {
}

public extension Package {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import Foundation

public enum ModulePaths {
case feature(Feature)
case domain(Domain)
case core(Core)
case shared(Shared)
case userInterface(UserInterface)
}

extension ModulePaths: ModularTargetPathConvertable {
public func targetName(type: ModularTargetType) -> String {
switch self {
case let .feature(module as any ModularTargetPathConvertable),
let .domain(module as any ModularTargetPathConvertable),
let .core(module as any ModularTargetPathConvertable),
let .shared(module as any ModularTargetPathConvertable),
let .userInterface(module as any ModularTargetPathConvertable):
return module.targetName(type: type)
}
}
}

public extension ModulePaths {
enum Feature: String, ModularTargetPathConvertable {
case BaseFeature
}
}

public extension ModulePaths {
enum Domain: String, ModularTargetPathConvertable {
case BaseDomain
}
}

public extension ModulePaths {
enum Core: String, ModularTargetPathConvertable {
case Networking
}
}

public extension ModulePaths {
enum Shared: String, ModularTargetPathConvertable {
case GlobalThirdPartyLibrary
}
}

public extension ModulePaths {
enum UserInterface: String, ModularTargetPathConvertable {
case DesignSystem
}
}

public enum ModularTargetType: String {
case interface = "Interface"
case sources = ""
case testing = "Testing"
case unitTest = "Tests"
case example = "Example"
}

public protocol ModularTargetPathConvertable {
func targetName(type: ModularTargetType) -> String
}

public extension ModularTargetPathConvertable where Self: RawRepresentable {
func targetName(type: ModularTargetType) -> String {
"\(self.rawValue)\(type.rawValue)"
}
}

// MARK: - For DI
extension ModulePaths.Feature: CaseIterable {}
extension ModulePaths.Domain: CaseIterable {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import ProjectDescription

public extension ProjectDescription.Path {
static func relativeToSections(_ path: String) -> Self {
return .relativeToRoot("Projects/\(path)")
}
static func relativeToFeature(_ path: String) -> Self {
return .relativeToRoot("Projects/Feature/\(path)")
}
static func relativeToDomain(_ path: String) -> Self {
return .relativeToRoot("Projects/Domain/\(path)")
}
static func relativeToCore(_ path: String) -> Self {
return .relativeToRoot("Projects/Core/\(path)")
}
static func relativeToShared(_ path: String) -> Self {
return .relativeToRoot("Projects/Shared/\(path)")
}
static func relativeToUserInterface(_ path: String) -> Self {
return .relativeToRoot("Projects/UserInterface/\(path)")
}
static var app: Self {
return .relativeToRoot("Projects/App")
}
}

public extension TargetDependency {
static func feature(name: String) -> Self {
return .project(target: name, path: .relativeToFeature(name))
}
static func domain(name: String) -> Self {
return .project(target: name, path: .relativeToDomain(name))
}
static func core(name: String) -> Self {
return .project(target: name, path: .relativeToCore(name))
}
static func shated(name: String) -> Self {
return .project(target: name, path: .relativeToShared(name))
}
static func userInterface(name: String) -> Self {
return .project(target: name, path: .relativeToUserInterface(name))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import Foundation
import ProjectDescription

public extension TargetDependency {
static func feature(
target: ModulePaths.Feature,
type: ModularTargetType = .sources
) -> TargetDependency {
.project(
target: target.targetName(type: type),
path: .relativeToFeature(target.rawValue)
)
}

static func domain(
target: ModulePaths.Domain,
type: ModularTargetType = .sources
) -> TargetDependency {
.project(
target: target.targetName(type: type),
path: .relativeToDomain(target.rawValue)
)
}

static func core(
target: ModulePaths.Core,
type: ModularTargetType = .sources
) -> TargetDependency {
.project(
target: target.targetName(type: type),
path: .relativeToCore(target.rawValue)
)
}

static func shared(
target: ModulePaths.Shared,
type: ModularTargetType = .sources
) -> TargetDependency {
.project(
target: target.targetName(type: type),
path: .relativeToShared(target.rawValue)
)
}

static func userInterface(
target: ModulePaths.UserInterface,
type: ModularTargetType = .sources
) -> TargetDependency {
.project(
target: target.targetName(type: type),
path: .relativeToUserInterface(target.rawValue)
)
}
}
3 changes: 3 additions & 0 deletions Plugin/EnvironmentPlugin/Plugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ProjectDescription

let environmentPlugin = Plugin(name: "EnvironmentPlugin")
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Foundation
import ProjectDescription

public struct ProjectEnvironment {
public let name: String
public let organizationName: String
public let destinations: Destinations
public let deploymentTargets: DeploymentTargets
public let baseSetting: SettingsDictionary
}

public let env = ProjectEnvironment(
name: "ondosee",
organizationName: "com",
destinations: [.iPhone, .appleWatch],
deploymentTargets: .multiplatform(iOS: "16.0", watchOS: "9.0"),
baseSetting: [:]
)
Loading

0 comments on commit 0282954

Please sign in to comment.