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

An alternative approach to building & shipping Swift apps

Keith Smiley
November 29, 2019

An alternative approach to building & shipping Swift apps

Working with 70+ iOS engineers uncovers many problems with Apple's tooling. By replacing Xcode's build system with bazel, we were able to decrease build times, stop doing clean builds on CI, and rely on remotely cached artifacts to stop developers from having to rebuild files they haven't changed.

Keith Smiley

November 29, 2019
Tweet

More Decks by Keith Smiley

Other Decks in Technology

Transcript

  1. An alternative approach
    to building & shipping
    Swift apps

    View full-size slide

  2. → 70+ iOS engineers
    → 800k+ lines of Swift + 0 lines of Objective-C
    → 600+ "modules"
    → 1200+ Xcode targets
    → 800+ Interface Builder files

    View full-size slide

  3. Xcode is hard.

    View full-size slide

  4. .xcodeproj maintainability

    View full-size slide

  5. yonaskolb/XcodeGen

    View full-size slide

  6. Target configuration
    abstractions

    View full-size slide

  7. Detaching what's
    presented with what's
    built

    View full-size slide

  8. Building things you didn't
    change

    View full-size slide

  9. Control over our build

    View full-size slide

  10. Sharing tools across the
    teams

    View full-size slide

  11. xcodebuild -> ?

    View full-size slide

  12. → Compile sources with the right arguments
    → Package everything correctly
    → Do as little work as possible
    → Do all of that, fast

    View full-size slide

  13. Build configuration

    View full-size slide

  14. module(
    name = "Storage",
    deps = [
    "Logger",
    ],
    )
    unit_test(
    name = "StorageTests",
    deps = [
    "Storage",
    ],
    )

    View full-size slide

  15. Smaller Xcode projects

    View full-size slide

  16. Hermetic builds

    View full-size slide

  17. Never rm -rf DerivedData
    again

    View full-size slide

  18. Remote build caching

    View full-size slide

  19. Remote execution

    View full-size slide

  20. So I should use bazel?

    View full-size slide

  21. Control over your build

    View full-size slide

  22. There are a lot of things
    you can do first

    View full-size slide

  23. You're on your own*

    View full-size slide

  24. *but we have your back

    View full-size slide

  25. Bazel is great, once you
    need it

    View full-size slide

  26. https://slack.bazel.build

    View full-size slide

  27. Thanks!
    @SmileyKeith

    View full-size slide