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

flutter dart foo.dart to run dart foo.dart with FLUTTER_ROOT set #13607

Closed
kevmoo opened this issue Dec 15, 2017 · 9 comments
Closed

flutter dart foo.dart to run dart foo.dart with FLUTTER_ROOT set #13607

kevmoo opened this issue Dec 15, 2017 · 9 comments
Labels
c: new feature Nothing broken; request for a new capability tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@kevmoo
Copy link
Contributor

kevmoo commented Dec 15, 2017

Required to run things like source_gen generators.

#13360 deals with pub run. This is just getting access to the dart command to run things not in the bin directory.

Here's the draft text I've included in json_serializable – which is pretty gnarly.


NOTE: If you're using Flutter, running a Dart script is a bit tricky. You can
find the Dart entry point at $FLUTTER_ROOT/bin/cache/dart-sdk/bin/dart.
You can determine FLUTTER_ROOT by looking at the first few lines of
flutter doctor.

> flutter doctor
[✓] Flutter (on Mac OS X 10.12.6 16G1114, locale en-US, channel master)
    • Flutter at YOUR_FLUTTER_ROOT_HERE
    • Framework revision 235b64ed2f (13 hours ago), 2017-12-14 20:38:39 -0800
...
@kevmoo
Copy link
Contributor Author

kevmoo commented Dec 15, 2017

CC @sethladd @mit-mit

@sethladd
Copy link
Contributor

Strawman: flutter cmd <path_to_cli_script> which simply runs the script via the same Dart version that is used in the engine (so the API in docs.flutter.io applies to scripts run via the Flutter cmd line. I don't want "two darts" for Flutter developers, there is one Dart for Flutter developers: the Dart that is documented on docs.flutter.io)

In the meantime, could source_gen ship a generic runner accessible from pub run ?

@kevmoo
Copy link
Contributor Author

kevmoo commented Dec 15, 2017

Strawman: flutter cmd <path_to_cli_script>

SGTM...

In the meantime, could source_gen ship a generic runner accessible from pub run ?

Sadly, no. We're working on a solution w/ pkg/build where there will be a common entry point. Hoping to have that nailed down in Q1.

@mit-mit mit-mit added the tool Affects the "flutter" command-line tool. See also t: labels. label Dec 18, 2017
@mit-mit
Copy link
Member

mit-mit commented Dec 18, 2017

Would a more idea solution be some way to register (maybe in pubspec.yaml, that flutter should execute some dart "script" during build? Then you wouldn't need to remember to manually run the generators?

@kevmoo
Copy link
Contributor Author

kevmoo commented Dec 18, 2017 via email

@Hixie Hixie changed the title Make it easier to run the dart executable flutter dart foo.dart to run dart foo.dart with FLUTTER_ROOT set Jun 12, 2018
@Hixie Hixie added the c: new feature Nothing broken; request for a new capability label Jun 12, 2018
@Hixie Hixie added this to the Stretch Goals milestone Jun 12, 2018
@zoechi
Copy link
Contributor

zoechi commented Jan 22, 2019

flutter packages pub run tool/build.dart does this currently.

@jonahwilliams
Copy link
Member

Closing as pub can run dart scripts, and because we'll likely use a different solution for build_runner integration.

@mit-mit
Copy link
Member

mit-mit commented Apr 22, 2019

Also, note that I recently added passthrough for all pub commands, so the current shortest way of doing this is:

flutter pub run tool/build.dart

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

6 participants