How to update just one library from the Cartfile with Carthage?

一世执手 提交于 2020-05-24 08:28:11

问题


My Cartfile has many libraries. When I do carthage update it goes through all the libraries. That can take very long time.

Is there a way to update just a single library with carthage? Something like this? (this will not work)

carthage update "evgenyneu/moa"

回答1:


From 0.12 version build, checkout, and update take an optional space separated list of dependencies

For a Cartfile like the following

github "Alamofire/Alamofire"
github "ReactiveX/RxSwift"

You could choose to update one dependency

carthage update Alamofire

or multiple dependencies

carthage update Alamofire RxSwift

If you need to add flags, add them last:

carthage update Alamofire --platform iOS



回答2:


Carthage supports updating single dependencies now.If you have something like this in your Cartfile:

github "bitstadium/HockeySDK-iOS"

Then you can update only this one dependency by running

carthage update HockeySDK-iOS



回答3:


Right now the answer is no... If your run carthage help update you'll see

Update and rebuild the project's dependencies

[--configuration Release]
    the Xcode configuration to build (ignored if --no-build option is present)

[--platform all]
    the platform to build for (ignored if --no-build option is present)

[--verbose]
    print xcodebuild output inline (ignored if --no-build option is present)

[--no-build]
    skip the building of dependencies after updating

[--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 (ignored if --no-build option is present)

[--color auto]
    whether to apply color and terminal formatting (one of ‘auto’, ‘always’, or ‘never’)

[/path/to/your/app]
    the directory containing the Carthage project

As you can see there is no mention to an option to specify only one dependency to update.

You should open an issue on the project repo asking to support that.




回答4:


If the framework isn't stored in GitHub, or you are using the git identifier, and your cartfile looks like this:

git "ssh://git@bitbucket.org/teamname/repo-name.git" ~> 1.0

then you can update only that one running the following command

carthage update repo-name



回答5:


I tried all of the answers, and for me only removing or commenting temporarily the repositories and after running

carthage update --platform ios

after I restore the Catfile to previous state




回答6:


I ended up writing my own script that builds a single dependency for me and merges it with my existing dependencies. You can find it at https://github.com/ruipfcosta/carthage-workarounds.




回答7:


Swift 5

//MARK:- Step 1
carthage update KeychainAccess --platform iOS

carthage update SDKNAME(like i mention KeychainAccess upper) --platform iOS

if you face an Error like this

//MARK:- If this error occur
error: unable to find utility "xcodebuild", not a developer tool or in PATH

Then use Part 1 in Terminal Again

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

and again

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer



回答8:


[carthage update flow]

carthage [update|bootstrap|checkout|build] [dependency1] [dependency2] [--no-use-binaries] [--platform <name>]

//--no-use-binaries - does not use prebuild binary and use source code
//--platform - specify a platform

The longest phase is a build step[xcodebuild] because:

  1. fat binary is built using lipo[About]
  2. Carthage builds all shared frameworks schemes of a project. If you know which exactly schema which you need you can:

    • Leave specific schemes at xcschemes folder .../Carthage/Checkouts/<dependency>/<project>.xcodeproj/xcshareddata/xcschemes/<schema>.xcscheme

    • Open built project from Carthage/Checkouts folder -> Manage Schemes... -> leave specific schemes



来源:https://stackoverflow.com/questions/30612995/how-to-update-just-one-library-from-the-cartfile-with-carthage

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!