Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output-size info to the '--stats' flag on various tasks. #3879

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tool/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ Future<Iterable<Map<String, Object?>>> _docSdk({
var launcher = SubprocessLauncher('build-sdk-docs');
await launcher
.runStreamedDartCommand(['pub', 'get'], workingDirectory: dartdocPath);
return await launcher.runStreamedDartCommand(
var output = await launcher.runStreamedDartCommand(
[
'--enable-asserts',
path.join('bin', 'dartdoc.dart'),
Expand All @@ -587,6 +587,19 @@ Future<Iterable<Map<String, Object?>>> _docSdk({
workingDirectory: dartdocPath,
withStats: withStats,
);
if (withStats && (Platform.isLinux || Platform.isMacOS)) {
var diskUsageResult = Process.runSync('du', ['-sh', sdkDocsPath]);
// Output looks like
// 146M /var/folders/72/ltck4q353hsg3bn8kpkg7f84005w15/T/sdkdocsHcquiB
var diskUsageNumber =
(diskUsageResult.stdout as String).trim().split(RegExp('\\s+')).first;

// Prints all files in `sdkDocsPath`, newline-separated.
var findResult = Process.runSync('find', [sdkDocsPath, '-type', 'f']);
var fileCount = (findResult.stdout as String).split('\n').length;
print('Generated $fileCount files amounting to $diskUsageNumber.');
}
return output;
}

/// Creates a clean version of dartdoc (based on the current directory, assumed
Expand Down