Bump pub
New commits:
git log --format="%C(auto) %h %s" 900e796a37fd9f68de9dd183cf4798fe5f055eaa..4ca4767a6c00b2dadecdaee9a4866dae40ef25f2
4ca4767a Added a dart pub outdated --transitive option (#2731)
6b145bd6 Deprecate --server argument to `pub publish` and `pub uploader`. (#2697)
7737023a don't warn if previous prerelease was null safe (#2730)
62f92838 Improve outdated --mode=null-safety (#2724)
cc589ec3 Change message for no Latest resolution (#2729)
656803e9 Require sdk constraint (#2718)
8309d877 Added test that dev_dependency does not trigger null-safety warnings when publishing (#2727)
332ea049 Remove warning about mixed mode. (#2723)
a98a1f23 Simplify null-safety analysis in `pub outdated --mode=null-safety` (#2721)
5fba2015 Outdated null safety implies prereleases (#2722)
fb9ec4af Fixed bug in yaml_edit (#2703)
Change-Id: I22a084aee06542e04a272269fb0134f0ac62f779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170690
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d7db0cc..e478d0b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -85,15 +85,31 @@
#### Pub
+* **Breaking**: The Dart SDK constraint is now **required** in `pubspec.yaml`.
+
+ You now have to include a section like:
+
+ ```yaml
+ environment:
+ sdk: '>=2.10.0 <3.0.0'
+ ```
+
+ See [#44072][].
* The top level `pub` executable has been deprecated. Use `dart pub` instead.
-* New commands `dart pub add` and `dart pub remove` that adds and removes new
- dependencies to your `pubspec.yaml`.
-* New option `dart pub outdated mode=null-safety` that will analyze your
+ See [dart tool][].
+* New command `dart pub add` that adds new dependencies to your `pubspec.yaml`.
+
+ And a corresponding `dart pub remove` that removes dependencies.
+* New option `dart pub outdated --mode=null-safety` that will analyze your
dependencies for null-safety.
* `dart pub publish` will now check your pubspec keys for likely typos.
-* `dart pub get` will print a warning if the resolution is in mixed-mode requiring
- the code to run with `dart --no-sound-null-safety`.
* New command `dart pub login` that logs in to pub.dev.
+* The `--server` option to `dart pub publish` and `dart pub uploader` have been
+ deprecated. Use `publish_to` in your `pubspec.yaml` or set the
+ `$PUB_HOSTED_URL` environment variable.
+
+[#44072]: https://github.com/dart-lang/sdk/issues/44072
+[dart tool]: https://dart.dev/tools/dart-tool
## 2.10.3 - 2020-10-29
diff --git a/DEPS b/DEPS
index 57a2c16..1e6598a 100644
--- a/DEPS
+++ b/DEPS
@@ -132,7 +132,7 @@
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_rev": "eedbd5fde84f9a1a8da643b475305a81841da599",
"protobuf_rev": "3746c8fd3f2b0147623a8e3db89c3ff4330de760",
- "pub_rev": "900e796a37fd9f68de9dd183cf4798fe5f055eaa",
+ "pub_rev": "4ca4767a6c00b2dadecdaee9a4866dae40ef25f2",
"pub_semver_tag": "v1.4.4",
"resource_rev": "6b79867d0becf5395e5819a75720963b8298e9a7",
"root_certificates_rev": "7e5ec82c99677a2e5b95ce296c4d68b0d3378ed8",
diff --git a/pkg/dartdev/lib/src/commands/pub.dart b/pkg/dartdev/lib/src/commands/pub.dart
new file mode 100644
index 0000000..d77dce6
--- /dev/null
+++ b/pkg/dartdev/lib/src/commands/pub.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:args/args.dart';
+
+import '../core.dart';
+import '../experiments.dart';
+import '../sdk.dart';
+import '../vm_interop_handler.dart';
+
+class PubCommand extends DartdevCommand {
+ static const String cmdName = 'pub';
+
+ PubCommand() : super(cmdName, 'Work with packages.');
+
+ // TODO(jwren) as soon as pub commands are are implemented directly in
+ // dartdev, remove this static list.
+ /// A list of all subcommands, used only for the implementation of
+ /// [usagePath], see below.
+ static List<String> pubSubcommands = [
+ 'cache',
+ 'deps',
+ 'downgrade',
+ 'get',
+ 'global',
+ 'logout',
+ 'outdated',
+ 'publish',
+ 'run',
+ 'upgrade',
+ 'uploader',
+ 'version',
+ ];
+
+ @override
+ ArgParser createArgParser() => ArgParser.allowAnything();
+
+ @override
+ void printUsage() {
+ // Override [printUsage] for invocations of 'dart help pub' which won't
+ // execute [run] below. Without this, the 'dart help pub' reports the
+ // command pub with no commands or flags.
+ if (!Sdk.checkArtifactExists(sdk.pubSnapshot)) {
+ return;
+ }
+ final command = sdk.pubSnapshot;
+ final args = ['help'];
+
+ log.trace('$command ${args.first}');
+
+ // Call 'pub help'
+ VmInteropHandler.run(command, args);
+ }
+
+ @override
+ FutureOr<int> run() async {
+ if (!Sdk.checkArtifactExists(sdk.pubSnapshot)) {
+ return 255;
+ }
+ final command = sdk.pubSnapshot;
+ var args = argResults.arguments;
+
+ // Pass any --enable-experiment options along.
+ if (args.isNotEmpty && wereExperimentsSpecified) {
+ List<String> experimentIds = specifiedExperiments;
+
+ if (args.first == 'run') {
+ args = [
+ ...args.sublist(0, 1),
+ '--$experimentFlagName=${experimentIds.join(',')}',
+ ...args.sublist(1),
+ ];
+ } else if (args.length > 1 && args[0] == 'global' && args[0] == 'run') {
+ args = [
+ ...args.sublist(0, 2),
+ '--$experimentFlagName=${experimentIds.join(',')}',
+ ...args.sublist(2),
+ ];
+ }
+ }
+
+ log.trace('$command ${args.join(' ')}');
+ VmInteropHandler.run(command, args);
+ return 0;
+ }
+}
diff --git a/pkg/dartdev/test/commands/pub_test.dart b/pkg/dartdev/test/commands/pub_test.dart
index d8a4a04..82f00d0 100644
--- a/pkg/dartdev/test/commands/pub_test.dart
+++ b/pkg/dartdev/test/commands/pub_test.dart
@@ -86,8 +86,9 @@
expect(result.stdout, isEmpty);
expect(
result.stderr,
- contains('bin/main.dart:1:18: Error: This requires the \'non-nullable\''
- ' language feature to be enabled.\n'));
+ contains('bin/main.dart:1:18: Error: This requires the null safety '
+ 'language feature, which requires language version of 2.12 or '
+ 'higher.\n'));
});
test('failure', () {
diff --git a/pkg/dartdev/test/commands/test_test.dart b/pkg/dartdev/test/commands/test_test.dart
index 93aa6b1..cf7aea9 100644
--- a/pkg/dartdev/test/commands/test_test.dart
+++ b/pkg/dartdev/test/commands/test_test.dart
@@ -69,7 +69,11 @@
test('no package:test dependency', () {
p = project(mainSrc: 'int get foo => 1;\n');
- p.file('pubspec.yaml', 'name: ${p.name}\n');
+ p.file('pubspec.yaml', '''
+name: ${p.name}
+environment:
+ sdk: '>=2.10.0 <3.0.0'
+''');
var result = p.runSync('pub', ['get']);
expect(result.exitCode, 0);
diff --git a/pkg/dartdev/test/utils.dart b/pkg/dartdev/test/utils.dart
index 4d67099..bbc46df 100644
--- a/pkg/dartdev/test/utils.dart
+++ b/pkg/dartdev/test/utils.dart
@@ -42,7 +42,14 @@
this.logAnalytics = false,
}) {
dir = Directory.systemTemp.createTempSync('dartdev');
- file('pubspec.yaml', 'name: $name\ndev_dependencies:\n test: any\n');
+ file('pubspec.yaml', '''
+name: $name
+environment:
+ sdk: '>=2.10.0 <3.0.0'
+
+dev_dependencies:
+ test: any
+''');
if (analysisOptions != null) {
file('analysis_options.yaml', analysisOptions);
}
diff --git a/tools/bots/pub_integration_test.py b/tools/bots/pub_integration_test.py
index 6d71e1e..6d6ef43 100755
--- a/tools/bots/pub_integration_test.py
+++ b/tools/bots/pub_integration_test.py
@@ -11,6 +11,8 @@
import tempfile
PUBSPEC = """name: pub_integration_test
+environment:
+ sdk: '>=2.10.0 <=3.0.0'
dependencies:
shelf:
test: