【总结】iOS第三方库管理工具Carthage的使用心得

1.如果github上面的库是没有tag的:

比如:

https://github.com/edekhayser/Timeline

 

github lib edekhayser Timeline no tag

 

则是没法使用Carthage去管理(下载,编译)该库的

会报错:

licrifandeMacBook-Pro:QorosSales crifan$ carthage update

*** Fetching Timeline

No tagged versions found for github "edekhayser/Timeline"

详见:

【记录】试用iOS中的时间轴控件:Timeline

 

2.如果github上面的库,自己已经提供了编译好的二进制库(xxx.framework)的话,则carthage去下载的时候,就会自动下载已经编译好的库:

Downloading xxx.framework binary at

而不会再去下载源码,再去编译生成xxx.framework

下载到了build下面对应的位置:

Carthage/Build/PLATFORM/xxx.framework

比如,对于:

https://github.com/danielgindi/Charts

网页中有介绍:

Charts now include Carthage prebuilt binaries.

github "danielgindi/Charts" == 2.2.4

github "danielgindi/Charts" ~> 2.2.4

然后去安装的时候,输出是:

licrifandeMacBook-Pro:QorosSales crifan$ carthage update Charts

*** Fetching Charts

*** Downloading Charts.framework binary at "New features, Swift 2.2/3.0, and bugfixes"

*** xcodebuild output can be found in /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/carthage-xcodebuild.CSzNOD.log

对应下载的Charts.framework在:

  • Carthage/Build/iOS/Charts.framework
  • Carthage/Build/Mac/Charts.framework
  • Carthage/Build/tvOS/Charts.framework

详见:

【记录】用Carthage去安装库Charts

-》这样调试的时候,就没有该库的源码供调试了

-》不过多数时候的调试,其实也无需源码

 

注:

不过后来看到:

carthage update

有个参数:

[–no-use-binaries]

check out dependency repositories even when prebuilt frameworks exist, disabled if –use-submodules option is present (ignored if –no-build option is present)

好像可以实现:

即使有二进制framework文件,也还是下载源码并编译

抽空去试试

 

3.通过carthage update删除某个库后,对应的Build/平台下面对应的库文件xxx.framework是没有被删除的

-》想要彻底清除掉的话,可以手动去删除

比如:

自己手动去删除

Carthage/Build/iOS/Charts.framework

详见:

【记录】用Carthage添加第三方库

 

4.carthage的命令的语法是:

licrifandeMacBook-Pro:QorosSales crifan$ carthage help
Available commands:
   archive           Archives built frameworks into a zip that Carthage can use
   bootstrap         Check out and build the project’s dependencies
   build             Build the project’s dependencies
   checkout          Check out the project’s dependencies
   copy-frameworks   In a Run Script build phase, copies each framework specified by a SCRIPT_INPUT_FILE environment variable into the built app bundle
   fetch             Clones or fetches a Git repository ahead of time
   help              Display general or command-specific help
   outdated          Check for compatible updates to the project’s dependencies
   update            Update and rebuild the project’s dependencies

   version           Display the current version of Carthage

想要了解每个子命令的详细语法,可以用:

carthage help sub_command

 

比如:

carthage help build

licrifandeMacBook-Pro:QorosSales crifan$ carthage help build
Build the project’s dependencies
[–configuration (string)]
the Xcode configuration to build
[–platform (platform)]
the platforms to build for (one of ‘all’, ‘Mac’, ‘iOS’, ‘watchOS’, ‘tvOS’, or comma-separated values of the formers except for ‘all’)
[–derived-data (string)]
path to the custom derived data folder
[–no-skip-current]
don’t skip building the Carthage project (in addition to its dependencies)
[–color (color)]
whether to apply color and terminal formatting (one of ‘auto’, ‘always’, or ‘never’)
[–verbose]
print xcodebuild output inline
[–project-directory (string)]
the directory containing the Carthage project
[[]]

the dependency names to build

licrifandeMacBook-Pro:QorosSales crifan$ carthage help update
Update and rebuild the project’s dependencies
[–configuration (string)]
the Xcode configuration to build (ignored if –no-build option is present)
[–platform (platform)]
the platforms to build for (one of ‘all’, ‘Mac’, ‘iOS’, ‘watchOS’, ‘tvOS’, or comma-separated values of the formers except for ‘all’)
(ignored if –no-build option is present)
[–derived-data (string)]
path to the custom derived data folder
[–verbose]
print xcodebuild output inline (ignored if –no-build option is present)
[–no-checkout]
skip the checking out of dependencies after updating
[–no-build]
skip the building of dependencies after updating (ignored if –no-checkout option is present)
[–use-ssh]
use SSH for downloading GitHub repositories
[–use-submodules]
add dependencies as Git submodules
[–no-use-binaries]
check out dependency repositories even when prebuilt frameworks exist, disabled if –use-submodules option is present (ignored if –no-build option is present)
[–color (color)]
whether to apply color and terminal formatting (one of ‘auto’, ‘always’, or ‘never’)
[–project-directory (string)]
the directory containing the Carthage project
[[]]

the dependency names to update, checkout and build



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量