Carthage - ShenYj/ShenYj.github.io GitHub Wiki
一般某个工具的参数忘记了, 习惯性的都是man一下, 非系统的要么就是--help要么就是-h一下, 但是这家伙不按套路出牌, 需要carthage help
自己项目中大都是通过CocoaPods来管理依赖库, 几乎不会用到Carthage, 但很多开源库的工具链中总能见到Carthage的身影,这次这么大费周章的整理, 主要是在开源项目提交PR时Circle CI 2.0下遇到了些问题, 所以还是有必要系统的学习整理一下, 方便今后复习、使用查阅

| 命令 | 描述 |
|---|---|
| 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 |
| validate | Validate that the versions in Cartfile.resolved are compatible with the Cartfile requirements |
| version | Display the current version of Carthage |
关于
Carthage的安装使用, 直接查询GitHub上的Readme就够了, 只能用简单和详细来描述了, 没有总结的必要了
| 命令 | 区别 |
|---|---|
| update | searches for the latest version that fulfills your version restrictions and downloads it |
| bootstrap | searches for the version last used in your project in the Cartfile.resolved file and downloads it |
| 命令 | 描述 |
|---|---|
| --new-resolver | Experimental Resolver A rewrite of the logic for upgrading frameworks was done with the aim of increasing speed and reducing memory usage. It is currently an opt-in feature. It can be used by passing --new-resolver to the update command, e.g. carthage update --new-resolver Box If you are experiencing performance problems during updates, please give the new resolver a try |
| --use-xcframeworks | This will fetch dependencies into a Carthage/Checkouts folder and build each one or download a pre-compiled XCFramework. Known issues(0.37.0): --use-xcframeworks does not produce an XCFramework for github dependencies which download binaries. Workaround: Pass --no-use-binaries to make Carthage rebuild the dependency from source, which will produce an XCFramework. |
| --use-submodules | By default, Carthage will directly check out dependencies’ source files into your project folder, leaving you to commit or ignore them as you choose. If you’d like to have dependencies available as Git submodules instead (perhaps so you can commit and push changes within them), you can run carthage update or carthage checkout with the --use-submodules flag. When run this way, Carthage will write to your repository’s .gitmodules and .git/config files, and automatically update the submodules when the dependencies’ versions change. |
| --cache-builds | By default Carthage will rebuild a dependency regardless of whether it's the same resolved version as before. Passing the --cache-builds will cause carthage to avoid rebuilding a dependency if it can. See information on version files for details on how Carthage performs this caching. Note: At this time --cache-builds is incompatible with --use-submodules. Using both will result in working copy and committed changes to your submodule dependency not being correctly rebuilt. See #1785 for details. |
| --no-skip-current | Carthage will only build Xcode schemes that are shared from your .xcodeproj. You can see if all of your intended schemes build successfully by running carthage build --no-skip-current, then checking the Carthage/Build folder. If an important scheme is not built when you run that command, open Xcode and make sure that the scheme is marked as Shared, so Carthage can discover it. |
| --no-build | |
| --no-use-binaries | Pass --no-use-binaries to make Carthage rebuild the dependency from source, which will produce an XCFramework. This flag indicates Carthage to not use the pre-built frameworks released in GitHub, but build from scratch. Why would we want that if it takes more time? Because pre-built frameworks do not always work well for your project (it is corrupted or it was built with another Swift or XCode version) and they don’t support step-by-step debugging. |
摘自
Carthage的官方描述更多命令介绍可以直接通过帮助命令查看link:
carthage help update
-
Carthage从
issuses和官方文档中可以看出,0.37和0.38是两个关键的版本, 尤其是0.37这个版本 -
Xcode 12xcframeworkM1
苹果这期间新发布的
M1模拟器指令集与iPhone真机(arm64)冲突了,Carthage很尴尬, 对此Carthage也给出了方案(Using Carthage with Xcode 12 ),就是将M1的模拟器指令集移除, 所以在很多开源库中可见的那段脚本, 实际就是Carthage提供的方案
针对这次的问题, 我将用三个开源库来分别实现一次Travis、Circle CI 2.0和GitHub WorkFlow的使用, 扩展自己对于CI方面的经验
TBD...
-
在尝试修复这个
PR期间, 还见识到了一些从未用过的脚本命令: -
接触了
travis、Circle CI 1.0/2.0和GitHub WorkFlow这三种CI方案- 根目录下存在
.travis.yml文件的使用的是travis CI方案 - 根目录下存在
.circle.yml文件的使用的是Circle CI 1.0方案 - 根目录下存在
.circle/.config.yml文件的使用的是Circle CI 2.0方案 - 根目录下存在
.github/workflows/xx.yml文件的使用的是GitHub WorkFlows CI方案
在此期间, 我翻看了几个
Rx类库对比, 得到了自己对这几个CI方案浅显的判断结论, 我觉得帮助最大的就是NSObject_Rx这个库,通过Git提交记录, 类库从最初的travis迁移到circle ci 1.0, 又升级到2.0 - 根目录下存在