Skip to content

Need a way to specify --local-engine for locally built engine #1905

Closed

Description

@littlesome

I'm using a locally built engine, all flutter commands should pass --local-engine argument or we will got an error : "You must specify --local-engine if you are using a locally built engine."

Maybe globalFlutterArgs is a good place to do this? src/extension/utils/processes.ts

Activity

  1. littlesome commented on Aug 5, 2019

    @littlesome
    Author

    Found some flutter tools code convert environment variable LOCAL_ENGINE, FLUTTER_ENGINE into
    --local-engine, --local-engine-src-path in flutter_tools
    Should we do the same in setupToolEnv?

  2. DanTup commented on Aug 5, 2019

    @DanTup
    Member

    I think you should be able to do this by just specifying the args in your launch.json:

    {
    	"name": "Flutter",
    	"request": "launch",
    	"type": "dart",
    	"args": ["--local-engine", "foo"]
    }

    I don't have a locally built engine to test this, but if I supply only "--local-engine" it complains about not having the next argument.

    Another option if those env settings work, is you could set dart.env in your VS Code User Settings (this would apply to all projects instead of just the one you modified launch.json), like:

    "dart.env": {
      "LOCAL_ENGINE": "foo"
    }

    Do either of these do what you need?

  3. added
    awaiting infoRequires more information from the customer to progress
    on Aug 5, 2019
  4. littlesome commented on Aug 5, 2019

    @littlesome
    Author

    Hi, I think the args in launch.json is not passed to some spawn calls, such as:

    • FlutterDaemon
    • runFlutterInFolder in sdk.ts

    The second option only works for some flutter tools which convert env LOCAL_ENGINE to --local-engine and pass it to flutter.
    All flutter commands need --local-engine cmd line argument such as :

    flutter doctor --local-engine=host_debug_unopt
    

    And you can test with a simulated locally built engine:
    (I am on Windows, and not sure if the steps below works for you)

    • add a global env var FLUTTER_ENGINE=/some/path/
    • create an empty dir named out/host_debug_unopt in /some/path/
    • copy gen_snapshot from dart-sdk/bin/utils to /some/path/out/host_debug_unopt
    • run flutter doctor and see if you got an error You must specify --local-engine if you are using a locally built engine.
    • run flutter doctor --local-engine=host_debug_unopt
  5. DanTup commented on Aug 5, 2019

    @DanTup
    Member

    Ah, I didn't realise it would affect things like the daemon. I don't think globalFlutterArgs is the best place for this, as that would make it completely global (eg. you can't override it per-workspace). I think it would be better handled similar to pubAdditionalArgs but because we can't read config in the debug adapter (at least, we can't when we move it back out of process) we'll need to pass it in.

    I haven't tested it yet, but I think something like this may do?

    3186d21

  6. added
    in flutterRelates to running Flutter apps
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed
    awaiting infoRequires more information from the customer to progress
    on Aug 5, 2019
  7. added this to the v3.4.0 milestone on Aug 5, 2019
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