我如何设置 Carthage 以使用我自己的框架,这些框架位于私有存储库中,例如 Stash (Bitbucket)?

How do I setup Carthage to use my own Frameworks that are in private repository like Stash (Bitbucket)?

我想知道是否有类似 private pods in Carthage, I have a couple of frameworks and I'm currently using git submodules, I started using Carthage for a new project and is pretty nice but so far I just configured it to manage third party Frameworks dependencies. I've checked the carthage documentation 的东西,但不清楚如何设置它。 Carthage 是否仅适用于 Github 存储库?它可以与 Atlassian-Stash(现在 Bitbucket)一起使用吗?如果有怎么办?

所以我终于找到了如何使用 Atlassian-Bitbucket

设置 Carthage

Cartfile 上,我只需要定义依赖源,即 git 存储库

企业 git 存储库喜欢 Atlassian-Stash(Bitbucket)

git "https://stashRepo" 

它也适用于 ssh://

或本地项目

git "file:///directory/to/project" "branch"  

更新

Carthage 现在添加了关于 OGDL 如何在 Cartfile

Carthage 开发框架解决方案

以类似于使用 Cocoa 进行开发的方式编写框架Pods 开发Pods,有现成的解决方案可用于 Carthage。

解决方案 1 - 本地路径方式

这个解决方案比 安静方便。

步骤 1. 将本地路径添加到 Cartfile

例如,

将本地路径添加到 Cartfile

git "PATH_TO_LOCAL_DEVELOPING_FRAMEWORK_SOURCE_ROOT_DIRECTORY" "BRANCH_NAME"

步骤 2. 更新 Carthage 依赖项

例如,

使用 Cartfile 更新 Carthage 依赖项

$ carthage update $DEVELOPING_FRAMEWORK_NAME --platform iOS --cache-builds --configuration Debug

要断点调试或在主项目中开发框架,将开发框架项目引用$(DEVELOPING_FRAMEWORK).xcodeproj添加到主应用程序中,并在Xcode中构建主应用程序。

注意

在将更改提交到远程仓库之前删除开发开销(例如 $(MAIN_APP_NAME).xcodeproj/project.pbxproj 中由于添加开发框架项目参考而发生的更改)。

测试环境

  • Xcode10.1
  • macOS 10.13.6

Cartfile 源位置

[Dependency manager]

github - Git中心存储库

github "<owner>/<repo>" //GitHub.com
github "https://<path>" //GitHub Enterprise Server

git - Git 存储库

git "https://<path>" //remote
git "ssh://<command>" //ssh connection
git "file:///<path>" "<branch_name>" //local

binary - 预编译的二进制文件

binary "https://<path>.json" //remote
binary "file:///<path>.json" //local

请注意 file:/ 用于本地文件,这对 developing/debugging 依赖很有用。在使用 git

之前不要忘记提交更改

[Local CocoaPods]