这是indexloc提供的服务,不要输入任何密码
Skip to content

Adding @docImports to the animation library #150798

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

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

goderbauer
Copy link
Member

@goderbauer goderbauer commented Jun 25, 2024

Part of #150800.

I turned on the comment_references lint and looked at what needed fixing inside of the animation library.

There are a couple of places where for some reason adding a docImport didn't fix the comment_references warning:

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. a: animation Animation APIs labels Jun 25, 2024
@goderbauer
Copy link
Member Author

cc @srawlins

@goderbauer goderbauer changed the title Adding docImports to animation library Adding @docImports to the animation library Jun 25, 2024
Copy link
Contributor

@srawlins srawlins left a comment

Choose a reason for hiding this comment

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

❤️ I want to look into the problem children but it could take me a while to get there.

@goderbauer
Copy link
Member Author

Uh, lots of google testing targets are failing, claiming that they are unable to resolve the URIs in the doc imports:

Target of URI doesn't exist. #uri_does_not_exist

/// @docImport 'package:flutter_test/flutter_test.dart';
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@srawlins
Copy link
Contributor

You should be able to // ignore: uri_does_not_exist above those.

Since package:flutter does not have any dependency on package:flutter_test, there is no way for the analyzer to resolve those @docImports. As for dartdoc... I need to think about whether those will cause problems...

@goderbauer
Copy link
Member Author

It does specify a dev dependency on flutter_test:

dev_dependencies:
flutter_test:
sdk: flutter

@matanlurey
Copy link
Contributor

text-exempt: Awesome.

@srawlins
Copy link
Contributor

Ah, interesting! Is there a flutter_test entry then, in packages/flutter/.dart_tool/package_config.json? Can you paste it here, please.

@goderbauer
Copy link
Member Author

It's in there (see below, from my local machine). One thought though: The issue is reported in google3, I don't know how things are set up there and whether the package_config.json equivalent there would include it?

{
  "configVersion": 2,
  "packages": [
    {
      "name": "async",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/async-2.11.0",
      "packageUri": "lib/",
      "languageVersion": "2.18"
    },
    {
      "name": "boolean_selector",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1",
      "packageUri": "lib/",
      "languageVersion": "2.17"
    },
    {
      "name": "characters",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/characters-1.3.0",
      "packageUri": "lib/",
      "languageVersion": "2.12"
    },
    {
      "name": "clock",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/clock-1.1.1",
      "packageUri": "lib/",
      "languageVersion": "2.12"
    },
    {
      "name": "collection",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/collection-1.18.0",
      "packageUri": "lib/",
      "languageVersion": "2.18"
    },
    {
      "name": "crypto",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/crypto-3.0.3",
      "packageUri": "lib/",
      "languageVersion": "2.19"
    },
    {
      "name": "fake_async",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/fake_async-1.3.1",
      "packageUri": "lib/",
      "languageVersion": "2.12"
    },
    {
      "name": "file",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/file-7.0.0",
      "packageUri": "lib/",
      "languageVersion": "3.0"
    },
    {
      "name": "flutter_goldens",
      "rootUri": "file:///Users/goderbauer/dev/flutter/packages/flutter_goldens",
      "packageUri": "lib/",
      "languageVersion": "3.2"
    },
    {
      "name": "flutter_test",
      "rootUri": "file:///Users/goderbauer/dev/flutter/packages/flutter_test",
      "packageUri": "lib/",
      "languageVersion": "3.3"
    },
    {
      "name": "leak_tracker",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/leak_tracker-10.0.5",
      "packageUri": "lib/",
      "languageVersion": "3.2"
    },
    {
      "name": "leak_tracker_flutter_testing",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/leak_tracker_flutter_testing-3.0.5",
      "packageUri": "lib/",
      "languageVersion": "3.2"
    },
    {
      "name": "leak_tracker_testing",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/leak_tracker_testing-3.0.1",
      "packageUri": "lib/",
      "languageVersion": "3.2"
    },
    {
      "name": "matcher",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/matcher-0.12.16+1",
      "packageUri": "lib/",
      "languageVersion": "3.0"
    },
    {
      "name": "material_color_utilities",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1",
      "packageUri": "lib/",
      "languageVersion": "2.17"
    },
    {
      "name": "meta",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/meta-1.15.0",
      "packageUri": "lib/",
      "languageVersion": "2.12"
    },
    {
      "name": "path",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/path-1.9.0",
      "packageUri": "lib/",
      "languageVersion": "3.0"
    },
    {
      "name": "platform",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/platform-3.1.5",
      "packageUri": "lib/",
      "languageVersion": "3.2"
    },
    {
      "name": "process",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/process-5.0.2",
      "packageUri": "lib/",
      "languageVersion": "3.0"
    },
    {
      "name": "sky_engine",
      "rootUri": "file:///Users/goderbauer/dev/flutter/bin/cache/pkg/sky_engine",
      "packageUri": "lib/",
      "languageVersion": "3.2"
    },
    {
      "name": "source_span",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/source_span-1.10.0",
      "packageUri": "lib/",
      "languageVersion": "2.18"
    },
    {
      "name": "stack_trace",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/stack_trace-1.11.1",
      "packageUri": "lib/",
      "languageVersion": "2.18"
    },
    {
      "name": "stream_channel",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/stream_channel-2.1.2",
      "packageUri": "lib/",
      "languageVersion": "2.19"
    },
    {
      "name": "string_scanner",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/string_scanner-1.2.0",
      "packageUri": "lib/",
      "languageVersion": "2.18"
    },
    {
      "name": "term_glyph",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/term_glyph-1.2.1",
      "packageUri": "lib/",
      "languageVersion": "2.12"
    },
    {
      "name": "test_api",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/test_api-0.7.2",
      "packageUri": "lib/",
      "languageVersion": "3.2"
    },
    {
      "name": "typed_data",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/typed_data-1.3.2",
      "packageUri": "lib/",
      "languageVersion": "2.17"
    },
    {
      "name": "vector_math",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/vector_math-2.1.4",
      "packageUri": "lib/",
      "languageVersion": "2.14"
    },
    {
      "name": "vm_service",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/vm_service-14.2.4",
      "packageUri": "lib/",
      "languageVersion": "3.3"
    },
    {
      "name": "web",
      "rootUri": "file:///Users/goderbauer/.pub-cache/hosted/pub.dev/web-0.5.1",
      "packageUri": "lib/",
      "languageVersion": "3.3"
    },
    {
      "name": "flutter",
      "rootUri": "../",
      "packageUri": "lib/",
      "languageVersion": "3.3"
    }
  ],
  "generated": "2024-06-25T21:23:51.682231Z",
  "generator": "pub",
  "generatorVersion": "3.5.0-297.0.dev",
  "flutterRoot": "file:///Users/goderbauer/dev/flutter",
  "flutterVersion": "3.23.0-13.0.pre.328",
  "pubCache": "file:///Users/goderbauer/.pub-cache"
}

@srawlins
Copy link
Contributor

I'm going to work on enabling unnecessary_import, unused_import, duplicate_import, unused_shown_name, duplicate_shown_name, duplicate_hidden_name, unknown_hidden_name, and ensuring ambiguous_import is reported for @docImports. That should remove some pain when trying a CL like this.

@srawlins
Copy link
Contributor

srawlins commented Jun 26, 2024

Ah ok, if it is only google3, then I am much less surprised, and the issue is clear. flutter_test is not a "Bazel dependency" of flutter over there, so there is no such thing as package:flutter_test, when analyzing the sources of package:flutter. I'm not sure I can think of any better path forward (even long-term) other than ignoring uri_does_not_exist for those lines. This would be the same solution for dart:ui libraries attempting to @docImport 'package:flutter/....

@matanlurey
Copy link
Contributor

I coincidentally saw this and talked to @srawlins this morning.

I'd like to propose a (simpler) alternative that doesn't leave @goderbauer (or others) having to ignore things externally that have no value internally - let's just turn this whole class of warning code off in google3. G3 doesn't support dartdoc, and there is no timetable where it would.

