Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a command to "Add SDK to Path" and offer to invoke it automatically after downloading an SDK [Windows] #4604

Closed
2 tasks done
polina-c opened this issue Jun 21, 2023 · 12 comments
Labels
in commands Relates to commands (usually invoked from the command Palette) is enhancement on windows
Milestone

Comments

@polina-c
Copy link

polina-c commented Jun 21, 2023

go/setup-path-with-flutter-extension

  • Get URL to open instructions on Flutter website
  • Offer this flow after cloning SDK
@DanTup
Copy link
Member

DanTup commented Jun 22, 2023

@polina-c is this doc public? Does it have a public URL? go / goto.google.com links don't work for non-Googlers (they require logging in with a google account)

@DanTup DanTup changed the title 'Download Flutter SDK' should setup global path to Flutter. Add a command to "Add SDK to Path" and offer to invoke it automatically after downloading an SDK Jun 22, 2023
@DanTup DanTup added this to the v3.68.0 milestone Jun 22, 2023
@DanTup DanTup added the in commands Relates to commands (usually invoked from the command Palette) label Jun 22, 2023
@DanTup
Copy link
Member

DanTup commented Jun 22, 2023

Tweaked the title a bit because this should be a command you can use even when not downloading.

I managed to get the command working on Windows today using PowerShell (at least, it works on my machine). It reports whether it was a) added, b) failed to add or c) already on PATH.

I haven't done any testing on Mac yet (or had the download prompt to do it automatically), but since VS Code is already doing that I expect it shouldn't be too difficult.

@polina-c
Copy link
Author

Will we have telemetry for ratio of successful cases?

@DanTup
Copy link
Member

DanTup commented Jun 22, 2023

I'd like to record the number of successful/unsuccessful attempts for both git clone and adding to path (for opted-in users).

@polina-c
Copy link
Author

@polina-c is this doc public? Does it have a public URL? go / goto.google.com links don't work for non-Googlers (they require logging in with an @google account)

It is not public. Yes, it works just for googlers. And it is ok for this case.
Feel free to create public copy, if you feel it is right thing to do.

DanTup added a commit that referenced this issue Jun 26, 2023
@DanTup
Copy link
Member

DanTup commented Jun 26, 2023

I've merged in some changes for this:

  • New "Flutter: Add SDK to Path" and "Dart: Add SDK to Path" commands in the command palette
  • For Windows, these will automatically add to Path if able to run the PowerShell script
  • For other platforms (or if the PS script fails), prompt user to add manually
  • When cloning Flutter via Git, automatically ask if we should add to PATH (for Windows, otherwise just prompt to show instructions and skip the initial prompt)

I've included this in a pre-release version today (v3.67.20230626), though the "git clone" flow is still behind the "dart.experimentalFlutterGitClone" flag because I'd like some additional testing/feedback of that before I remove the flag.

@DanTup DanTup changed the title Add a command to "Add SDK to Path" and offer to invoke it automatically after downloading an SDK Add a command to "Add SDK to Path" and offer to invoke it automatically after downloading an SDK [Windows] Jun 26, 2023
@DanTup
Copy link
Member

DanTup commented Jun 26, 2023

I'm making this issue Windows-specific (and closing because it's merged) and have opened #4612 to track macOS, since I suspect there may be more discussion (and complications). I don't want to hold up the current work (which should work for Windows, and can also open instructions for other platforms) if we don't get a Mac solution before the next release.

@polina-c btw, if we can't add automatically, these are the URLs I'm currently linking to for manual instructions - we can tweak these if required:

export const addToPathInstructionsUrl = isWin
? "https://docs.flutter.dev/get-started/install/windows#update-your-path"
: isMac
? "https://docs.flutter.dev/get-started/install/macos#update-your-path"
: isLinux && !isChromeOS
? "https://docs.flutter.dev/get-started/install/linux#update-your-path"
: undefined;

@DanTup DanTup closed this as completed Jun 26, 2023
@polina-c
Copy link
Author

Is there auto-testing that links are not broken?

This is what we have in DevTools:

for (final link in DocLinks.values) {
    test('$link is not broken', () async {
      final content = await loadPageHtmlContent(link.value);
      final hash = link.hash;
      if (hash != null) {
        expect(content, contains('href="#$hash"'));
      }
    });
  }

@DanTup
Copy link
Member

DanTup commented Jun 28, 2023

Not currently, but it'd be nice to have - I opened #4617

@wildsylvan
Copy link

@DanTup
the path is added to the windows path env var as a quoted string (with ") and unless i remove the quotes, it's not working.

see this.

@DanTup
Copy link
Member

DanTup commented Mar 26, 2024

@wildsylvan can you file a new issue for this, and include steps/screenshots showing how you're checking this?

We do add quotes here:

But the comment suggests that it didn't work without them so it might need some more testing. Please also include your version of Windows and PowerShell in the new issue. Thanks!

@wildsylvan
Copy link

@DanTup done 👍🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in commands Relates to commands (usually invoked from the command Palette) is enhancement on windows
Projects
None yet
Development

No branches or pull requests

3 participants