Deprecating the end-point for fetching package archives. (#2374)

In practice we don't need it as the list-versions API end-point already
returns an `archive_url`. If we switch clients to use this `archive_url`
we can easily change the URL that packages are downloaded from. Most
cases where a package has to be downloaded the client has to resolve
versions first, hence, we already have to call the list versions API. In
the rare cases where know what version we want, but we haven't done a
resolution this will cost us an extra round-trip, however, this seems
acceptable.

We are deprecating the end-point because we discovered that it was
conflicting with other end-points on `pub.dev`. Specifically,
`pub.dev/packages/<verion>` conflicts with
`pub.dev/packages/<version>.tar.gz` because a semver version number can
have a pre-release ending in `.tar.gz´. Example: `1.0.0-dev.tar.gz` is a
legitimate semver version number.

Note. servers will still have to support the deprecated API end-point
indefinitely, otherwise old clients will stop working. But since the
conflict only affects packages with obscure version numbers this seems
acceptable. It just means that some old clients might have problems
downloading package with version numbers that ends in `.tar.gz`.
1 file changed
tree: ce958bfa1bd74621f4c81ec7e9d086e4cd111dbe
  1. .github/
  2. .gitignore
  3. .status
  4. .test_config
  5. .travis.yml
  6. AUTHORS
  7. CONTRIBUTING.md
  8. LICENSE
  9. README.md
  10. analysis_options.yaml
  11. bin/
  12. dart_test.yaml
  13. doc/
  14. lib/
  15. pubspec.yaml
  16. test/
  17. tool/
README.md

Build Status

Pub is the package manager for Dart.

Contributing to pub

Thanks for being interested in contributing to pub! Contributing to a new project can be hard: there's a lot of new code and practices to learn. This document is intended to get you up and running as quickly as possible. For more information, see the pub tool documentation.

The first step towards contributing is to contact the pub dev team and let us know what you‘re working on, so we can be sure not to start working on the same thing at the same time. Just send an email to misc@dartlang.org letting us know that you’re interested in contributing and what you plan on working on. This will also let us give you specific advice about where to start.

Organization

Pub isn‘t a package, but it’s organized like one. It has four top-level directories:

  • lib/ contains the implementation of pub. Currently, it's all in lib/src/, since there are no libraries intended for public consumption.

  • test/ contains the tests for pub.

  • bin/ contains pub.dart, the entrypoint script that's run whenever a user types “pub” on the command line or runs it in the Dart editor. This is usually run through shell scripts in sdk/bin at the root of the Dart repository.

It's probably easiest to start diving into the codebase by looking at a particular pub command. Each command is encapsulated in files in lib/src/command/.

Running pub

To run pub from the Git repository, run:

dart bin/pub.dart

Testing pub

Before any change is made to pub, all tests should pass. To run a pub test, run:

dart test/path/to/pub_test.dart

To run all tests at once, run:

pub run test

Changes to pub should be accompanied by one or more tests that exercise the new functionality. When adding a test, the best strategy is to find a similar test in test/ and follow the same patterns.

Pub tests come in two basic forms. The first, which is usually used to unit test classes and libraries internal to pub, has many tests in a single file. This is used when each test will take a short time to run. For example, test/version_test.dart contains unit tests for pub's Version class.

The other form, used by most pub tests, is usually used for integration tests of user-visible pub commands. Each test has a file to itself, which is named after the test description. This is used when tests can take a long time to run to avoid having the tests time out when running on the build bots. For example, tests/get/hosted/get_transitive_test.dart tests the resolution of transitive hosted dependencies when using pub get.

Landing your patch

All patches to official Dart packages, including to pub, need to undergo code review before they're submitted. The full process for putting up your patch for review is documented elsewhere.