flutter/dev/devicelab/bin/tasks/dartdocs.dart
Alexander Aprelev 2f8474f9aa
Roll engine to b6df7a637498ca9beda1fa9cd7210e3202ea599f. (#15444)
* Roll engine to b6df7a637498ca9beda1fa9cd7210e3202ea599f.

Changes since last roll:
```
b6df7a637 Roll dart to 290c576264faa096a0b3206c71b2435309d9f904. (#4771)
a6764dbd5 Add sources for Fuchsia target. (#4763)
2d5900615 [fuchsia] Remove unused header file. (#4769)
9717063b7 Revert "Roll dart to c080951d45e79cd25df98036c4be835b284a269c. (#4767)" (#4768)
9a9814312 Roll dart to c080951d45e79cd25df98036c4be835b284a269c. (#4767)
e74e8b35c [async] Update includes of async headers to new path (#4760)
e2c4b2760 Use Dart 2 camel case constants in the engine Dart libraries (#4766)
9c1e48434 Updates for Fuchsia roll. (#4765)
14c940e27 Switch from fxl::Mutex to std::mutex (#4764)
debf82c0b Roll Garnet (#4759)
5bffdefbb Use weak pointers to the accesibility bridge from objects vended to the UIKit accessibility framework. (#4761)
```
2018-03-12 15:44:25 -07:00

60 lines
2.3 KiB
Dart

// Copyright 2017 The Chromium Authors. 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 'dart:convert';
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<Null> main() async {
await task(() async {
final Stopwatch clock = new Stopwatch()..start();
final Process analysis = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['analyze', '--no-preamble', '--no-congratulate', '--flutter-repo', '--dartdocs'],
workingDirectory: flutterDirectory.path,
);
int publicMembers = 0;
int otherErrors = 0;
int otherLines = 0;
await for (String entry in analysis.stderr.transform(utf8.decoder).transform(const LineSplitter())) {
print('analyzer stderr: $entry');
if (entry.startsWith('[lint] Document all public members')) {
publicMembers += 1;
} else if (entry.startsWith('[')) {
otherErrors += 1;
} else if (entry.startsWith('(Ran in ')) {
// ignore this line
} else {
otherLines += 1;
}
}
await for (String entry in analysis.stdout.transform(utf8.decoder).transform(const LineSplitter())) {
print('analyzer stdout: $entry');
if (entry == 'Building flutter tool...') {
// ignore this line
} else {
otherLines += 1;
}
}
final int result = await analysis.exitCode;
clock.stop();
if (publicMembers == 0 && otherErrors == 0 && result != 0)
throw new Exception('flutter analyze exited with unexpected error code $result');
if (publicMembers != 0 && otherErrors != 0 && result == 0)
throw new Exception('flutter analyze exited with successful status code despite reporting errors');
if (otherLines != 0)
throw new Exception('flutter analyze had unexpected output (we saw $otherLines unexpected line${ otherLines == 1 ? "" : "s" })');
final Map<String, dynamic> data = <String, dynamic>{
'members_missing_dartdocs': publicMembers,
'analysis_errors': otherErrors,
'elapsed_time_ms': clock.elapsedMilliseconds,
};
return new TaskResult.success(data, benchmarkScoreKeys: data.keys.toList());
});
}