I'd suggest:

  • @srawlins renames the warning code (i.e. unused_doc_import instead of reusing unused_import)
  • @srawlins hardcodes google3 to always ignore these class of diagnostics
  • @goderbauer can move forward with these PRs without a weird workflow

@goderbauer
Copy link
Member Author

What Matan suggests above would be also my preferred way forward. Solving the internal problems with ignores in the open-source code feels ... iky. In open source land we do want to see warnings if we accidentally docimport something that doesn't exist.

This would be the same solution for dart:ui libraries attempting to @docImport 'package:flutter/....

Sounds like that wouldn't solve this case, though? This worries for the same reasons: We do want to know if we accidentally import something that doesn't exist and not ignore that...

@matanlurey
Copy link
Contributor

Sam was supportive when I spoke to him - Sam if I can help in anyway (code reviews, google3 hacking) LMK

@srawlins
Copy link
Contributor

Is there any problem in this PR with unused_import? That is a "warning" for real imports and for doc imports, so I was not planning on splitting that.

However, uri_does_not_exist is a COMPILE_TIME_ERROR, so I do intend to split that, and report something similar for doc imports that is a "warning" (and has a different name so that we can universally ignore it in google3).

@goderbauer
Copy link
Member Author

Is there any problem in this PR with unused_import?

So far, I have not encountered any problems with that lint in this PR.

@goderbauer
Copy link
Member Author

I removed the problematic flutter_test docimport for now to see if there are any other issues. If there aren't I am planning on submitting this without that import for now.

@goderbauer goderbauer mentioned this pull request Jun 26, 2024
11 tasks
@goderbauer goderbauer added autosubmit Merge PR when tree becomes green via auto submit App labels Jun 26, 2024
@auto-submit auto-submit bot merged commit 776efc2 into flutter:master Jun 26, 2024
73 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 27, 2024
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jun 27, 2024
Work towards supporting #50702
in google3. Related to the work attempted in
flutter/flutter#150798.

Change-Id: I36fb1c47c94d5b965529db910fbd0e347bfba645
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373442
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
@goderbauer goderbauer deleted the docImports branch June 28, 2024 16:55
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 28, 2024
Manual roll Flutter from e726eb4 to 15f95ce (48 revisions)

Manual roll requested by dit@google.com

flutter/flutter@e726eb4...15f95ce

