You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Offer to "git clone" the Flutter repo to a location of users choice if no SDK is found (and "git" is available) #4532
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.
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.
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)?
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).
Activity
Add basic support for "git clone"ing Flutter
DanTup commentedon May 16, 2023
I have a basic PoC working.. When it fails to find a Flutter SDK the "Download SDK" button will try to run
git --versionto check there's a workinggit. 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.
Add basic support for "git clone"ing Flutter
Add basic support for "git clone"ing Flutter
DanTup commentedon Jun 15, 2023
PowerShell has an
Expand-Archivecmdlet 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 --helpor similar throughpwshto 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)?
christopherfujino commentedon Jun 15, 2023
Well,
With the caveat, I have no idea if the mingit we vendor actually works.
DanTup commentedon Jun 28, 2023
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).
Remove experimentalFlutterGitClone flag