dart-sdk/pkg
Paul Berry 1c86b2f5f6 Migration: tolerate relative imports into lib.
Prior to this fix, if the user's package had a relative import from
outside `lib` to inside `lib` (e.g. from `test` to `lib`), the
migration tool would regard the imported file as being reached via a
`file:` URI.  This caused it to get confused and complain that the
user had a dependency on unmigrated code (this happened because the
check for dependency on unmigrated code excluded the user's files via
their canonical URIs, and files inside `lib` use `package:` for their
canonical URIs).

To fix the problem, we modify the check for dependency on unmigrated
code so that it excludes the user's files via their path rather than
their URI.

Note that relative imports into the `lib` directory are discouraged by the style guide*, but it still seems worth fixing this bug since they do crop up in the wild.

*https://dart.dev/guides/language/effective-dart/usage#dont-allow-an-import-path-to-reach-into-or-out-of-lib

Fixes #45780.

Bug: https://github.com/dart-lang/sdk/issues/45780
Change-Id: Iff41ca0059d78bbb812dd6f421be6458e7049895
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196344
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-04-21 22:04:30 +00:00
..
_fe_analyzer_shared Replace CFE and analyzer legacy type promotion with a shared implementation. 2021-04-21 14:21:30 +00:00
_js_interop_checks Optimize js_util setProperty calls for non-function value types. 2021-04-21 19:01:11 +00:00
analysis_server Fix a couple of bugs in the metrics tool 2021-04-21 20:56:11 +00:00
analysis_server_client Add getParsedLibrary2(), deprecate getParsedLibrary() and other parse related 2021-04-19 15:52:39 +00:00
analyzer Replace CFE and analyzer legacy type promotion with a shared implementation. 2021-04-21 14:21:30 +00:00
analyzer_cli Deprecated getFile() and getSourceKind(). Added getFile2() instead. 2021-04-19 23:57:19 +00:00
analyzer_plugin Add getParsedLibrary2(), deprecate getParsedLibrary() and other parse related 2021-04-19 15:52:39 +00:00
analyzer_utilities Add getParsedLibrary2(), deprecate getParsedLibrary() and other parse related 2021-04-19 15:52:39 +00:00
async_helper Update LICENSE 2021-04-07 10:28:38 +00:00
build_integration Update LICENSE 2021-04-07 10:28:38 +00:00
compiler Optimize js_util setProperty calls for non-function value types. 2021-04-21 19:01:11 +00:00
dart2js_tools
dart2native Increase alignment when concatenating AOT runtime and ELF snapshots. 2021-04-19 22:55:39 +00:00
dart_internal pkg:dart_internal bump support Dart SDK version 2021-04-20 16:24:28 +00:00
dartdev fix sort_directives violations 2021-04-20 22:21:28 +00:00
dds [ package:dds ] Fix issue where streamListen could be sent multiple 2021-04-21 17:25:30 +00:00
dev_compiler Optimize js_util setProperty calls for non-function value types. 2021-04-21 19:01:11 +00:00
diagnostic Update LICENSE 2021-04-07 10:28:38 +00:00
expect Reland "[vm] Fix V8 snapshot profile handling of the dispatch table." 2021-04-20 11:17:36 +00:00
front_end Replace CFE and analyzer legacy type promotion with a shared implementation. 2021-04-21 14:21:30 +00:00
frontend_server [kernel] Make FileUriNode.fileUri non-nullable 2021-04-19 08:03:30 +00:00
js Update LICENSE 2021-04-07 10:28:38 +00:00
js_ast [js_ast] add DeferredStatement to js ast. 2021-04-15 20:16:27 +00:00
js_runtime [dart2js] Remove old-rti substitution property from namer 2021-04-15 04:46:56 +00:00
kernel [cfe] Make TypeParameter.defaultType non-nullable 2021-04-21 13:51:50 +00:00
language_versioning_2.7_test
meta Update LICENSE 2021-04-07 10:28:38 +00:00
modular_test Prepare for switching to null safe package_config 2021-01-21 05:04:33 +00:00
native_stack_traces Update LICENSE 2021-04-07 10:28:38 +00:00
nnbd_migration Migration: tolerate relative imports into lib. 2021-04-21 22:04:30 +00:00
scrape remove unnecessary parens in string interp 2021-03-25 22:24:34 +00:00
smith [infra] Add new compressed architectures to the test matrix. 2021-02-04 17:44:37 +00:00
sourcemap_testing Update List constructor documentation, deprecate constructor. 2020-12-07 16:20:28 +00:00
status_file Don't truncate command output in the test runner. 2021-04-07 23:42:38 +00:00
telemetry Update LICENSE 2021-04-07 10:28:38 +00:00
test_runner fix sort_directives violations 2021-04-21 00:13:48 +00:00
testing [CFE] Make fuzz testing work also when not skipping VM 2021-03-22 10:12:52 +00:00
vm Replace CFE and analyzer legacy type promotion with a shared implementation. 2021-04-21 14:21:30 +00:00
vm_service fix sort_directives violations 2021-04-20 22:21:28 +00:00
vm_snapshot_analysis [vm_snapshot_analysis] Migrate to null-safety 2021-04-15 12:03:47 +00:00
wasm Update LICENSE 2021-04-07 10:28:38 +00:00
.gitignore
BUILD.gn
pkg.status [test] Apply simarm64 status file entries to simarm64c. 2021-02-25 21:18:02 +00:00
README.md

Package validation

The packages in pkg/ are automatically validated on the LUCI CI bots. The validation is largely done by the tools/package_deps package; it can be tested locally via:

dart tools/package_deps/bin/package_deps.dart

Packages which are published

There are several packages developed in pkg/ which are published to pub. Validation of these packages is particularly important because the pub tools are not used for these packages during development; we get our dependency versions from the DEPS file. Its very easy for the dependencies specified in a package's pubspec file to get out of date wrt the packages and versions actually used.

In order to better ensure we're publishing correct packages, we validate some properties of the pubspec files on our CI system. These validations include:

  • that the dependencies listed in the pubspec are used in the package
  • that all the packages used by the source are listed in the pubspec
  • that we don't use relative path deps to pkg/ or third_party/ packages

Packages which are not published

For packages in pkg/ which we do not intend to be published, we put the following comment in the pubspec.yaml file:

# This package is not intended for consumption on pub.dev. DO NOT publish.
publish_to: none

These pubspecs are still validated by the package validation tool. The contents are more informational as the pubspecs for these packages are not consumed by the pub tool or ecosystem.

We validate:

  • that the dependencies listed in the pubspec are used in the package
  • that all the packages used by the source are listed in the pubspec
  • that a reference to a pkg/ package is done via a relative path dependency