Make dartdoc tests work where --preview-dart-2 is the default (#1719)
* Make dartdoc tests work where --preview-dart-2 is the default
* Fix a type problem in grinder script (first time using it in Dart 2)
* Replace checked with --enable-asserts
* Fix more Future<Null>s and re-allow broader SDK versioning
diff --git a/.travis.yml b/.travis.yml
index e18a7ad..794905e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: dart
sudo: false
dart:
- - "dev/raw/2.0.0-dev.63.0"
+ - "dev/raw/latest"
env:
- DARTDOC_BOT=main
# TODO(devoncarew): add angulardart support
diff --git a/appveyor.yml b/appveyor.yml
index 07eef01..d4bd319 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
install:
- - ps: wget https://storage.googleapis.com/dart-archive/channels/dev/raw/2.0.0-dev.63.0/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip
+ - ps: wget https://storage.googleapis.com/dart-archive/channels/dev/raw/latest/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip
- cmd: echo "Unzipping dart-sdk..."
- cmd: 7z x dart-sdk.zip -o"C:\tools" -y > nul
- set PATH=%PATH%;C:\tools\dart-sdk\bin
diff --git a/lib/src/io_utils.dart b/lib/src/io_utils.dart
index a97da00..5b2c345 100644
--- a/lib/src/io_utils.dart
+++ b/lib/src/io_utils.dart
@@ -66,7 +66,7 @@
final RegExp quotables = new RegExp(r'[ "\r\n\$]');
-/// Best used with Future<Null>.
+/// Best used with Future<void>.
class MultiFutureTracker<T> {
/// Approximate maximum number of simultaneous active Futures.
final int parallel;
@@ -105,7 +105,7 @@
String get prefix => context.isNotEmpty ? '$context: ' : '';
// from flutter:dev/tools/dartdoc.dart, modified
- static Future<Null> _printStream(Stream<List<int>> stream, Stdout output,
+ static Future<void> _printStream(Stream<List<int>> stream, Stdout output,
{String prefix: '', Iterable<String> Function(String line) filter}) {
assert(prefix != null);
if (filter == null) filter = (line) => [line];
@@ -188,9 +188,9 @@
Process process = await Process.start(executable, arguments,
workingDirectory: workingDirectory, environment: environment);
- Future<Null> stdoutFuture = _printStream(process.stdout, stdout,
+ Future<void> stdoutFuture = _printStream(process.stdout, stdout,
prefix: prefix, filter: jsonCallback);
- Future<Null> stderrFuture = _printStream(process.stderr, stderr,
+ Future<void> stderrFuture = _printStream(process.stderr, stderr,
prefix: prefix, filter: jsonCallback);
await Future.wait([stderrFuture, stdoutFuture, process.exitCode]);
diff --git a/pubspec.lock b/pubspec.lock
index 88e0924..d00fc3b 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -492,4 +492,4 @@
source: hosted
version: "2.1.13"
sdks:
- dart: ">=2.0.0-dev.59.0 <=2.0.0-dev.63.0"
+ dart: ">=2.0.0-dev.59.0 <=2.0.0-dev.63.0.flutter-4c9689c1d2"
diff --git a/tool/grind.dart b/tool/grind.dart
index 71603f3..3cb6104 100644
--- a/tool/grind.dart
+++ b/tool/grind.dart
@@ -50,7 +50,7 @@
final Memoizer tempdirsCache = new Memoizer();
/// Global so that the lock is retained for the life of the process.
-Future<Null> _lockFuture;
+Future<void> _lockFuture;
Completer<FlutterRepo> _cleanFlutterRepo;
/// Returns true if we need to replace the existing flutter. We never release
@@ -337,7 +337,7 @@
return await launcher.runStreamed(
Platform.resolvedExecutable,
[
- '--checked',
+ '--enable-asserts',
pathLib.join('bin', 'dartdoc.dart'),
'--output',
'${sdkDocsPath}',
@@ -361,7 +361,7 @@
return await launcher.runStreamed(
Platform.resolvedExecutable,
[
- '--checked',
+ '--enable-asserts',
pathLib.join(cwd, 'bin', 'dartdoc.dart'),
'--output',
outputDir,
@@ -520,7 +520,7 @@
new SubprocessLauncher('flutter${label == null ? "" : "-$label"}', env);
}
- Future<Null> _init() async {
+ Future<void> _init() async {
new Directory(flutterPath).createSync(recursive: true);
await launcher.runStreamed(
'git', ['clone', 'https://github.com/flutter/flutter.git', '.'],
@@ -605,7 +605,7 @@
await launcher.runStreamed(
Platform.resolvedExecutable,
[
- '--checked',
+ '--enable-asserts',
pathLib.join(Directory.current.absolute.path, 'bin', 'dartdoc.dart'),
'--json',
'--show-progress',
@@ -654,7 +654,8 @@
@Task('Rebuild generated files')
build() async {
var launcher = new SubprocessLauncher('build');
- await launcher.runStreamed(sdkBin('pub'), ['run', 'build_runner', 'build', '--delete-conflicting-outputs']);
+ await launcher.runStreamed(sdkBin('pub'),
+ ['run', 'build_runner', 'build', '--delete-conflicting-outputs']);
}
/// Paths in this list are relative to lib/.
@@ -677,7 +678,8 @@
}
}
- await launcher.runStreamed(sdkBin('pub'), ['run', 'build_runner', 'build', '--delete-conflicting-outputs']);
+ await launcher.runStreamed(sdkBin('pub'),
+ ['run', 'build_runner', 'build', '--delete-conflicting-outputs']);
for (String relPath in _generated_files_list) {
File newVersion = new File(pathLib.join('lib', relPath));
if (!await newVersion.exists()) {
@@ -707,8 +709,7 @@
@Task('Run all the tests.')
test() async {
- await testPreviewDart2();
- await testDart1();
+ await testDart2();
await testFutures.wait();
}
@@ -716,16 +717,16 @@
.listSync(recursive: true)
.where((e) => e is File && e.path.endsWith('.dart'))
.cast<File>()
- ..toList();
+ .toList();
List<File> get testFiles => new Directory('test')
.listSync(recursive: true)
.where((e) => e is File && e.path.endsWith('test.dart'))
.cast<File>()
- ..toList();
+ .toList();
-testPreviewDart2() async {
- List<String> parameters = ['--preview-dart-2', '--enable-asserts'];
+testDart2() async {
+ List<String> parameters = ['--enable-asserts'];
for (File dartFile in testFiles) {
await testFutures.addFuture(
@@ -749,35 +750,15 @@
}
}
-testDart1() async {
- List<String> parameters = ['--checked'];
- for (File dartFile in testFiles) {
- await testFutures.addFuture(
- new SubprocessLauncher('dart1-${pathLib.basename(dartFile.path)}')
- .runStreamed(
- Platform.resolvedExecutable,
- <String>[]
- ..addAll(parameters)
- ..add(dartFile.path)));
- }
-
- for (File dartFile in binFiles) {
- await testFutures.addFuture(new SubprocessLauncher(
- 'dart1-bin-${pathLib.basename(dartFile.path)}-help')
- .runStreamed(
- Platform.resolvedExecutable,
- <String>[]
- ..addAll(parameters)
- ..add(dartFile.path)
- ..add('--help')));
- }
-}
-
@Task('Generate docs for dartdoc')
testDartdoc() async {
var launcher = new SubprocessLauncher('test-dartdoc');
- await launcher.runStreamed(Platform.resolvedExecutable,
- ['--checked', 'bin/dartdoc.dart', '--output', dartdocDocsDir.path]);
+ await launcher.runStreamed(Platform.resolvedExecutable, [
+ '--enable-asserts',
+ 'bin/dartdoc.dart',
+ '--output',
+ dartdocDocsDir.path
+ ]);
expectFileContains(pathLib.join(dartdocDocsDir.path, 'index.html'),
['<title>dartdoc - Dart API docs</title>']);
final RegExp object = new RegExp('<li>Object</li>', multiLine: true);
@@ -793,7 +774,7 @@
'<a href="https://api.dartlang.org/(dev|stable)/[^/]*/dart-core/Object-class.html">Object</a>',
multiLine: true);
await launcher.runStreamed(Platform.resolvedExecutable, [
- '--checked',
+ '--enable-asserts',
'bin/dartdoc.dart',
'--link-to-remote',
'--output',
@@ -821,7 +802,7 @@
await flutterRepo.launcher.runStreamed(
Platform.resolvedExecutable,
[
- '--checked',
+ '--enable-asserts',
pathLib.join(Directory.current.path, 'bin', 'dartdoc.dart'),
'--json',
'--link-to-remote',
@@ -869,7 +850,7 @@
await launcher.runStreamed(
Platform.resolvedExecutable,
[
- '--checked',
+ '--enable-asserts',
pathLib.join('..', '..', 'bin', 'dartdoc.dart'),
'--auto-include-dependencies',
'--example-path-prefix',