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

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

Closed
littlesome opened this issue Aug 5, 2019 · 4 comments · Fixed by #1909
Closed

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

littlesome opened this issue Aug 5, 2019 · 4 comments · Fixed by #1909
Labels
in flutter Relates to running Flutter apps is enhancement
Milestone

Comments

@littlesome
Copy link

littlesome commented Aug 5, 2019

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

@littlesome
Copy link
Author

littlesome commented Aug 5, 2019

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?

@DanTup
Copy link
Member

DanTup commented Aug 5, 2019

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?

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Aug 5, 2019
@littlesome
Copy link
Author

littlesome commented Aug 5, 2019

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

@DanTup
Copy link
Member

DanTup commented Aug 5, 2019

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

@DanTup DanTup added in flutter Relates to running Flutter apps is enhancement and removed awaiting info Requires more information from the customer to progress labels Aug 5, 2019
@DanTup DanTup added this to the v3.4.0 milestone Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in flutter Relates to running Flutter apps is enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants