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

[native assets] Should surface stdout/stderr from build.dart #53732

Open
craiglabenz opened this issue Oct 11, 2023 · 6 comments · May be fixed by dart-lang/native#1387
Open

[native assets] Should surface stdout/stderr from build.dart #53732

craiglabenz opened this issue Oct 11, 2023 · 6 comments · May be fixed by dart-lang/native#1387
Labels
area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool. area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. dart-cli-build library-ffi P3 A lower priority bug or feature request triaged Issue has been triaged by sub team

Comments

@craiglabenz
Copy link

When using the new native assets feature (#50565 and flutter/flutter#129757), the code that invokes build.dart seems to be burying its stdout and stderr.

I think it makes sense that end developers will not want to be bothered by log statements from these build steps, but seeing output / logging statements is important when writing or debugging build.dart.

I'm not sure how to differentiate between these two scenarios, but an escape hatch for build.dart authors would be a significant DX improvement.

cc @dcharkes @mit-mit

@dcharkes
Copy link
Contributor

@mit-mit I believe I hid the logs on your request in the Dart SDK. 😄

@mit-mit
Copy link
Member

mit-mit commented Oct 12, 2023

My feedback was focused on the consumption use-case where it sounds like @craiglabenz agrees we should not show it.

Could we support seeing the output during development with a CLI flag or something like that?

@lrhn lrhn added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Oct 12, 2023
@a-siva a-siva added P3 A lower priority bug or feature request triaged Issue has been triaged by sub team labels Nov 9, 2023
@bkonyi bkonyi added area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool. dart-cli-build and removed pkg-dartdev labels Apr 4, 2024
@mosuem
Copy link
Member

mosuem commented Jul 30, 2024

Even for end users who are not debugging their own build hooks, we should definitely show some kind of progress update IMO. If a user imports a package with a build or link hook invoking expensive operations, such as compiling a large native library from scratch, running dart run may take several minutes. For the user, it is invisible what is causing this.

Some possible options off the top of my head:

1: Show no progress (current situation)

  • Pros: Clean empty output for dart run.
  • Cons: Builds may take long time, involving multiple steps, the user is left in the dark about this. I personally always wonder if something crashed in my hook.

2: Show Running build hooks...

  • Pros: Minimal impact on output.
  • Cons: It's not clear which package is causing the delay, or how long it will take.

3: Show Running build hook for ${package.name}...

  • Pros: User knows exactly who is causing the delay.
  • Cons: Might be quite a lot of lines, if many packages have build hooks.

4: Let the package show it's own message

  • Pros: Packages which have fast-running build hooks could opt to not show a message, while longer-running ones can give detailed updates, up to progress bars for downloads etc.
  • Cons: Uncontrollable amount of output in the console for the end user. Worst case: package:ads_for_company pays package authors to include it's build.dart in packages, which is just a delay and some advertising text 🙃 (I hope this is against some policy of ours).

Opinions? @dcharkes @mit-mit @mariamhas @craiglabenz

@dcharkes
Copy link
Contributor

I fear 3 and 4 might be too spammy.

Maybe we can do 2 in a similar style to Building package executable... (2.1s). E.g. we keep updating the seconds so that it shows the process isn't hanging.

If we want to make it less spammy we can show it only after 5 seconds.

And I believe we should do it in conjunction with dart-lang/native#97:

Running build hooks. For logs see .dart_tool/native_assets_builder/logs/20240730164559.txt. (10.1s)

@mit-mit
Copy link
Member

mit-mit commented Jul 30, 2024

I suggest 2) in the standard mode, and 3) when dart has been passed --verbose

@dcharkes
Copy link
Contributor

I suggest 2) in the standard mode, and 3) when dart has been passed --verbose

If we want to align with Flutter -v, then --verbose should stream all stdout and stderr from all hooks. So that would be option 4.
(But flutter -v is so extremely verbose that it feels useless. So maybe we shouldn't be aiming to that.)

@mosuem mosuem linked a pull request Aug 2, 2024 that will close this issue
1 task
@dcharkes dcharkes added this to the Native Assets v1.0 milestone Sep 3, 2024
@dcharkes dcharkes changed the title "native-assets" feature should surface stdout/stderr from build.dart [native assets] Should surface stdout/stderr from build.dart Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool. area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. dart-cli-build library-ffi P3 A lower priority bug or feature request triaged Issue has been triaged by sub team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants