Skip to content

Unify doctor checks and code that locates binary artifacts (executables, sdks) #9134

Closed as not planned

Description

@cbracken

A lot of the tool presence/version checks we perform in flutter doctor would be useful to perform before steps that involve invocation of those tools.

Examples from the iOS side include checking Xcode and CocoaPods presence/version and presence of the Python six module before iOS build/run.

One option would be to factor out a tool class that has the ability to check presence/version of the tool and how to run it, then use this in the build step and in doctor.

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: flutter doctorProblem related to the "flutter doctor" tool
    on Mar 31, 2017
  2. cbracken commented on Mar 31, 2017

    @cbracken
    MemberAuthor
  3. johnmccutchan commented on Apr 2, 2017

    @johnmccutchan
    Contributor

    @cbracken I strongly support this. I have started a sketch of ArtifactLocator. In addition to providing the kind of structure you are getting at, a locator will also keep an exhaustive history of how and where flutter_tools searched for the tool (this is mostly useful for diagnostics and debugging). WDYT?

    /// Each artifact used by flutter_tools will have an ArtifactLocator class which can find the artifact's path and version.
    abstract class ArtifactLocator {
      // For a given artifact (e.g. Android SDK), the list of locations.
      List<ArtifactLocation> locations;
      // The preferred version (highest version or based on some other policy)
      ArtifactLocation preferred;
    
      // The list of locations searched.
      List<ArtifactLocatorCheck> checks;
    
      // Locates tool. Reports location if artifact was successfully located. 
      Future<ArtifactLocation> locate([Version minimumVersion]);
    }
    /// The version and location of an artifact.
    class ArtifactLocation {
      final Version version;
      final Uri location;
    }
    /// Used for diagnostics. 
    class ArtifactLocatorCheck {
      // Location checked.
      final Uri location;
      // Version found or null (if nothing was present).
      final Version version;
      // A message. e.g. [Checked $JAVA_HOME environment variable].
      final String message;
    }
  4. cbracken commented on Apr 10, 2017

    @cbracken
    MemberAuthor

    SGTM - I like it. Extending this to all artifacts allows us to use it for local vs shipping engine etc.

  5. added this to the milestone on Apr 12, 2017
  6. johnmccutchan commented on Apr 17, 2017

    @johnmccutchan
    Contributor

    I'm dropping the 'doctor' label because this issue goes far beyond the 'doctor' and will actually affect all sub-tool finding / launching in flutter_tools.

  7. changed the title [-]Refactor flutter doctor checks to be reusable elsewhere[/-] [+]Unify doctor checks and code that locates binary artifacts (executables, sdks)[/+] on Apr 17, 2017
  8. added 8 commits that reference this issue on Jul 8, 2019
  9. removed this from the milestone on Dec 10, 2020
  10. added
    P3Issues that are less important to the Flutter project
    and removed on Jun 28, 2023
  11. matanlurey commented on Jun 27, 2025

    @matanlurey
    Contributor

    Closing as non-specific, some of this was done over the years, if there are particular places we should consolidate or refactor further, let's file specific issues.

  12. github-actions commented on Jul 11, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on Jul 11, 2025
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

    P3Issues that are less important to the Flutter projecta: first hourThe first hour of using Fluttert: flutter doctorProblem related to the "flutter doctor" toolteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions