Skip to content

Commit 9d132eb

Browse files
sigurdmcommit-bot@chromium.org
authored andcommitted
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 <[email protected]> Reviewed-by: Michael Thomsen <[email protected]> Reviewed-by: Jonas Jensen <[email protected]>
1 parent 391bc8d commit 9d132eb

File tree

7 files changed

+129
-10
lines changed

7 files changed

+129
-10
lines changed

CHANGELOG.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,31 @@ Updated the Linter to `0.1.123`, which includes:
8585

8686
#### Pub
8787

88+
* **Breaking**: The Dart SDK constraint is now **required** in `pubspec.yaml`.
89+
90+
You now have to include a section like:
91+
92+
```yaml
93+
environment:
94+
sdk: '>=2.10.0 <3.0.0'
95+
```
96+
97+
See [#44072][].
8898
* The top level `pub` executable has been deprecated. Use `dart pub` instead.
89-
* New commands `dart pub add` and `dart pub remove` that adds and removes new
90-
dependencies to your `pubspec.yaml`.
91-
* New option `dart pub outdated mode=null-safety` that will analyze your
99+
See [dart tool][].
100+
* New command `dart pub add` that adds new dependencies to your `pubspec.yaml`.
101+
102+
And a corresponding `dart pub remove` that removes dependencies.
103+
* New option `dart pub outdated --mode=null-safety` that will analyze your
92104
dependencies for null-safety.
93105
* `dart pub publish` will now check your pubspec keys for likely typos.
94-
* `dart pub get` will print a warning if the resolution is in mixed-mode requiring
95-
the code to run with `dart --no-sound-null-safety`.
96106
* New command `dart pub login` that logs in to pub.dev.
107+
* The `--server` option to `dart pub publish` and `dart pub uploader` have been
108+
deprecated. Use `publish_to` in your `pubspec.yaml` or set the
109+
`$PUB_HOSTED_URL` environment variable.
110+
111+
[#44072]: https://github.com/dart-lang/sdk/issues/44072
112+
[dart tool]: https://dart.dev/tools/dart-tool
97113

98114
## 2.10.3 - 2020-10-29
99115

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ vars = {
132132
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
133133
"pool_rev": "eedbd5fde84f9a1a8da643b475305a81841da599",
134134
"protobuf_rev": "3746c8fd3f2b0147623a8e3db89c3ff4330de760",
135-
"pub_rev": "900e796a37fd9f68de9dd183cf4798fe5f055eaa",
135+
"pub_rev": "4ca4767a6c00b2dadecdaee9a4866dae40ef25f2",
136136
"pub_semver_tag": "v1.4.4",
137137
"resource_rev": "6b79867d0becf5395e5819a75720963b8298e9a7",
138138
"root_certificates_rev": "7e5ec82c99677a2e5b95ce296c4d68b0d3378ed8",

pkg/dartdev/lib/src/commands/pub.dart

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'dart:async';
6+
7+
import 'package:args/args.dart';
8+
9+
import '../core.dart';
10+
import '../experiments.dart';
11+
import '../sdk.dart';
12+
import '../vm_interop_handler.dart';
13+
14+
class PubCommand extends DartdevCommand {
15+
static const String cmdName = 'pub';
16+
17+
PubCommand() : super(cmdName, 'Work with packages.');
18+
19+
// TODO(jwren) as soon as pub commands are are implemented directly in
20+
// dartdev, remove this static list.
21+
/// A list of all subcommands, used only for the implementation of
22+
/// [usagePath], see below.
23+
static List<String> pubSubcommands = [
24+
'cache',
25+
'deps',
26+
'downgrade',
27+
'get',
28+
'global',
29+
'logout',
30+
'outdated',
31+
'publish',
32+
'run',
33+
'upgrade',
34+
'uploader',
35+
'version',
36+
];
37+
38+
@override
39+
ArgParser createArgParser() => ArgParser.allowAnything();
40+
41+
@override
42+
void printUsage() {
43+
// Override [printUsage] for invocations of 'dart help pub' which won't
44+
// execute [run] below. Without this, the 'dart help pub' reports the
45+
// command pub with no commands or flags.
46+
if (!Sdk.checkArtifactExists(sdk.pubSnapshot)) {
47+
return;
48+
}
49+
final command = sdk.pubSnapshot;
50+
final args = ['help'];
51+
52+
log.trace('$command ${args.first}');
53+
54+
// Call 'pub help'
55+
VmInteropHandler.run(command, args);
56+
}
57+
58+
@override
59+
FutureOr<int> run() async {
60+
if (!Sdk.checkArtifactExists(sdk.pubSnapshot)) {
61+
return 255;
62+
}
63+
final command = sdk.pubSnapshot;
64+
var args = argResults.arguments;
65+
66+
// Pass any --enable-experiment options along.
67+
if (args.isNotEmpty && wereExperimentsSpecified) {
68+
List<String> experimentIds = specifiedExperiments;
69+
70+
if (args.first == 'run') {
71+
args = [
72+
...args.sublist(0, 1),
73+
'--$experimentFlagName=${experimentIds.join(',')}',
74+
...args.sublist(1),
75+
];
76+
} else if (args.length > 1 && args[0] == 'global' && args[0] == 'run') {
77+
args = [
78+
...args.sublist(0, 2),
79+
'--$experimentFlagName=${experimentIds.join(',')}',
80+
...args.sublist(2),
81+
];
82+
}
83+
}
84+
85+
log.trace('$command ${args.join(' ')}');
86+
VmInteropHandler.run(command, args);
87+
return 0;
88+
}
89+
}

pkg/dartdev/test/commands/pub_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ void pub() {
8686
expect(result.stdout, isEmpty);
8787
expect(
8888
result.stderr,
89-
contains('bin/main.dart:1:18: Error: This requires the \'non-nullable\''
90-
' language feature to be enabled.\n'));
89+
contains('bin/main.dart:1:18: Error: This requires the null safety '
90+
'language feature, which requires language version of 2.12 or '
91+
'higher.\n'));
9192
});
9293

9394
test('failure', () {

pkg/dartdev/test/commands/test_test.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ void defineTest() {
6969

7070
test('no package:test dependency', () {
7171
p = project(mainSrc: 'int get foo => 1;\n');
72-
p.file('pubspec.yaml', 'name: ${p.name}\n');
72+
p.file('pubspec.yaml', '''
73+
name: ${p.name}
74+
environment:
75+
sdk: '>=2.10.0 <3.0.0'
76+
''');
7377

7478
var result = p.runSync('pub', ['get']);
7579
expect(result.exitCode, 0);

pkg/dartdev/test/utils.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ class TestProject {
4242
this.logAnalytics = false,
4343
}) {
4444
dir = Directory.systemTemp.createTempSync('dartdev');
45-
file('pubspec.yaml', 'name: $name\ndev_dependencies:\n test: any\n');
45+
file('pubspec.yaml', '''
46+
name: $name
47+
environment:
48+
sdk: '>=2.10.0 <3.0.0'
49+
50+
dev_dependencies:
51+
test: any
52+
''');
4653
if (analysisOptions != null) {
4754
file('analysis_options.yaml', analysisOptions);
4855
}

tools/bots/pub_integration_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import tempfile
1212

1313
PUBSPEC = """name: pub_integration_test
14+
environment:
15+
sdk: '>=2.10.0 <=3.0.0'
1416
dependencies:
1517
shelf:
1618
test:

0 commit comments

Comments
 (0)