单个 cartfile 为多个目标指定和安装依赖项
Single cartfile to specify and install dependencies for multiple targets
有没有办法编写一个单独的 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 安装它们?
我为什么要这样做,我觉得当我们继续向应用程序中使用的不同目标(框架)添加依赖项时,如果我们将所有依赖项都列在一个文件中,那么维护起来会很容易购物车文件。
提前致谢。
在迦太基不可能做到这一点,will probably never be supported。
您可以在单个 Cartfile 中列出所有依赖项,但您仍然需要手动 select 并将它们添加到目标的 linked frameworks and libraries
.
有没有办法编写一个单独的 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 安装它们?
我为什么要这样做,我觉得当我们继续向应用程序中使用的不同目标(框架)添加依赖项时,如果我们将所有依赖项都列在一个文件中,那么维护起来会很容易购物车文件。 提前致谢。
在迦太基不可能做到这一点,will probably never be supported。
您可以在单个 Cartfile 中列出所有依赖项,但您仍然需要手动 select 并将它们添加到目标的 linked frameworks and libraries
.