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

CocoaPods Dependency Resolution

CocoaPods Dependency Resolution

This is a talk I gave at Stripe on the work I've done building Molinillo, the new CocoaPods dependency resolver. The page detailing the event is at https://stripe.com/blog/open-source-retreat-meetup, and the source for this presentation is at https://github.com/segiddins/Stripe-OSR-Talk.

A video is available at https://www.youtube.com/watch?v=-vMLpUD2Jw0.

Samuel E. Giddins

October 21, 2014
Tweet

More Decks by Samuel E. Giddins

Other Decks in Programming

Transcript

  1. COCOAPODS DEPENDENCY RESOLUTION:
    INTRODUCING Molinillo
    SAMUEL E. GIDDINS
    @SEGIDDINS

    View full-size slide

  2. RELEASES
    0.34.0.RC1, 0.34.0, 0.34.1, 0.34.2, 0.34.4

    View full-size slide

  3. Molinillo
    DEPENDENCY RESOLUTION GEM

    View full-size slide

  4. BUT FIRST, A DETOUR

    View full-size slide

  5. THE PODSPEC
    Pod::Spec.new do |s|
    s.name = 'PromiseKit-AFNetworking'
    s.version = '0.1.4'
    s.dependency 'AFNetworking', '~> 2.0'
    s.dependency 'PromiseKit/Promise'
    end

    View full-size slide

  6. THE PODFILE
    source 'https://github.com/CocoaPods/Specs'
    platform, :ios, '8.1'
    pod 'AFNetworking', '< 1.3'
    pod 'RestKit', '~> 0.23.0'
    pod 'SEGModules', git: 'https://github.com/segiddins/SEGModules.git'

    View full-size slide

  7. HOW IT WORKS

    View full-size slide

  8. ENCAPSULATION
    ▸ SpecificationProvider
    ▸ UI

    View full-size slide

  9. THE ALGORITHM
    ▸ Constrainst Solving Problem
    ▸ Backtracking
    ▸ Forward Checking

    View full-size slide

  10. STACK OF States
    AND ➿

    View full-size slide

  11. SORT DEPENDENCIES
    HANDLE ONE
    CREATE A POSSIBILITY STATE

    View full-size slide

  12. SEE IF IT WORKS

    View full-size slide

  13. YES => MOVE ON
    NO => UNWIND FOR CONFLICT

    View full-size slide

  14. STOP WHEN ALL REQUIREMENTS ARE ACTIVATED

    View full-size slide

  15. RAISE WHEN THERE ARE NO POSSIBIBLE STATES LEFT

    View full-size slide

  16. platform :ios, "7.0"
    inhibit_all_warnings!
    pod 'RestKit'
    pod 'AFNetworking', '~> 1.2.0'
    Before:
    [!] Unable to satisfy the following requirements:
    - `AFNetworking (~> 1.3.0)` required by `RestKit/Network (0.23.3)`
    - `AFNetworking (~> 1.2.0)` required by `Podfile`

    View full-size slide

  17. platform :ios, "7.0"
    inhibit_all_warnings!
    pod 'RestKit'
    pod 'AFAmazonS3Client'
    pod 'CargoBay'
    pod 'AFOAuth2Client'
    Before:
    [!] Unable to satisfy the following requirements:
    - `AFNetworking (~> 1.3.0)` required by `RestKit/Network (0.23.3)`
    - `AFNetworking (~> 1.2.0)` required by `Podfile`

    View full-size slide

  18. platform :ios, "7.0"
    inhibit_all_warnings!
    pod 'AFAmazonS3Client'
    pod 'CargoBay'
    pod 'AFOAuth2Client'
    Before:
    [!] Unable to satisfy the following requirements:
    - `AFNetworking (~> 2.0)` required by `AFAmazonS3Client (2.0.0)`
    - `AFNetworking/Serialization` required by `AFNetworking (2.4.1)`
    - `AFNetworking/Security` required by `AFNetworking (2.4.1)`
    - `AFNetworking/Reachability` required by `AFNetworking (2.4.1)`
    - `AFNetworking/NSURLConnection` required by `AFNetworking (2.4.1)`
    - `AFNetworking/NSURLSession` required by `AFNetworking (2.4.1)`
    - `AFNetworking/UIKit` required by `AFNetworking (2.4.1)`
    - `AFNetworking/Serialization` required by `AFNetworking/NSURLConnection (2.4.1)`
    - `AFNetworking/Reachability` required by `AFNetworking/NSURLConnection (2.4.1)`
    - `AFNetworking/Security` required by `AFNetworking/NSURLConnection (2.4.1)`
    - `AFNetworking/Serialization` required by `AFNetworking/NSURLSession (2.4.1)`
    - `AFNetworking/Reachability` required by `AFNetworking/NSURLSession (2.4.1)`
    - `AFNetworking/Security` required by `AFNetworking/NSURLSession (2.4.1)`
    - `AFNetworking/NSURLConnection` required by `AFNetworking/UIKit (2.4.1)`
    - `AFNetworking/NSURLSession` required by `AFNetworking/UIKit (2.4.1)`
    - `AFNetworking (~> 2.2)` required by `CargoBay (2.1.0)`
    - `AFNetworking (~> 1.3)` required by `AFOAuth2Client (0.1.2)`

    View full-size slide

  19. After:
    it just works !

    View full-size slide

  20. ! STRIPE !

    View full-size slide

  21. SAMUEL E. GIDDINS
    COCOAPODS CORE TEAM
    @SEGIDDINS

    View full-size slide