2024-06-28 engine-flutter-autoroll@skia.org Roll Flutter Engine from ddd4814b9d40 to 94591ffb20df (5 revisions) (flutter/flutter#150968)
2024-06-27 34871572+gmackall@users.noreply.github.com Manual engine roll to ddd4814 (flutter/flutter#150952)
2024-06-27 reidbaker@google.com local lint copy gradle task config (flutter/flutter#150957)
2024-06-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from b42c80460538 to d1506c12808e (3 revisions) (flutter/flutter#150951)
2024-06-27 andrewrkolos@gmail.com [tool] make the `systemTempDirectory` getter on `ErrorHandlingFileSystem` wrap the underlying filesystem's temp directory in a`ErrorHandlingDirectory` (flutter/flutter#150876)
2024-06-27 jacksongardner@google.com Have flutter.js load local canvaskit instead of the CDN when appropriate (flutter/flutter#150806)
2024-06-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from a9194f0f01f4 to b42c80460538 (10 revisions) (flutter/flutter#150940)
2024-06-27 jhy03261997@gmail.com [a11y] Reland [#149375 ] Update semantics in dropdown.dart (flutter/flutter#150578)
2024-06-27 goderbauer@google.com Bump dartdoc to 8.0.9+1 (flutter/flutter#150935)
2024-06-27 yjbanov@google.com add onFocus to text fields (flutter/flutter#150648)
2024-06-27 louisehsu@google.com Fixes `flutter build ipa` failure: Command line name "app-store" is deprecated. Use "app-store-connect"  (flutter/flutter#150407)
2024-06-27 github@ricardoboss.de Copy any previous `IconThemeData` instead of overwriting it in CupertinoButton (flutter/flutter#149777)
2024-06-27 hans.muller@gmail.com Improve the behavior of scrollbar drag-scrolls triggered by the trackpad (flutter/flutter#150275)
2024-06-27 15272073+Fernthedev@users.noreply.github.com  feat: Add autofocus for `MenuItemButton` (flutter/flutter#139396)
2024-06-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1d5e3cc55a75 to a9194f0f01f4 (7 revisions) (flutter/flutter#150888)
2024-06-26 34871572+gmackall@users.noreply.github.com Reland "Remove dual_screen from new_gallery integration test" (flutter/flutter#150873)
2024-06-26 parlough@gmail.com Switch to more reliable flutter.dev link destinations in the tool (flutter/flutter#150587)
2024-06-26 goderbauer@google.com Adding `@docImport`s to the `animation` library (flutter/flutter#150798)
2024-06-26 magder@google.com Remove CODEOWNERS trailing whitespace (flutter/flutter#150882)
2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from e03cf86c4170 to 1d5e3cc55a75 (3 revisions) (flutter/flutter#150875)
2024-06-26 matanlurey@users.noreply.github.com Remind folks we are moving. (flutter/flutter#150872)
2024-06-26 jacksongardner@google.com Remove `bringup: true` from web test shard. (flutter/flutter#150785)
2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from c0017bed42c2 to e03cf86c4170 (1 revision) (flutter/flutter#150867)
2024-06-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove `dual_screen` from `new_gallery` integration test (#150808)" (flutter/flutter#150871)
2024-06-26 34871572+gmackall@users.noreply.github.com Remove `dual_screen` from `new_gallery` integration test (flutter/flutter#150808)
2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from d4624a36712b to c0017bed42c2 (4 revisions) (flutter/flutter#150865)
2024-06-26 swrenn@gmail.com Fixes for Style Guide for Flutter Repo (flutter/flutter#150167)
2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from da62c629ed5c to d4624a36712b (3 revisions) (flutter/flutter#150852)
2024-06-26 sigurdm@google.com Use `Isolate.packageConfigSync! to locate the packageconfig of flutter tools (flutter/flutter#150340)
2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from 25af762ffbb3 to da62c629ed5c (2 revisions) (flutter/flutter#150829)
2024-06-26 polinach@google.com Fix leaky tests. (flutter/flutter#150817)
2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from 94023d711db3 to 25af762ffbb3 (4 revisions) (flutter/flutter#150818)
2024-06-26 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#150810)
2024-06-25 dkwingsmt@users.noreply.github.com Remove reference to `MaterialApp` and `showCupertinoModalPopup` from `CupertinoAlertDialog` (flutter/flutter#150725)
2024-06-25 matanlurey@users.noreply.github.com Read `AndroidManifest.xml` and emit `manifest-impeller-(enabled|disabled)` analytics (flutter/flutter#150791)
2024-06-25 jason-simmons@users.noreply.github.com [flutter_tools] Shut down Chromium cleanly using a command sent through the debug protocol (flutter/flutter#150645)
2024-06-25 bruno.leroux@gmail.com Reland fix inputDecorator hint color on M3 (flutter/flutter#150278)
2024-06-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 62e0b5f9c340 to 94023d711db3 (7 revisions) (flutter/flutter#150797)
2024-06-25 bruno.leroux@gmail.com Fix collapsed InputDecorator minimum height (flutter/flutter#150770)
2024-06-25 737941+loic-sharma@users.noreply.github.com Add more warm up frame docs (flutter/flutter#150464)
2024-06-25 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#150739)
2024-06-25 victorsanniay@gmail.com Add `focusNode`, `focusColor`, `onFocusChange`, `autofocus` to `CupertinoButton` (flutter/flutter#150721)
2024-06-25 greg@zulip.com Document RenderObject._relayoutBoundary and its invariant; small refactors (flutter/flutter#150527)
2024-06-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6313b1e5afd7 to 62e0b5f9c340 (1 revision) (flutter/flutter#150790)
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: animation Animation APIs autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants