有没有一种方法可以编写一个单独的 cartfile 来安装多个目标所需的依赖项。这可以在我们使用 Cocoapods 时实现,如下所示:
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
def rx_swift
pod 'RxSwift', '~> 4.0'
end
def rx_cocoa
pod 'RxCocoa', '~> 4.0'
end
def test_pods
pod 'RxTest'
pod 'RxBlocking'
pod 'Nimble'
end
target 'CleanArchitectureRxSwift' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_cocoa
rx_swift
pod 'QueryKit'
target 'CleanArchitectureRxSwiftTests' do
inherit! :search_paths
test_pods
end
end
target 'CoreDataPlatform' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
pod 'QueryKit'
target 'CoreDataPlatformTests' do
inherit! :search_paths
test_pods
end
end
target 'Domain' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
target 'DomainTests' do
inherit! :search_paths
test_pods
end
end
target 'NetworkPlatform' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
pod 'Alamofire'
pod 'RxAlamofire'
target 'NetworkPlatformTests' do
inherit! :search_paths
test_pods
end
end
target 'RealmPlatform' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
pod 'RxRealm', '~> 0.7.1'
pod 'QueryKit'
pod 'RealmSwift', '~> 3.10'
pod 'Realm', '~> 3.10'
target 'RealmPlatformTests' do
inherit! :search_paths
test_pods
end
end
请让我知道我们是否可以在使用 Carthage 时实现类似的事情?即通过在单个 cartfile 中编写所有目标所需的所有依赖项,然后使用 carthage 安装它们?
我为什么要这样做,我觉得当我们继续向应用程序中使用的不同目标(框架)添加依赖项时,如果我们将所有依赖项都列在一个 cartfile 中,那么维护起来会很容易。 提前致谢。
最佳答案
在迦太基不可能这样做,而且will probably never be supported .
您可以在单个 Cartfile 中列出所有依赖项,但您仍然必须手动选择它们并将它们添加到目标的链接框架和库
。
关于ios - 单个 cartfile 为多个目标指定和安装依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55760911/