Local SPM dependencies - test targets

Hi,

we started evaluating Tuist (again) at Kleinanzeigen. Our manually maintained project looks roughly like this:

App
  - KleinanzeigenKit
    - SomeKit
    - OtherKit
    - APIKit
      - Alamofire

Every dependency is integrated via SPM, and the App target has only one dependency to KleinanzeigenKit. Most of these dependencies are local ones directly available in our mono repo (KleinainzeigenKit, SomeKit, OtherKit, APIKit), but some are remote dependencies (Alamofire, …).

In Package.swift of KleinanzeigenKit you’ll find something like this:

let package = Package(
    name: "KleinanzeigenKit",
    dependencies: [
      .package(path: "../SomeKit"),
      .package(path: "../OtherKit"),
      .package(path: "../APIKit"),

And APIKit would roughly look like this:

let package = Package(
    name: "APIKit",
    dependencies: [
      .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.9.1")),

It was quite easy to start using Tuist, we simply added one dependency to Tuist/Package.swift: KleinanzeigenKit. That pulled in our whole dependency graph perfectly fine. Next we defined one app Project, added a dependency to KleinanzeigenKit, and it was up and running. Big kudos to the whole Tuist team, it’s quite the complex project and it was working out of the box just like that within minutes!

Now we’re wondering how to best approach the next steps, especially how to get schemes generated for all of our local Swift packages. Almost all of these local packages have a test target. And we’d like to generate a scheme for each of them, so the developers can easily execute tests. For another while we’ll probably have to support our manually maintained project, as well as Tuist. This means we want to stick to SPM for managing our local packages, and avoid describing each of them as Tuist targets, if that’s possible at all. Do you have any recommendation for us maybe? :slight_smile:

Thanks,
Johannes

Hey @plu!

Excited to hear that Kleinanzeigen is considering using Tuist :tada: As a Berliner, I use that app quite often :grin:

And we’d like to generate a scheme for each of them, so the developers can easily execute tests.

There’s a PR to implement that behavior: Add test targets to dependent local swift packages by woin2ee · Pull Request #6436 · tuist/tuist · GitHub

We can try to take the PR over and finish it. Currently, you’d need to convert the SPM unit test targets to Tuist.

This means we want to stick to SPM for managing our local packages, and avoid describing each of them as Tuist targets, if that’s possible at all.

We generally recommend eventually migrating to Tuist as you won’t be able to get the full benefits of Tuist if you keep using local packages. If you feel strongly about keeping some targets defined using SPM, I’d consider at least moving to the XcodeProj-based integration by referencing them in the Tuist/Package.swift file.

You can book some time with us if you want to discuss the options in a call.

Hey @marekfort,

thank you for the quick response and your recommendations! Happy to hear you’re a Kleinanzeigen user :blush:.

No need to pick up the other PR just for us. Mid-term the goal for us should be to define our project completely via Tuist, I guess.

Thank you for the offer meeting in a call and having a discussion about our options. I might get back on that offer some time soon :slight_smile:.

1 Like

Hi hi :wave:

I second what @marekfort said regarding the definition of the entire graph in Tuist. The only reason why I’d recommend someone to declare a target using SPM’s DSL is if they plan to share that package across repositories. If that’s not your case, I think you’ll be better described as much of the graph as possible in Tuist, because that means we cannot only ensure things are integrated properly, but also lint the graph surfacing any issues ahead of compilation, and optimize it so that your workflows are as fast as they can be.

Do you folks have the HQ in Berlin? I was wondering if you’d be up for us giving an internal talk at the company touching on the challenges of working with Xcode at scale, the things that we learned, and how you can overcome them using Tuist. How would that sound?

Mit freundlichen Grüssen!

Hi @pepicrft,

thank you for your response & advise!

Do you folks have the HQ in Berlin? I was wondering if you’d be up for us giving an internal talk at the company touching on the challenges of working with Xcode at scale, the things that we learned, and how you can overcome them using Tuist. How would that sound?

Our HQ is actually in Berlin, Charlottenburg. Unfortunately I’m working remotely from Munich. Currently I’m the only developer exploring Tuist at Kleinanzeigen. But I’ll talk to my colleague who’s based in Berlin about your offer. I’ll get back to you soon!

Mit freundlichen Grüßen zurück aus München :slight_smile:

Super! Keep us posted. We can do a “Xcode at scale” day workshop and share our learnings with the entire organization.