Promote tuist generate warnings to errors

Generation warnings are easy to miss. They show up at the end of tuist generate, but by the time you’re looking at your freshly opened Xcode project, those warnings are long forgotten.

Starting now, you can promote specific generation warnings to errors in your Tuist.swift, causing tuist generate to fail immediately when they occur:

let tuist = Tuist(
    project: .tuist(
        generationOptions: .options(
            warningsAsErrors: .only([.outdatedDependencies, .mismatchedConfigurations])
        )
    )
)

Because the configuration lives in the manifest, platform teams can enforce these policies across the whole team.

Warning categories

The following warning categories are available:

  • outdatedDependencies – resolved dependencies don’t match the manifest
  • staticSideEffects – multiple graph branches include the same static library
  • schemeTargetNotFound – a scheme references a target that doesn’t exist
  • mismatchedConfigurations – targets in the graph have inconsistent build configurations
  • duplicateProductNames – multiple targets produce the same product name

You can promote all of them at once with .all, pick specific ones with .only([...]), or keep the current behavior with .none (the default).

The full design is in the RFC and the implementation in PR #9574.

This is great, several times I’ve run tuist generate and not noticed that it warned about outdated dependencies then been confused when a compilation error happens.

Only partially related, but it would be good if there was an option for tuist generate to automatically run tuist install and then rerun tuist generate instead of warning/erroring.

1 Like