From 3c5e2a0d7b11139408d1827d371836464417e622 Mon Sep 17 00:00:00 2001 From: Sigurd Meldgaard Date: Fri, 29 Oct 2021 13:05:39 +0000 Subject: [PATCH] Bump pub to 0035a40f25d027130c0314571da53ffafc6d973b Changes: ``` > git log --format="%C(auto) %h %s" 78bc50c..0035a40 https://dart.googlesource.com/pub.git/+/0035a40f Fix echo mode crash on `token add` (#3194) https://dart.googlesource.com/pub.git/+/a75a8c17 Don't warn against discontinued transitive dependencies (#3195) https://dart.googlesource.com/pub.git/+/cf2ed105 Fix analytics code (#3197) https://dart.googlesource.com/pub.git/+/08e13f7b Remove unused golden files (#3189) https://dart.googlesource.com/pub.git/+/b6293b80 Fix log message related to `pub global activate` (#3187) https://dart.googlesource.com/pub.git/+/94f6b477 Introducing command-line interface tests (#3161) https://dart.googlesource.com/pub.git/+/3ba8134f More details from getExecutableForCommand (#3186) https://dart.googlesource.com/pub.git/+/a2dbcfff Shorthand syntax for hosted dependencies (#3133) https://dart.googlesource.com/pub.git/+/435e4e3f Shuffle analytics (#3185) ``` Diff: https://dart.googlesource.com/pub.git/+/78bc50c7833451c24e531713362e46fd50621ff0~..0035a40f25d027130c0314571da53ffafc6d973b/ Change-Id: Idfd7c382985d1ad3e3ad87a621dc79d3b74e898e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218620 Reviewed-by: Jonas Jensen Commit-Queue: Sigurd Meldgaard --- CHANGELOG.md | 37 ++++++++++++++++++++++++-- DEPS | 2 +- pkg/dartdev/lib/src/commands/run.dart | 27 +++++-------------- pkg/dartdev/lib/src/commands/test.dart | 12 ++++----- 4 files changed, 49 insertions(+), 29 deletions(-) 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.');