如何在Tuist中仅为Debug配置设置依赖(类CocoaPods)
在Tuist 3.40.0中仅为Debug构建配置引入Hyperion-iOS依赖
Tuist支持为特定构建配置声明依赖,对应CocoaPods中:configurations => ['Debug']的用法,具体实现步骤如下:
声明Hyperion-iOS包依赖
在你的Project.swift文件的packages数组中添加Hyperion-iOS的包源及版本范围:.package(url: "https://github.com/willowtreeapps/Hyperion-iOS.git", from: "0.11.0")为Debug配置添加依赖
在目标target的dependencies数组中,通过configuration: .debug参数指定仅在Debug构建下引入Hyperion的Core模块:Target( name: "YourTargetName", platform: .iOS, product: .app, bundleId: "com.yourcompany.yourapp", infoPlist: .file(path: "Info.plist"), sources: ["Sources/**"], resources: ["Resources/**"], dependencies: [ .package( product: "HyperionCore", package: "HyperioniOS", configuration: .debug ) ] )
关键说明
product参数需与Hyperion-iOS包中的产物名称对应,Core模块对应的产物是HyperionCore,若需引入其他子模块,可调整为对应的产物名(如HyperionPlugins)。- 配置完成后,执行
tuist generate重新生成项目,Debug构建会自动包含Hyperion依赖,Release构建则不会引入。
内容的提问来源于stack exchange,提问作者KyawGyi
相关产品推荐
相关产品推荐

