Skip to content

[packages] Warnings in Swift code aren't caught in CI #194517

Open

Description

@stuartmorgan

The repo tool analyze command is supposed to fail on warnings, which has allowed us to keep our code warning-free, and in particular to find deprecated code in advance of it becoming a problem using the *-min-version flags in CI.

Except we wrote that tooling when all of the code was Obj-C, so GCC_TREAT_WARNINGS_AS_ERRORS was all we needed. But GCC_TREAT_WARNINGS_AS_ERRORS doesn't apply to Swift, so we've been silently losing warning coverage in CI as we ported plugins to Swift 🤦

I haven't tried yet, but hopefully we just need to add SWIFT_TREAT_WARNINGS_AS_ERRORS to that command to restore things. Doing so is going to require fixing all the latent warnings that have been introduced though, so it will probably be non-trivial.

Pinned by jmagman

Activity

  1. added
    a: tests"flutter test", flutter_test, or one of our tests
    packageflutter/packages repository. See also p: labels.
    team-iosOwned by iOS platform team
    on Oct 16, 2026
  2. stuartmorgan commented on Oct 16, 2026

    @stuartmorgan
    ContributorAuthor

    flutter/packages#13284 has a trial run. There are quite a few failing packages, but from spot checking a lot of them are just one or two warnings.

    It looks like the tricky part will be the instances of

    error: conflicting options '-warnings-as-errors' and '-suppress-warnings'
    

    In particular, it looks like passing it on the command line is applying it to external dependencies, which causes problems:

    error: Conflicting options '-warnings-as-errors' and '-suppress-warnings' (in target 'GoogleMapsUtils' from project 'GoogleMapsUtils')
    

    The tooling may need to add this to individual Xcode targets instead of passing it as an argument, but that would be significantly more complicated.

  3. jmagman commented on Oct 16, 2026

    @jmagman
    Member

    r'SWIFT_TREAT_WARNINGS_AS_ERRORS=$(SWIFT_SUPPRESS_WARNINGS:not)' worked: flutter/packages#13284 (comment)

  4. added
    P2Important issues not at the top of the work list
    triaged-iosTriaged by iOS platform team
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsp: toolingAffects the flutter_plugin_tools packagepackageflutter/packages repository. See also p: labels.team-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions