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

Scaling CocoaPods

Scaling CocoaPods

A lightning talk given at Square's OSCON party

Samuel E. Giddins

July 18, 2018
Tweet

More Decks by Samuel E. Giddins

Other Decks in Technology

Transcript

  1. Scaling CocoaPods
    Samuel Giddins
    Scaling CocoaPods @ Square 1

    View Slide

  2. Samuel Giddins
    Mobile Developer Experience @ Square
    CocoaPods Core Contributor
    Scaling CocoaPods @ Square 2

    View Slide

  3. Mobile Developer Experience
    Scaling CocoaPods @ Square 3

    View Slide

  4. Mobile Developer Experience
    ➡ Owns the build system, dependency manager, interface with CI
    Scaling CocoaPods @ Square 3

    View Slide

  5. Mobile Developer Experience
    ➡ Owns the build system, dependency manager, interface with CI
    ➡ Maintains the (open source) tools used to build the app
    Scaling CocoaPods @ Square 3

    View Slide

  6. Mobile Developer Experience
    ➡ Owns the build system, dependency manager, interface with CI
    ➡ Maintains the (open source) tools used to build the app
    ➡ Keeps developers as productive as possible
    Scaling CocoaPods @ Square 3

    View Slide

  7. Mobile Developer Experience
    ➡ Owns the build system, dependency manager, interface with CI
    ➡ Maintains the (open source) tools used to build the app
    ➡ Keeps developers as productive as possible
    ➡ Cross platform: iOS & Android
    Scaling CocoaPods @ Square 3

    View Slide

  8. Mobile Developer Experience
    ➡ Owns the build system, dependency manager, interface with CI
    ➡ Maintains the (open source) tools used to build the app
    ➡ Keeps developers as productive as possible
    ➡ Cross platform: iOS & Android
    ➡ Develops CocoaPods features
    Scaling CocoaPods @ Square 3

    View Slide

  9. CocoaPods @ Square
    Scaling CocoaPods @ Square 4

    View Slide

  10. CocoaPods @ Square
    ➡ 265 total pods
    Scaling CocoaPods @ Square 4

    View Slide

  11. CocoaPods @ Square
    ➡ 265 total pods
    ➡Pods directory is 1005 MB
    Scaling CocoaPods @ Square 4

    View Slide

  12. CocoaPods @ Square
    ➡ 265 total pods
    ➡Pods directory is 1005 MB
    ➡Over 10,000 source files
    Scaling CocoaPods @ Square 4

    View Slide

  13. CocoaPods @ Square
    ➡ 265 total pods
    ➡Pods directory is 1005 MB
    ➡Over 10,000 source files
    ➡ Swift, Objective-C
    Scaling CocoaPods @ Square 4

    View Slide

  14. CocoaPods @ Square
    ➡ 265 total pods
    ➡Pods directory is 1005 MB
    ➡Over 10,000 source files
    ➡ Swift, Objective-C
    ➡ Dynamic Frameworks, Static Libraries, Static Frameworks
    Scaling CocoaPods @ Square 4

    View Slide

  15. CocoaPods @ Square
    ➡ 265 total pods
    ➡Pods directory is 1005 MB
    ➡Over 10,000 source files
    ➡ Swift, Objective-C
    ➡ Dynamic Frameworks, Static Libraries, Static Frameworks
    ➡ Monorepo & Multirepo
    Scaling CocoaPods @ Square 4

    View Slide

  16. CocoaPods @ Square
    is
    CocoaPods @ Scale
    Scaling CocoaPods @ Square 5

    View Slide

  17. CocoaPods at home in a monorepo
    Generating a scratch workspace for a single pod
    $ pod gen Frameworks/SquareUIComponents --auto-open
    Describing tests in a podspec
    Pod::Spec.new do |s|
    s.test_spec 'Tests' do |ts|
    ts.source_files = 'Tests/**/*.{h,m}'
    end
    end
    Scaling CocoaPods @ Square 6

    View Slide

  18. Automation
    Removing the depending on the open-source specs repo
    $ pod whitelist NAME VERSION
    Whitelists a (pod, version) tuple for internal Square use
    Automatically generating pre-built binary pods on CI
    $ pod bin NAME.podspec [ARTIFACT_REPO_URL]
    Converts the provided `NAME.podspec` into a binary version. The process includes, installing a sandbox,
    building the sandbox using release configuration for both device and simulator, packing the output
    and generate a new podspec that uses `ARTIFACT_REPO_URL` as the source.
    The generated podspec is also validated.
    Scaling CocoaPods @ Square 7

    View Slide

  19. CocoaPods Performance
    Scaling CocoaPods @ Square 8

    View Slide

  20. CocoaPods Performance
    ➡ Lots of profiling with rbspy
    Scaling CocoaPods @ Square 8

    View Slide

  21. CocoaPods Performance
    ➡ Lots of profiling with rbspy
    ➡ Resolver refactoring to make graph traversal not take forever
    Scaling CocoaPods @ Square 8

    View Slide

  22. CocoaPods Performance
    ➡ Lots of profiling with rbspy
    ➡ Resolver refactoring to make graph traversal not take forever
    ➡ Build setting generation rewrite to memoize everything
    Scaling CocoaPods @ Square 8

    View Slide

  23. Investment in Monitoring
    Scaling CocoaPods @ Square 9

    View Slide

  24. Investment in Monitoring
    ➡ chronometer to instrument method calls
    Scaling CocoaPods @ Square 9

    View Slide

  25. Investment in Monitoring
    ➡ chronometer to instrument method calls
    ➡ Log durations to in-house logging system
    Scaling CocoaPods @ Square 9

    View Slide

  26. Investment in Monitoring
    ➡ chronometer to instrument method calls
    ➡ Log durations to in-house logging system
    ➡ Roll up into dashboards visible to the entire organization
    Scaling CocoaPods @ Square 9

    View Slide

  27. Investment in Monitoring
    Scaling CocoaPods @ Square 10

    View Slide

  28. Ownership of our Destiny
    Scaling CocoaPods @ Square 11

    View Slide

  29. Ownership of our Destiny
    ➡ The team owns our use of CocoaPods, not any individual
    contributors
    Scaling CocoaPods @ Square 11

    View Slide

  30. Ownership of our Destiny
    ➡ The team owns our use of CocoaPods, not any individual
    contributors
    ➡ No forks, few hacks, no helplessness
    Scaling CocoaPods @ Square 11

    View Slide

  31. Ownership of our Destiny
    ➡ The team owns our use of CocoaPods, not any individual
    contributors
    ➡ No forks, few hacks, no helplessness
    ➡ Open Source sharing expertise with therest of the industry
    Scaling CocoaPods @ Square 11

    View Slide

  32. Continuous Re-Evaluation
    Scaling CocoaPods @ Square 12

    View Slide

  33. Continuous Re-Evaluation
    ➡ Even though we have core contributors, we're open to not using
    CocoaPods
    Scaling CocoaPods @ Square 12

    View Slide

  34. Continuous Re-Evaluation
    ➡ Even though we have core contributors, we're open to not using
    CocoaPods
    ➡ Taking as many lessons as possible from other tools,
    such as Buck and Bazel
    Scaling CocoaPods @ Square 12

    View Slide

  35. Continuous Re-Evaluation
    ➡ Even though we have core contributors, we're open to not using
    CocoaPods
    ➡ Taking as many lessons as possible from other tools,
    such as Buck and Bazel
    ➡ CocoaPods is a tool, tools are replaceable.
    Our expertise is forever.
    Scaling CocoaPods @ Square 12

    View Slide

  36. CocoaPods: Scaled?
    Scaling CocoaPods @ Square 13

    View Slide

  37. CocoaPods: Scaled?
    Scaling CocoaPods @ Square 14

    View Slide

  38. CocoaPods: Scaled?
    ➡ Last year's crisis of confidence is over
    Scaling CocoaPods @ Square 14

    View Slide

  39. CocoaPods: Scaled?
    ➡ Last year's crisis of confidence is over
    ➡ We've onboarded 2 new people to contribute to CocoaPods
    Scaling CocoaPods @ Square 14

    View Slide

  40. CocoaPods: Scaled?
    ➡ Last year's crisis of confidence is over
    ➡ We've onboarded 2 new people to contribute to CocoaPods
    ➡ Development has internal ownership (my team!)
    Scaling CocoaPods @ Square 14

    View Slide

  41. CocoaPods: Scaled?
    ➡ Last year's crisis of confidence is over
    ➡ We've onboarded 2 new people to contribute to CocoaPods
    ➡ Development has internal ownership (my team!)
    ➡ Performance has improved slightly, with a massive increase in:
    Scaling CocoaPods @ Square 14

    View Slide

  42. CocoaPods: Scaled?
    ➡ Last year's crisis of confidence is over
    ➡ We've onboarded 2 new people to contribute to CocoaPods
    ➡ Development has internal ownership (my team!)
    ➡ Performance has improved slightly, with a massive increase in:
    ➡features
    Scaling CocoaPods @ Square 14

    View Slide

  43. CocoaPods: Scaled?
    ➡ Last year's crisis of confidence is over
    ➡ We've onboarded 2 new people to contribute to CocoaPods
    ➡ Development has internal ownership (my team!)
    ➡ Performance has improved slightly, with a massive increase in:
    ➡features
    ➡# of modules
    Scaling CocoaPods @ Square 14

    View Slide

  44. CocoaPods: Scaled?
    ➡ Last year's crisis of confidence is over
    ➡ We've onboarded 2 new people to contribute to CocoaPods
    ➡ Development has internal ownership (my team!)
    ➡ Performance has improved slightly, with a massive increase in:
    ➡features
    ➡# of modules
    ➡amount of code managed by CocoaPods
    Scaling CocoaPods @ Square 14

    View Slide

  45. CocoaPods: Scaled
    @segiddins
    MDX @ Square
    Scaling CocoaPods @ Square 15

    View Slide