3

I have an app that has about 10 packages that I developed myself. I only run pub build on one of them and it is dependent on the other packages. When I run pub build I receive output like:

[Dart2JS on myapp_client|web/index.html_bootstrap.dart]:
3 warning(s) suppressed in package:myapp_shared.
[Warning from Dart2JS on myapp_client|web/index.html_bootstrap.dart]:
4 hint(s) suppressed in package:myapp_infra.
[Dart2JS on myapp_client|web/index.html_bootstrap.dart]:
8 warning(s) suppressed in package:myapp_client.

Since these warnings all come from my code I am interested in seeing the full warnings, I do not want them to be suppressed. How can I do this? I've seen that dart2js has a --show-package-warnings option but pub build does not have this. Also this option is not configurable in pubspec.yaml on the dart2js transformer.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Jonas Kello
  • 1,178
  • 2
  • 13
  • 25
  • Why do you think this is not possible to configure for the `dart2js` transformer? Amiga forever ;-) – Günter Zöchbauer Nov 18 '14 at 09:25
  • In pubspec.yaml, transformers, $dart2js, I tried putting show-package-warnings: true. Pub build reported it was an invalid option. It is only documented as being available on the command-line so I was just trying. Yes, Amiga forever :-) – Jonas Kello Nov 18 '14 at 21:42
  • You could try `commandLineOptions` like shown in this answer http://stackoverflow.com/a/21339347/217408 (it's a while I tried it). See also https://www.dartlang.org/tools/pub/dart2js-transformer.html at the bottom of the page. – Günter Zöchbauer Nov 18 '14 at 21:45
  • 1
    One option is to manually run "dartanalyzer --package-warnings" from the command line. https://www.dartlang.org/tools/analyzer/ – Greg Lowe Nov 18 '14 at 21:46
  • commandLineOptions worked! :-) I added this to the pubspec.yaml under $dart2js "commandLineOptions: [--show-package-warnings]". Now when I do pub build I get to see all the warnings from my packages. I guess I will also see warnings from other packages if there are any so the solution might not be ideal but it works for me since no other packages I depend on has warnings. – Jonas Kello Nov 18 '14 at 23:25

2 Answers2

3

Günter and Jonas have kinda answered the question. Since it took me a few minutes to figure out the actual syntax I'd like to make it clear. Your pubspec.yaml should include the following lines:

- $dart2js:
    commandLineOptions: [--show-package-warnings]
Leukipp
  • 550
  • 2
  • 9
  • 25
1

It seems no such option is available.
With http://dartbug.com/9512 generating warnings for dependencies were suppressed but no exception for path dependencies (see codereview link in the linked issue).

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • 2
    I have submitted a new bug to see warnings originating from file-referenced packages. https://code.google.com/p/dart/issues/detail?id=21651 – Jonas Kello Nov 18 '14 at 21:35