Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Carthage

 Carthage

Talk from NSLondon about the Carthage Dependency Management system for Xcode

Abizer Nasir

July 30, 2015
Tweet

More Decks by Abizer Nasir

Other Decks in Programming

Transcript

  1. What Does it do? 4 Takes a list of dependencies,

    that may have their own dependencies 4 Resolves versions 4 Fetches the dependencies 4 builds them with their own project settings
  2. Cartfile github “ReactiveCocoa/ReactiveCocoa” >= 2.3.1 github “Mantle/Mantle” ~> 1.0 github

    “jspahrsummers/libextobjc” == 0.4.1 #arbitrary server git “https://enterprise.local/desktop/git-error-translations.git” “development” #local file git “file:///directory/to/project” “branch”
  3. Normal Semantic versioning 4 >= 1.0 for “at least version

    1.0” 4 ~> 1.0 for “compatible with version 1.0” 4 == 1.0 for “exactly version 1.0” 4 “some-branch-or-tag-or-commit” for a specific Git object (anything allowed by git rev-parse)
  4. Cartfile.private Same format as the Cartfile. Dependencies that your project

    needs that aren’t necessary for it to be used. These are not shared upstream. For example; things you need for testing.
  5. carthage help update [--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’)
  6. carthage build Just builds what you have already. This is

    useful if you are using submodules.
  7. Writing modules 4 Share your build schemes 4 When writing

    a Foundation module, create a separate target for iOS and Mac (takes some tweaking, but it can be done).
  8. !

  9. When things go wrong Because they will! - Check what

    compiler you are using with xcode-select -p - fix your build with carthage build --no-skip-current, build the scheme to see more detailed errors. - Blitz Carthage folder and Cartfile.resolved - Blitz the cache at ~/Library/Caches/carthage - Bitcode!
  10. When it all goes completely wrong! Because it will! -

    Change the Carthage update method to use submodules and not build. - Remove the linked frameworks. - Drag the dependency project files into your project and build it “old school”.
  11. Git