Skip to content

Offer to "git clone" the Flutter repo to a location of users choice if no SDK is found (and "git" is available) #4532

Closed

Description

@DanTup

Splitting from #226 since Dart/Flutter would be different paths.

Currently if we don't find a Flutter SDK, we show a prompt to the user with a "Locate SDK" button that lets them browse (using a file picker) to where they have downloaded it. We validate this is an SDK and write it into the dart.flutterSdkPath setting.

We could consider adding an additional button to this prompt "Download SDK" that will ask the user (via a file picker) where they'd like to download it, and we can just "git clone" it for them, set the dart.flutterSdkPath setting, and run the Flutter: Run Flutter Doctor command at the end.

If we can't find git we could link them to a page on the website telling them to get git first.

@polina-c

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in flutterRelates to running Flutter apps
    on May 9, 2023
  2. added this to the v3.66.0 milestone on May 9, 2023
  3. DanTup commented on May 16, 2023

    @DanTup
    MemberAuthor

    I have a basic PoC working.. When it fails to find a Flutter SDK the "Download SDK" button will try to run git --version to check there's a working git. If so, it'll ask you where to clone the SDK and do so, and otherwise open the usual download page.

    After cloning, it'll prompt you to reload, which then goes through the normal "Initializing Flutter" flow you'd see on a fresh clone.

    I'm slightly nervous about running git commands in the background (there doesn't seem to be a non-interactive flag and I'm unsure if it could ever try to spawn any UI or hang on user input), but maybe it's fine.

    There's currently not much notification of progress or ability to cancel, which would be a requirement to ship this.

  4. modified the milestones: v3.66.0, v3.68.0 on May 31, 2023
  5. DanTup commented on Jun 15, 2023

    @DanTup
    MemberAuthor

    PowerShell has an Expand-Archive cmdlet that could also allow us to use the zip file here:

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/expand-archive?view=powershell-7.3

    So if we think Git might be a problem for Windows users, we could consider that instead (presumably we could try to run Expand-Archive --help or similar through pwsh to check whether it's available). We could potentially also support both - although I don't know if we'd have a preference if both are available.

    @jacob314 @christopherfujino do you know of any reasons to prefer one over the other (a git clone vs downloading the archive)?

  6. christopherfujino commented on Jun 15, 2023

    @christopherfujino

    Well,

    1. git is required for the tool to work; however
    2. I believe the prebuilt archives have mingit vendored in case the user doesn't have git locally installed.

    With the caveat, I have no idea if the mingit we vendor actually works.

  7. DanTup commented on Jun 28, 2023

    @DanTup
    MemberAuthor

    I've decided to ship this just using git for now. If you don't have git, you'll get the old flow.

    For those opted in to analytics, we will get events for those where we couldn't use git (versus those where we could, and whether the clone succeeded). If there's a large ratio of "no git" events, I'll revisit this.

    (I've removed the experimental flag so this will start showing up with the next release - and on the pre-release I'll push before the end of today).

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

    in flutterRelates to running Flutter appsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions