Roll the latest dart_style into the SDK.
This does have some style changes, so probably needs to be coordinated with an update to the prebuilt SDK. Change-Id: I026e9df82083b7d5cac2375a8c55d6c6f40337bf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499383 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Alexander Thomas <athom@google.com> Commit-Queue: Alexander Thomas <athom@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
95c3cab03b
commit
1aba9d0fa5
@@ -23,6 +23,98 @@
|
||||
|
||||
[#54557]: https://github.com/dart-lang/sdk/issues/54557
|
||||
|
||||
### Tools
|
||||
|
||||
#### Dart format
|
||||
|
||||
These changes are not language versioned and affect formatting all code:
|
||||
|
||||
* Fix bug where some collections or arguments might split unnecessarily.
|
||||
|
||||
* Don't add a blank line before a comment at the end of a compilation unit or
|
||||
braced body.
|
||||
|
||||
* Format extension type representation clauses the same way primary constructor
|
||||
formal parameter lists are formatted:
|
||||
|
||||
```dart
|
||||
// Before:
|
||||
extension type JSExportedDartFunction._(
|
||||
JSExportedDartFunctionRepType _jsExportedDartFunction
|
||||
)
|
||||
implements JSFunction {}
|
||||
|
||||
// After:
|
||||
extension type JSExportedDartFunction._(
|
||||
JSExportedDartFunctionRepType _jsExportedDartFunction
|
||||
) implements JSFunction {}
|
||||
```
|
||||
|
||||
* When trailing commas are preserved, don't insert a newline before the `;` in
|
||||
an enum with members unless there actually is a trailing comma.
|
||||
(Fix by @Barbirosha.)
|
||||
|
||||
These changes are language versioned and only affect code at 3.13 or higher:
|
||||
|
||||
* Support block-formatting parameter lists:
|
||||
|
||||
```dart
|
||||
// Before:
|
||||
typedef DataViewBuilder<T> =
|
||||
Widget Function(
|
||||
BuildContext context,
|
||||
PagingState<int, T> state,
|
||||
NextPageCallback fetchNextPage,
|
||||
);
|
||||
|
||||
// After:
|
||||
typedef DataViewBuilder<T> = Widget Function(
|
||||
BuildContext context,
|
||||
PagingState<int, T> state,
|
||||
NextPageCallback fetchNextPage,
|
||||
);
|
||||
```
|
||||
|
||||
* Allow `as`, `is`, and `is!` expressions to be block formatted:
|
||||
|
||||
```dart
|
||||
// Before:
|
||||
variable =
|
||||
function(
|
||||
argument,
|
||||
argument,
|
||||
argument,
|
||||
)
|
||||
as Type;
|
||||
|
||||
// After:
|
||||
variable = function(
|
||||
argument,
|
||||
argument,
|
||||
argument,
|
||||
) as Type;
|
||||
```
|
||||
|
||||
* Force blank lines around a mixin or extension type declaration if it doesn't
|
||||
have a `;` body:
|
||||
|
||||
```dart
|
||||
// Before:
|
||||
int above;
|
||||
extension type Inches(int x) {}
|
||||
mixin M {}
|
||||
int below;
|
||||
|
||||
// After:
|
||||
int above;
|
||||
|
||||
extension type Inches(int x) {}
|
||||
|
||||
mixin M {}
|
||||
|
||||
int below;
|
||||
```
|
||||
|
||||
## 3.12.0
|
||||
|
||||
**Released on:** Unreleased
|
||||
|
||||
@@ -129,7 +129,7 @@ vars = {
|
||||
# and land the review.
|
||||
#
|
||||
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
|
||||
"dart_style_rev": "c9975c66895011079bb3a98dc2271f4e038d45e8", # rolled manually
|
||||
"dart_style_rev": "f1d10e1e052116aeb3851f90ace55e5447b3bc21", # rolled manually
|
||||
|
||||
### /third_party/pkg dependencies
|
||||
# 'tools/rev_sdk_deps.dart' will rev pkg dependencies to their latest; put an
|
||||
|
||||
@@ -178,7 +178,7 @@ class OptionsParser {
|
||||
|
||||
var allSuiteDirectories = [
|
||||
...testSuiteDirectories,
|
||||
Path('tests/co19'),
|
||||
SuiteDirectory('tests/co19'),
|
||||
];
|
||||
|
||||
var selectors = <String>[];
|
||||
@@ -187,7 +187,7 @@ class OptionsParser {
|
||||
// infer the selector from it. This lets users use tab completion on
|
||||
// the command line.
|
||||
for (var suiteDirectory in allSuiteDirectories) {
|
||||
var path = suiteDirectory.toString();
|
||||
var path = suiteDirectory.directory.toString();
|
||||
final separator = Platform.pathSeparator;
|
||||
if (separator != '/') {
|
||||
selector = selector.replaceAll(separator, '/');
|
||||
|
||||
@@ -28,29 +28,43 @@ export 'configuration.dart' show TestConfiguration;
|
||||
/// simpler to add them to test.dart. Existing test suites should be moved to
|
||||
/// here, if possible.
|
||||
final testSuiteDirectories = [
|
||||
Path('pkg'),
|
||||
Path('runtime/tests/vm'),
|
||||
Path('samples'),
|
||||
Path('tests/corelib'),
|
||||
Path('tests/dartdevc'),
|
||||
Path('tests/ffi'),
|
||||
Path('tests/language'),
|
||||
Path('tests/macro_build'),
|
||||
Path('tests/lib'),
|
||||
Path('tests/standalone'),
|
||||
Path('tests/web'),
|
||||
Path('third_party/pkg/dart_style'),
|
||||
Path('third_party/pkg/dartdoc'),
|
||||
Path('third_party/pkg/native/pkgs/code_assets'),
|
||||
Path('third_party/pkg/native/pkgs/data_assets'),
|
||||
Path('third_party/pkg/native/pkgs/hooks_runner'),
|
||||
Path('third_party/pkg/native/pkgs/hooks'),
|
||||
Path('third_party/pkg/native/pkgs/native_toolchain_c'),
|
||||
Path('third_party/pkg/native/pkgs/record_use'),
|
||||
Path('third_party/pkg/package_config'),
|
||||
Path('utils/tests/peg'),
|
||||
SuiteDirectory('pkg'),
|
||||
SuiteDirectory('runtime/tests/vm'),
|
||||
SuiteDirectory('samples'),
|
||||
SuiteDirectory('tests/corelib'),
|
||||
SuiteDirectory('tests/dartdevc'),
|
||||
SuiteDirectory('tests/ffi'),
|
||||
SuiteDirectory('tests/language'),
|
||||
SuiteDirectory('tests/macro_build'),
|
||||
SuiteDirectory('tests/lib'),
|
||||
SuiteDirectory('tests/standalone'),
|
||||
SuiteDirectory('tests/web'),
|
||||
SuiteDirectory('third_party/pkg/dart_style', 'test'),
|
||||
SuiteDirectory('third_party/pkg/dartdoc'),
|
||||
SuiteDirectory('third_party/pkg/native/pkgs/code_assets'),
|
||||
SuiteDirectory('third_party/pkg/native/pkgs/data_assets'),
|
||||
SuiteDirectory('third_party/pkg/native/pkgs/hooks_runner'),
|
||||
SuiteDirectory('third_party/pkg/native/pkgs/hooks'),
|
||||
SuiteDirectory('third_party/pkg/native/pkgs/native_toolchain_c'),
|
||||
SuiteDirectory('third_party/pkg/native/pkgs/record_use'),
|
||||
SuiteDirectory('third_party/pkg/package_config'),
|
||||
SuiteDirectory('utils/tests/peg'),
|
||||
];
|
||||
|
||||
/// Describes a directory whose name defines a test suite and whose contents
|
||||
/// are tests.
|
||||
final class SuiteDirectory {
|
||||
final Path directory;
|
||||
|
||||
/// The subdirectory to look inside [directory] for tests.
|
||||
///
|
||||
/// If `null`, then all tests in [directory] are found.
|
||||
final String? testSubdirectory;
|
||||
|
||||
SuiteDirectory(String directoryPath, [this.testSubdirectory])
|
||||
: directory = Path(directoryPath);
|
||||
}
|
||||
|
||||
// TODO(26372): Ensure that the returned future awaits on all started tasks.
|
||||
Future testConfigurations(List<TestConfiguration> configurations) async {
|
||||
var startTime = DateTime.now();
|
||||
@@ -129,10 +143,15 @@ Future testConfigurations(List<TestConfiguration> configurations) async {
|
||||
testSuites.add(PackageTestSuite(configuration, suitePath));
|
||||
} else {
|
||||
for (var testSuiteDir in testSuiteDirectories) {
|
||||
var name = testSuiteDir.filename;
|
||||
var name = testSuiteDir.directory.filename;
|
||||
if (configuration.selectors.containsKey(name)) {
|
||||
testSuites
|
||||
.add(StandardTestSuite.forDirectory(configuration, testSuiteDir));
|
||||
testSuites.add(
|
||||
StandardTestSuite.forDirectory(
|
||||
configuration,
|
||||
testSuiteDir.directory,
|
||||
testSuiteDir.testSubdirectory,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -619,9 +619,14 @@ class StandardTestSuite extends TestSuite {
|
||||
/// instead of having to create a custom [StandardTestSuite] subclass. In
|
||||
/// particular, if you add 'path/to/mytestsuite' to `testSuiteDirectories`
|
||||
/// in test.dart, this will all be set up for you.
|
||||
factory StandardTestSuite.forDirectory(
|
||||
TestConfiguration configuration, Path directory) {
|
||||
///
|
||||
/// If [testSubdirectory] is given, then tests are only searched for inside
|
||||
/// that subdirectory of [directory]. Otherwise, tests will be found anywhere
|
||||
/// in [directory].
|
||||
factory StandardTestSuite.forDirectory(TestConfiguration configuration,
|
||||
Path directory, String? testSubdirectory) {
|
||||
var name = directory.filename;
|
||||
|
||||
var statusPaths = [
|
||||
'$directory/$name.status',
|
||||
'$directory/.status',
|
||||
@@ -645,6 +650,10 @@ class StandardTestSuite extends TestSuite {
|
||||
statusPaths = ['third_party/pkg/$name.status'];
|
||||
}
|
||||
|
||||
if (testSubdirectory != null) {
|
||||
directory = directory.append(testSubdirectory);
|
||||
}
|
||||
|
||||
return StandardTestSuite(configuration, name, directory, statusPaths,
|
||||
recursive: true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user