Skip to content

Conversation

@sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Jun 20, 2022

Part of dart-lang/pub#2971 .

dart pub get has detailed output about outdated dependencies. This is currently not exposed from flutter pub get.

We are missing out on at least this information:

  • newer version available
  • package obsolete
  • version retracted
  • known vulnerability (planned)

Before:

> flutter pub get
Running "flutter pub get" in sensors_plus...                     1,691ms
Warning: You are using these overridden dependencies:
! sensors_plus_platform_interface 1.1.1 from path ../../sensors_plus_platform_interface
! sensors_plus_web 1.1.1 from path ../../sensors_plus_web
Running "flutter pub get" in example...                          1,019ms

Note how the warnings output really belongs to the resolution from the example.

After:

> flutter pub get
Running "flutter pub get" in sensors_plus...                     1,803ms
Resolving dependencies...
  matcher 0.12.11 (0.12.12 available)
  test 1.21.1 (1.21.2 available)
  test_api 0.4.9 (0.4.10 available)
  test_core 0.4.13 (0.4.14 available)
  vm_service 8.3.0 (9.0.0 available)
Got dependencies!
Resolving dependencies in ./example...
Got dependencies in ./example.

This PR also uses pub get --example (implemented here) to resolve in './example' if it exists.

Now the output from resolution in ./example is reduced as long as there are no errors.

Because flutter pub get will retry pub get until successful the output of each run is recorded, and only the output of the last run is shown.

Fix: a small bug where flutter create for some templates would invoke pub even if given a --no-pub argument.

Cleanup: pub get will no longer be invoked with --no-precompile (that is now default).

Output from pub get is also show when doing flutter create - that might be distracting - maybe we should turn that off:

> flutter create test_plugin -tplugin
Creating project test_plugin...
Running "flutter pub get" in test_plugin...                      1,931ms
Resolving dependencies in test_plugin...
+ async 2.9.0
+ boolean_selector 2.1.0
+ characters 1.2.1
+ clock 1.1.1
+ collection 1.16.0
+ fake_async 1.3.1
+ flutter 0.0.0 from sdk flutter
+ flutter_lints 2.0.1
+ flutter_test 0.0.0 from sdk flutter
+ lints 2.0.0
+ matcher 0.12.11 (0.12.12 available)
+ material_color_utilities 0.1.5
+ meta 1.8.0
+ path 1.8.2
+ plugin_platform_interface 2.1.2
+ sky_engine 0.0.99 from sdk flutter
+ source_span 1.9.0
+ stack_trace 1.10.0
+ stream_channel 2.1.0
+ string_scanner 1.1.1
+ term_glyph 1.2.1
+ test_api 0.4.9 (0.4.10 available)
+ vector_math 2.1.2
Changed 23 dependencies in test_plugin!
Resolving dependencies in test_plugin/example...
Got dependencies in test_plugin/example.
Wrote 25 files.

All done!

Your plugin code is in test_plugin/lib/test_plugin.dart.

Your example app code is in test_plugin/example/lib/main.dart.


You've created a plugin project that doesn't yet support any platforms.


To add platforms, run `flutter create -t plugin --platforms <platforms> .` under test_plugin.
For more information, see https://flutter.dev/go/plugin-platforms.

Also includes color in the pub terminal output (depending on the flutter terminal color detection):

image

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems tool Affects the "flutter" command-line tool. See also t: labels. labels Jun 20, 2022
@sigurdm sigurdm marked this pull request as draft June 20, 2022 14:30
@christopherfujino
Copy link
Contributor

@sigurdm is this ready for review? (it's marked a draft, but maybe that was by accident?)

@sigurdm sigurdm closed this Jun 30, 2022
@sigurdm sigurdm reopened this Jun 30, 2022
@sigurdm sigurdm marked this pull request as ready for review June 30, 2022 14:03
@sigurdm
Copy link
Contributor Author

sigurdm commented Jun 30, 2022

@sigurdm is this ready for review? (it's marked a draft, but maybe that was by accident?)

Yeah - I marked it as draft until I added the color-handling - but I think it should be good now.

final bool includeWindows;
if (template == FlutterProjectType.module) {
// The module template only supports iOS and Android.
includeIos = true;
Copy link
Contributor

@christopherfujino christopherfujino Jul 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we still check if platforms.contains('ios') (and ditto for android)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break;
}

if (boolArgDeprecated('pub')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These commands are hard to read--can you explain why you're adding this here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, did this used to be called earlier in the _generateModule() and such helper functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is moved from the helper-functions.

}
}

Future<void> _runWithRetries(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between this and batch()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runWithRetries will retry the command as long as the exit code is _kPubExitCodeUnavailable the and print the output of the last run.

batch will show only the last line of the output. Run only a single run.

I wanted to get rid of batch but it has a few call-sites that I didn't want to touch in this PR:

But looking at these it seems I can simplify batch even more None of those call sites do version solving (they to run test and deps)

I simplified batch and added documentation to _runWithRetries.

@sigurdm
Copy link
Contributor Author

sigurdm commented Jul 8, 2022

I'm going on 3 weeks vacation today. So don't expect responses before that.

@christopherfujino
Copy link
Contributor

cc @Jasguerrero

@sigurdm sigurdm closed this Aug 25, 2022
@sigurdm sigurdm reopened this Aug 25, 2022
@sigurdm
Copy link
Contributor Author

sigurdm commented Aug 25, 2022

I've rebased this, could you take another look?

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM, although you have some failing tests.

@sigurdm
Copy link
Contributor Author

sigurdm commented Aug 26, 2022

Fixed the test, had to hack the analyze_snippets_code.dart tool a bit.

There was also a bug if the example folder existed but had no pubspec.yaml - fixed that.

@christopherfujino
Copy link
Contributor

Fixed the test, had to hack the analyze_snippets_code.dart tool a bit.

There was also a bug if the example folder existed but had no pubspec.yaml - fixed that.

thanks! when you're ready to merge, you can add the autosubmit label and the bot will merge when the tree is green.

@sigurdm sigurdm added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2022
@auto-submit auto-submit bot merged commit 3802eb6 into flutter:master Aug 29, 2022
zanderso added a commit that referenced this pull request Aug 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 29, 2022
zanderso added a commit that referenced this pull request Aug 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 1, 2022
sigurdm added a commit to sigurdm/flutter that referenced this pull request Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants