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

[breaking change] discontinue .packages file #48272

Closed
13 tasks done
mit-mit opened this issue Feb 1, 2022 · 17 comments
Closed
13 tasks done

[breaking change] discontinue .packages file #48272

mit-mit opened this issue Feb 1, 2022 · 17 comments
Assignees
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...). area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). breaking-change-request This tracks requests for feedback on breaking changes

Comments

@mit-mit
Copy link
Member

mit-mit commented Feb 1, 2022

Intended change in behaviour

When the commands dart pub get or flutter pub get are executed, pub resolves all dependencies, and downloads those dependencies to the local pub cache. It furthermore creates a mapping from each used package to their location on the local file system. Today this mapping is stored in two files:

  • .dart_tool/package_config.json
  • .packages (legacy, as of Dart 2.8.0)

The former of these is the file that the current SDKs rely on. The latter has until now been generated for backwards compatibility with older Dart SDKs. After the present breaking change is made, we'll change pub get to only generate the former (.dart_tool/package_config.json), and the Dart SDK will no longer be able to read the .packages file.

Rationale for making the change

The .packages file is left-over from older Dart SDKs and is not fully compatible with Dart 2.x SDKs (it, for example, doesn’t support language versioning). We're removing the generation of .packages to prevent having extraneous files in the file system, and to prevent corner-case bugs that may occur if both files are around, but in an inconsistent state.

Expected impact of this change.

Regular apps and packages that are written using Dart 2.x will not be impacted, as they rely on .dart_tool/package_config.json.

If you already have a .packages file, you can delete it. After upgrading your Dart SDK it will no longer be generated, and pub will delete it when pub get runs.

Developer tools that need to look up the packages used by a project, and their locations on the file system, will no longer be able to rely on the .packages file. Such tools should be upgraded to rely on the content of the package_config.json file. Rather than reading this file directly, we strongly recommend using the API for consuming it available in package:package_config.

If you are passing a .packages file to the dart command (dart --packages=.packages) you'll need to pass the package config instead (dart --packages=.dart_tool/package_config.json).

Steps for mitigating the change

If you for some reason depend on this legacy file, you will for one stable release be able to generate it by passing the flag --legacy-packages-file to dart pub get / flutter pub get. After one stable release, this flag will be removed, and all support for generating the legacy file be removed. Note however this this is only being offered for external tools that may depend on the .packages file; all tools offered by the Dart team will no longer support this .packages file.

Timeline

The change to no longer generate .packages, and to remove support for reading that file in tools offered by the Dart team / the Dart SDK, will be made in a dev-channel release of Dart 2.18.

The --legacy-packages-file flag -- which offers a temporary solution for retaining the generation of .packages for other legacy tools -- will be removed one release later in a dev-channel release of Dart 2.19.

Related issues

In the Dart 2.18 stable release:

In the following Dart 2.19 stable release:

@mit-mit mit-mit added the breaking-change-request This tracks requests for feedback on breaking changes label Feb 1, 2022
@devoncarew

This comment was marked as outdated.

@mit-mit

This comment was marked as outdated.

@devoncarew

This comment was marked as outdated.

@kevmoo kevmoo added area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...). area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). labels Feb 3, 2022
@mit-mit
Copy link
Member Author

mit-mit commented Feb 7, 2022

Breaking change was announced:
https://groups.google.com/a/dartlang.org/g/announce/c/jNR4yY3mcW4

@itsjustkevin
Copy link
Contributor

Could you take a look at this breaking change request @grouma and @Hixie?

@grouma
Copy link
Member

grouma commented Mar 1, 2022

I believe this will impact a number of packages. cc @natebosch

Off the top of my head, we rely on this file in package:dwds (cc @annagrin) and package:coverage (cc @liamappelbe).

@Hixie
Copy link
Contributor

Hixie commented Mar 2, 2022

I have no objection in principle but I would not be surprised if this broke things unexpectedly (e.g. we probably have tests that depend on .packages in some way). Hard to determine exactly what will break without trying it though.

copybara-service bot pushed a commit that referenced this issue Mar 4, 2022
…the analysis server spec_input.html

Bug: #48272
Change-Id: Ica02829fbf9309327210e67d059d4606bb58b528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235282
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
@natebosch
Copy link
Member

Off the top of my head, we rely on this file in package:dwds

I would have thought we'd migrated to .dart_tool/package_config.json, but surprisingly we haven't...

https://github.com/dart-lang/webdev/blob/9cfdbdd7c44363cf20ebb75ec3bb2ae331a7049f/dwds/lib/src/utilities/dart_uri.dart#L160

@mit-mit
Copy link
Member Author

mit-mit commented Mar 7, 2022

Off the top of my head, we rely on this file in package:dwds

Filed dart-lang/webdev#1526; @annagrin are you the right assignee for that?

Off the top of my head, we rely on this file in ... and package:coverage

Filed dart-lang/coverage#367; @liamappelbe are you the right assignee for that?

@liamappelbe
Copy link
Contributor

Yep, I can take a look

@jwren
Copy link
Member

jwren commented Mar 9, 2022

IJ YouTrack issue is now marked as Fixed, with the PR JetBrains/intellij-plugins#862, landed on the master branch.

@srawlins

This comment was marked as off-topic.

@mit-mit

This comment was marked as outdated.

@vsmenon
Copy link
Member

vsmenon commented Mar 28, 2022

@mit-mit - are we still targeting this for the upcoming beta / stable? Or kicking to the next one?

@mit-mit
Copy link
Member Author

mit-mit commented Mar 29, 2022

No, we're punting this to 2.18, and will try to make the change very early in that release cycle rather than very late in the current one.

cbracken added a commit to cbracken/flutter that referenced this issue May 14, 2022
This rolls depdendencies to latest using
flutter update-packages --force-upgrade

This change includes three code changes:

* Removes charcode from the dependencies allowlist since it no longer
  appears in the transitive closure of dependencies of the flutter,
  flutter_test, flutter_driver, flutter_localizations, and
  integration_test packages.

* Uses Resolver.create instead of the deprecated Resolver constructor.
  The default Resolver constructor has been deprecated in favour of the
  static Resolver.create() factory function, which unfortunately happens
  to be async. Propagated the async-ness up the chain.

* Eliminates the use of the deprecated packagesPath parameter to
  HitMap.parseJson. This parameter was deprecated and replaced with
  packagePath in dart-lang/coverage#370 which
  was part of the overall deprecation of the .packages file in Dart
  itself 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.

This is a pre-update prior to updating flutter_template_images in
flutter#103739

Issue: flutter#103371
Issue: flutter#103775
cbracken added a commit to flutter/flutter that referenced this issue May 14, 2022
Roll dependendencies

This rolls depdendencies to latest using
flutter update-packages --force-upgrade

This change includes three code changes:

* Removes charcode from the dependencies allowlist since it no longer
  appears in the transitive closure of dependencies of the flutter,
  flutter_test, flutter_driver, flutter_localizations, and
  integration_test packages.

* Uses Resolver.create instead of the deprecated Resolver constructor.
  The default Resolver constructor has been deprecated in favour of the
  static Resolver.create() factory function, which unfortunately happens
  to be async. Propagated the async-ness up the chain.
  This change was partially reverted and the deprecation ignored in this
  patch until package:coverage can be rolled internally at Google.

* Eliminates the use of the deprecated packagesPath parameter to
  HitMap.parseJson. This parameter was deprecated and replaced with
  packagePath in dart-lang/coverage#370 which
  was part of the overall deprecation of the .packages file in Dart
  itself 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.
  This change was partially reverted and the deprecation ignored in this
  patch until package:coverage can be rolled internally at Google.

This is a pre-update prior to updating flutter_template_images in
#103739

Issue: #103371
Issue: #103775
Issue: #103830

When re-applying the partially-reverted changes to code coverage,
we'll need to patch host_entrypoint.dart internally to await the Future
that we'll be returning rather than a non-async value.
github-actions bot pushed a commit to gnoliyil/fuchsia that referenced this issue May 20, 2022
dart-lang/sdk#48272 introduced a breaking change which removed the creation of the .packages file which is breaking in an upcoming flutter roll. The tool has been creating the .dart_tool/packages_config.json file so we can soft transition before we roll.

Change-Id: I306653e9392d4f83164a4c608a82cb09cedb8b2a
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/681819
Reviewed-by: Theodore Siu <theosiu@google.com>
Commit-Queue: Chase Latta <chaselatta@google.com>
othorin added a commit to othorin/graphql-flutter that referenced this issue May 21, 2022
cbracken added a commit to flutter/flutter that referenced this issue May 31, 2022
In #103771, we rolled
dependencies in Flutter, which triggered an update of package:coverage
to v1.3.1. The new version includes
dart-lang/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 dart-lang/coverage#370 which
  was part of the overall deprecation of the .packages file in Dart
  itself 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.

This migrates off the deprecated `packagesPath` parameter to the
replacement `packagePath` paramter.

Issue: #103830
github-actions bot pushed a commit to gnoliyil/fuchsia that referenced this issue Jun 15, 2022
.dart_tool/package_config.json as opposed to .packages.

.packages is being deprecated and will no longer be generated by the
`dart pub get` command.

https: //github.com/dart-lang/sdk/issues/48272
Change-Id: Ib50ab3680216dadafa7f7263223289061f659248
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/685904
Reviewed-by: Alexander Biggs <akbiggs@google.com>
Commit-Queue: Naud Ghebre <naudzghebre@google.com>
@mit-mit
Copy link
Member Author

mit-mit commented Jul 18, 2022

Closing as completed.

The only remaining future work is to remove the temporary flag in pub; dart-lang/pub#3496 tracks this.

@mit-mit mit-mit closed this as completed Jul 18, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this issue Aug 10, 2022
In flutter#103771, we rolled
dependencies in Flutter, which triggered an update of package:coverage
to v1.3.1. The new version includes
dart-lang/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 dart-lang/coverage#370 which
  was part of the overall deprecation of the .packages file in Dart
  itself 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.

This migrates off the deprecated `packagesPath` parameter to the
replacement `packagePath` paramter.

Issue: flutter#103830
@mit-mit mit-mit mentioned this issue Dec 13, 2022
16 tasks
albertms10 added a commit to albertms10/music_notes that referenced this issue Apr 5, 2023
albertms10 added a commit to albertms10/music_notes that referenced this issue Apr 5, 2023
* chore(vscode): include `settings.json`

* chore(pubspec): bump versions as of Dart SDK 2.19

* feat(analysis): add `dart_code_metrics` and refactor code

* ci(analysis): bump versions, run DCM and strengthen security

* ci(analysis): remove `--no-pub` option from `dart analyze`

Only available in `flutter analyze`

* ci(analysis): remove discontinued `.packages` file reference

See dart-lang/sdk#48272
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...). area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). breaking-change-request This tracks requests for feedback on breaking changes
Projects
None yet
Development

No branches or pull requests