Skip to content

Set FLUTTER_ROOT automatically to simplify running flutter_tools tests #4427

Closed

Description

@DanTup

Currently you may have to set the FLUTTER_ROOT variable manually in launch.config/dart.env when running flutter_tools tests.

Since we know where the SDK is, perhaps we could just always set this when starting the Flutter debug adapters, as long as there isn't already one defined?

@christopherfujino can you see any cases where this wouldn't do the right thing?

Activity

  1. added
    in flutterRelates to running Flutter apps
    in debuggingRelates to the debug adapter or process of running debug sessions
    in testingRelates to test execution of Dart/Flutter tests for end users
    on Mar 7, 2023
  2. added this to the v3.62.0 milestone on Mar 7, 2023
  3. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Mar 7, 2023
  4. changed the title [-]Set FLUTTER_TOOL automatically to simplify running flutter_tools tests[/-] [+]Set FLUTTER_ROOT automatically to simplify running flutter_tools tests[/+] on Mar 7, 2023
  5. christopherfujino commented on Mar 7, 2023

    @christopherfujino

    @christopherfujino can you see any cases where this wouldn't do the right thing?

    Can't think of anything wrong with this. To clarify, my understanding is that Dart-Code tracks an absolute path to the Flutter SDK checkout, and it invokes the flutter tool by absolute path? In this case, I think it would be safe (and ideal) to always provide FLUTTER_ROOT=ABSOLUTE_FLUTTER_SDK_PATH when invoking the tool.

  6. christopherfujino commented on Mar 7, 2023

    @christopherfujino

    Cool, you merged it already :)

  7. DanTup commented on Mar 7, 2023

    @DanTup
    MemberAuthor

    To clarify, my understanding is that Dart-Code tracks an absolute path to the Flutter SDK checkout

    Not specifically to the checkout (edit: I guess it's always a checkout with Flutter, it's not like Dart where I have a release SDK + source code separately), but to the SDK it found (via PATH, settings, whatever).

    I didn't want to set it too aggressively in case it might impact things unexpectedly (for example what if you have a Flutter SDK that isn't the one you're hacking on), so I decided to set it only in the case where you have an open folder that is also inside the SDK that we detected (so if you open the repo root, or flutter_tools, etc., and there is no other FLUTTER_ROOT set).

    I've pushed a new pre-release build of the Dart extension so if you're using that, you can remove any dart.env or launch.json value you have for this and see if it's all good. If so, we could simplify https://github.com/flutter/flutter/wiki/The-flutter-tool#debugging-the-flutter-command-line-tool-in-vs-code.

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 debuggingRelates to the debug adapter or process of running debug sessionsin flutterRelates to running Flutter appsin testingRelates to test execution of Dart/Flutter tests for end usersis 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