-->

How do I setup Carthage to use my own Frameworks t

2020-02-09 03:34发布

问题:

I was wondering if there is something like 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 but is not that clear on how to set it up. Does Carthage work only with Github repos? Can it work with Atlassian-Stash(now Bitbucket)? If so how?

回答1:

So I finally found out how to setup Carthage with a Atlassian-Bitbucket

on the Cartfile i Just need to define the dependency origin which is the git repository

Enterprise git repository like Atlassian-Stash(Bitbucket)

git "https://stashRepo" 

it also works with ssh://

Or local project

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

UPDATE

Carthage has now added extra documentation on how the OGDL works in the Cartfile



回答2:

Solutions to Carthage Development Framework

To code a framework in a way similar to developing using CocoaPods Development Pods, there are solutions ready to used with Carthage.

Solution 1 - The Local Path Way

This solution is quiet convenient than alternative solutions.

Step 1. Add local path into Cartfile

For example,

Add local path into Cartfile

git "PATH_TO_LOCAL_DEVELOPING_FRAMEWORK_SOURCE_ROOT_DIRECTORY" "BRANCH_NAME"

Step 2. Update Carthage dependency

For example,

Update Carthage dependency using Cartfile

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

To debug with breakpoints or to develop a framework in main project, add developing framework project reference $(DEVELOPING_FRAMEWORK).xcodeproj into the main application, and build the main app in Xcode.

Caution

Remove developing overhead (such as the changes in $(MAIN_APP_NAME).xcodeproj/project.pbxproj due to the addition of developing framework project reference) before committing the changes to remote repo.

Solution 2 - The Symbolic Linking Way

Tested Environment

  • Xcode 10.1
  • macOS 10.13.6