diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae5db7ba14..03de37445ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -495,7 +495,7 @@ #### Linter Updated the Linter to `1.14.0`, which includes changes that -- fix `omit_local_variable_types` to not flag a local type that is +- fix `omit_local_variable_types` to not flag a local type that is required for inference. - allow `while (true) { ... }` in `literal_only_boolean_expressions`. - fix `file_names` to report at the start of the file (not the entire @@ -538,7 +538,11 @@ Updated the Linter to `1.14.0`, which includes changes that ### Pub -- Adds support for token-based authorization to third party package-repositories +- If you have analytics enabled `dart pub get` will send + [usage metrics](https://github.com/dart-lang/pub/blob/0035a40f25d027130c0314571da53ffafc6d973b/lib/src/solver/result.dart#L131-L175) + for packages from pub.dev, intended for popularity analysis. + +- Adds support for token-based authorization to third-party package-repositories with the new command `dart pub token`. - Credentials are no longer stored in the pub-cache, but in a platform dependent config directory: @@ -546,6 +550,35 @@ Updated the Linter to `1.14.0`, which includes changes that is defined, otherwise `$HOME/.config/dart/pub-credentials.json` * On Mac OS: `$HOME/Library/Application Support/dart/pub-credentials.json` * On Windows: `%APPDATA%/dart/pub-credentials.json` +- The syntax for dependencies hosted at a third-party package repository has + been simplified. Before you would need to write: + +``` +dependencies: + colorizer: + hosted: + name: colorizer + url: 'https://custom-pub-server.com' + version: ^1.2.3 +environment: + sdk: '>=2.14.0 < 3.0.0' +``` + +Now you can write: + +``` +dependencies: + colorizer: + hosted: 'https://custom-pub-server.com' + version: ^1.2.3 +environment: + sdk: '>=2.15.0 < 3.0.0' +``` + +This feature requires +[language-version](https://dart.dev/guides/language/evolution#language-versioning) +2.15 or later, e.g. the `pubspec.yaml` should have an SDK constraint of +`>=2.15 <3.0.0`. - Detect potential leaks in `dart pub publish`. When publishing, pub will examine your files for potential secret keys, and diff --git a/DEPS b/DEPS index 1acadc24dca..18e0f7ab785 100644 --- a/DEPS +++ b/DEPS @@ -139,7 +139,7 @@ vars = { "pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae", "process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b", "protobuf_rev": "c1eb6cb51af39ccbaa1a8e19349546586a5c8e31", - "pub_rev": "78bc50c7833451c24e531713362e46fd50621ff0", + "pub_rev": "0035a40f25d027130c0314571da53ffafc6d973b", "pub_semver_rev": "a43ad72fb6b7869607581b5fedcb186d1e74276a", "root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50", "rust_revision": "b7856f695d65a8ebc846754f97d15814bcb1c244", diff --git a/pkg/dartdev/lib/src/commands/run.dart b/pkg/dartdev/lib/src/commands/run.dart index ace72858db4..69db956b2e8 100644 --- a/pkg/dartdev/lib/src/commands/run.dart +++ b/pkg/dartdev/lib/src/commands/run.dart @@ -228,31 +228,18 @@ class RunCommand extends DartdevCommand { } } - String path; - String packagesConfigOverride; - try { - final filename = maybeUriToFilename(mainCommand); - if (File(filename).existsSync()) { - // TODO(sigurdm): getExecutableForCommand is able to figure this out, - // but does not return a package config override. - path = filename; - packagesConfigOverride = null; - } else { - path = await getExecutableForCommand(mainCommand); - packagesConfigOverride = - join(current, '.dart_tool', 'package_config.json'); - } + final executable = await getExecutableForCommand(mainCommand); + VmInteropHandler.run( + executable.executable, + runArgs, + packageConfigOverride: executable.packageConfig, + ); + return 0; } on CommandResolutionFailedException catch (e) { log.stderr(e.message); return errorExitCode; } - VmInteropHandler.run( - path, - runArgs, - packageConfigOverride: packagesConfigOverride, - ); - return 0; } } diff --git a/pkg/dartdev/lib/src/commands/test.dart b/pkg/dartdev/lib/src/commands/test.dart index c6711c7f8ea..36683af0110 100644 --- a/pkg/dartdev/lib/src/commands/test.dart +++ b/pkg/dartdev/lib/src/commands/test.dart @@ -5,7 +5,6 @@ import 'dart:async'; import 'package:args/args.dart'; -import 'package:path/path.dart'; import 'package:pub/pub.dart'; import '../core.dart'; @@ -32,15 +31,16 @@ class TestCommand extends DartdevCommand { try { final testExecutable = await getExecutableForCommand('test:test'); log.trace('dart $testExecutable ${argResults.rest.join(' ')}'); - VmInteropHandler.run(testExecutable, argResults.rest, - packageConfigOverride: - join(current, '.dart_tool', 'package_config.json')); + VmInteropHandler.run(testExecutable.executable, argResults.rest, + packageConfigOverride: testExecutable.packageConfig); return 0; } on CommandResolutionFailedException catch (e) { if (project.hasPubspecFile) { print(e.message); - print('You need to add a dev_dependency on package:test.'); - print('Try running `dart pub add --dev test`.'); + if (e.issue == CommandResolutionIssue.packageNotFound) { + print('You need to add a dev_dependency on package:test.'); + print('Try running `dart pub add --dev test`.'); + } } else { print( 'No pubspec.yaml file found - run this command in your project folder.');