Revert "Track number of package dependencies in Flutter" (#20774)
* Revert "Deprecated CupertinoDialog in favor of a new widget called CupertinoP… (#20649)" This reverts commit 3a4ae280e3a4af0f93709bac7a87a1ce5445533a. * Revert "Feature pesto new recipes (#19415)" This reverts commit e2f3b3d6f2c164975c0ec0d81345c9f603cd2d44. * Revert "Use markdown table (#20721)" This reverts commit 82d43b952ac3fc8c412c850f105710e55e6df565. * Revert "Documentation regarding tap gesture callbacks (#20647)" This reverts commit 3acc2785219e61cba73dc5540a9a50360d7716f0. * Revert "Add branch to footer information in flutter docs (#20711)" This reverts commit 9118d3d715bf2f3407a1146b7c6585abe7d031a5. * Revert "Performance test cleanup (#20652)" This reverts commit 1993a67381f03a8d472da687cd2c1582e9f788a1. * Revert "Track number of package dependencies in Flutter (#20722)" This reverts commit 03d6f18f4a900e0e7f94060b54042365b00ad069.
This commit is contained in:
parent
3a4ae280e3
commit
809721d0ee
@ -43,51 +43,24 @@ Future<double> findCostsForFile(File file) async {
|
||||
return total;
|
||||
}
|
||||
|
||||
Future<double> findCostsForRepo() async {
|
||||
final Process git = await startProcess(
|
||||
'git',
|
||||
<String>['ls-files', '--full-name', flutterDirectory.path],
|
||||
workingDirectory: flutterDirectory.path,
|
||||
);
|
||||
double total = 0.0;
|
||||
await for (String entry in git.stdout.transform(utf8.decoder).transform(const LineSplitter()))
|
||||
total += await findCostsForFile(new File(path.join(flutterDirectory.path, entry)));
|
||||
final int gitExitCode = await git.exitCode;
|
||||
if (gitExitCode != 0)
|
||||
throw new Exception('git exit with unexpected error code $gitExitCode');
|
||||
return total;
|
||||
}
|
||||
|
||||
Future<int> countDependencies() async {
|
||||
final Process subprocess = await startProcess(
|
||||
'flutter',
|
||||
<String>['update-packages', '--transitive-closure'],
|
||||
workingDirectory: flutterDirectory.path,
|
||||
);
|
||||
final List<String> lines = await subprocess.stdout.transform(utf8.decoder).transform(const LineSplitter()).toList();
|
||||
final int subprocessExitCode = await subprocess.exitCode;
|
||||
if (subprocessExitCode != 0)
|
||||
throw new Exception('flutter exit with unexpected error code $subprocessExitCode');
|
||||
final int count = lines.where((String line) => line.contains('->')).length;
|
||||
if (count < 2) // we'll always have flutter and flutter_test, at least...
|
||||
throw new Exception('"flutter update-packages --transitive-closure" returned bogus output:\n${lines.join("\n")}');
|
||||
return count;
|
||||
}
|
||||
|
||||
const String _kCostBenchmarkKey = 'technical_debt_in_dollars';
|
||||
const String _kNumberOfDependenciesKey = 'dependencies_count';
|
||||
const String _kBenchmarkKey = 'technical_debt_in_dollars';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(() async {
|
||||
final Process git = await startProcess(
|
||||
'git',
|
||||
<String>['ls-files', '--full-name', flutterDirectory.path],
|
||||
workingDirectory: flutterDirectory.path,
|
||||
);
|
||||
double total = 0.0;
|
||||
await for (String entry in git.stdout.transform(utf8.decoder).transform(const LineSplitter()))
|
||||
total += await findCostsForFile(new File(path.join(flutterDirectory.path, entry)));
|
||||
final int gitExitCode = await git.exitCode;
|
||||
if (gitExitCode != 0)
|
||||
throw new Exception('git exit with unexpected error code $gitExitCode');
|
||||
return new TaskResult.success(
|
||||
<String, dynamic>{
|
||||
_kCostBenchmarkKey: await findCostsForRepo(),
|
||||
_kNumberOfDependenciesKey: await countDependencies(),
|
||||
},
|
||||
benchmarkScoreKeys: <String>[
|
||||
_kCostBenchmarkKey,
|
||||
_kNumberOfDependenciesKey,
|
||||
],
|
||||
<String, dynamic>{_kBenchmarkKey: total},
|
||||
benchmarkScoreKeys: <String>[_kBenchmarkKey],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user