본문 바로가기
Tuist/Tuist-Tip

Tuist Target destinations 변경사항(Platform deprecated)

by KS피터 2023. 12. 5.

Tuist 신규 버전(작성 기준 3.35.1)에서 Target 생성 시 platform 설정 파라미터가 deprecated 되었습니다.

관련해서 변경사항을 확인하고 대응 방법을 확인해 보겠습니다.

 

목차

     

    Target init deprecated

    우선 Tuist ProjectDescrition에서 Target init을 확인하면 기존 생성자에 다음과 같이 deprecated 설정이 되어 있는 걸을 확인 하실 수 있습니다.

    기존 Target init

    Deprecated 메시지를 확인하면 아래와 같습니다.

    Use `Destinations` and `DeploymentTargets` to configure deployment devices and minimum platform versions.

    'Destinations' 및 'DeploymentTargets'을 사용하여 배포 장치와 최소 플랫폼 버전을 구성하세요.

    Target new init

    Tuist ProjectDescrition에서 새로운 Target init을 보면 다음과 같습니다.

    Target new init

    public init(name: String,
                destinations: Destinations,
                product: Product,
                productName: String? = nil,
                bundleId: String,
                deploymentTargets: DeploymentTargets? = nil,
                infoPlist: InfoPlist? = .default,
                sources: SourceFilesList? = nil,
                resources: ResourceFileElements? = nil,
                copyFiles: [CopyFilesAction]? = nil,
                headers: Headers? = nil,
                entitlements: Entitlements? = nil,
                scripts: [TargetScript] = [],
                dependencies: [TargetDependency] = [],
                settings: Settings? = nil,
                coreDataModels: [CoreDataModel] = [],
                environmentVariables: [String : EnvironmentVariable] = [:],
                launchArguments: [LaunchArgument] = [],
                additionalFiles: [FileElement] = [],
                buildRules: [BuildRule] = [],
                mergedBinaryType: MergedBinaryType = .disabled,
                mergeable: Bool = false)

     

    변경사항

    • platform: Platform 파라미터 제거 및 destinations: Destinations 추가
    • deploymentTarget: DeploymentTarget → deploymentTargets: DeploymentTargets

     

    destinations

    Target.init(...
                destinations: [.iPhone, .iPad],
                ...)

    Target - General - Supported Destinations 결과 화면

     

    deploymentTargets

    • Target 프로덕트 지원 최소 버전 설정
    • DeploymentTargets struct 타입 공식 문서
    • init을 통해 다중 최소 지원 버전 설정
    // DeploymentTargets
    
    public init(iOS: String? = nil,
                macOS: String? = nil,
                watchOS: String? = nil,
                tvOS: String? = nil,
                visionOS: String? = nil)
    • 내부 static func를 이용하여 최소 버전 설정
      • static func iOS(_ version: String) -> DeploymentTargets
      • static func macOS(_ version: String) -> DeploymentTargets
      • static func watchOS(_ version: String) -> DeploymentTargets
      • static func tvOS(_ version: String) -> DeploymentTargets
      • static func visionOS(_ version: String) -> DeploymentTargets
    Target.init(...
                deploymentTargets: .iOS("15.0"),
                ...)

    Target - General Minimum Deployments 설정 결과 화면

     

    마치며

    Tuist GitHub에서 관련 이슈를 확인해보면 기존 Platform에 경우 설정이 한정적인 이유로 Destinations로 다양하게 설정하기 위한 결정인것 같습니다.

     

    Support linting multi-destination targets by kwridan · Pull Request #5441 · tuist/tuist

    Short description 📝 Updated the GraphLinter to account for multi-destination (multi-platform) targets Lint issues are now flagged only if there are no valid source and destination platform combina...

    github.com

    이번 변경 사항으로 인해 다양한 설정이 가능해진것으로 보입니다.

    Tuist에 경우 꾸준히 업데이트가 이루어지고 있어서 변경사항에 대한 체크가 되는 경우 바로 추가하여 업데이트 하도록 하겠습니다.

     

    관련글

    Tuist - 2) Target - 1 이론

     

    Tuist - 1) 설치

    Tuist 학습 일기장 Tuist 설치부터 초기화까지 내용을 기록하고 있습니다. 목차 Tuist Xcode 프로젝트 관리 툴로써 협업에서 XcodeGen처럼 프로젝트 모듈화나 프로젝트 설정 관리를 효과적으로 사용할

    ks-peter.tistory.com

    반응형