Skip to content

[tool] Fix deprecated member use when package:coverage rolls to google3 #103830

@cbracken

Description

@cbracken

In #103771, we rolled dependencies in Flutter, which triggered an update of package:coverage to v1.3.1. The new version includes dart-archive/coverage#370 in which two deprecations landed:

  • The Resolver default constructor was deprecated and replaced with the Resolver.create static factory method, which unfortunately happens to be async.
  • The packagesPath parameter to HitMap.parseJson, which takes the path to the .packages file of the package for which coverage is to be collected, was deprecated. This parameter was replaced with packagePath in Deprecate --packages flag and add --package dart-archive/coverage#370 which was part of the overall deprecation of the .packages file in Dart itself [breaking change] discontinue .packages file dart-lang/sdk#48272. The overall goal being that end-user code shouldn't need to know about implementation details such as whether dependency information is stored in a .packages file or a package_info.json file, but rather use the package_config package to obtain the package metadata and perform other functions such as resolving its dependencies to filesystem paths. packagesPath was replaced by packagePath, which takes the path to the package directory itself. Internally, package:coverage then uses package_config to do the rest of the package/script URI resolution to filesystem paths.

These two deprecations affect a few call sites in flutter_tools in:

  • lib/src/test/coverage_collector.dart

Since we'll need to make collectCoverageData and finalizeCoverage async, this will also mean adding awaits, marking methods async, and migrating return types to Futures as necessary in:

  • packages/flutter_tools/bin/fuchsia_tester.dart
  • packages/flutter_tools/lib/src/commands/test.dart
  • finalizeCollection in host_entrypoint.dart internally (/cc @xster)

#103771 landed migrations off of the deprecated code, but could not be landed in Flutter, since these patches break google3 because package:coverage hasn't been rolled internally. As a workaround, I've partially reverted the changes and marked them as ignored until package:coverage has rolled to Google.

Once package:coverage rolls to google3, we can re-apply the above-mentioned migrations (instructions added in TODOs).

Metadata

Metadata

Assignees

Labels

c: tech-debtTechnical debt, code quality, testing, etc.dependency: dartDart team may need to help ustoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions