Skip to content

Commit

Permalink
Change exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Oct 24, 2024
1 parent 8f3a03d commit 67bf2de
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions pkgs/firehose/lib/src/health/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,28 +217,36 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()}
path.relative(package.directory.path, from: directory.path);
var tempDirectory = Directory.systemTemp.createTempSync();
var reportPath = path.join(tempDirectory.path, 'leaks.json');
var arguments = [
...['pub', 'global', 'run'],
'dart_apitool:main',
'extract',
...['--input', relativePath],
...['--output', reportPath],
'--set-exit-on-missing-export',
];
var runApiTool = Process.runSync(
'dart',
[
...['pub', 'global', 'run'],
'dart_apitool:main',
'extract',
...['--input', relativePath],
...['--output', reportPath],
'--set-exit-on-missing-export',
],
arguments,
workingDirectory: directory.path,
);
log(runApiTool.stderr as String);
log(runApiTool.stdout as String);

var fullReportString = File(reportPath).readAsStringSync();
var decoded = jsonDecode(fullReportString) as Map<String, dynamic>;
var leaks = decoded['missingEntryPoints'] as List<dynamic>;
if (runApiTool.exitCode == 0) {
var fullReportString = await File(reportPath).readAsString();
var decoded = jsonDecode(fullReportString) as Map<String, dynamic>;
var leaks = decoded['missingEntryPoints'] as List<dynamic>;

log('Leaking symbols in API:\n$leaks');
if (leaks.isNotEmpty) {
leaksForPackage[package] = leaks.cast();
log('Leaking symbols in API:\n$leaks');
if (leaks.isNotEmpty) {
leaksForPackage[package] = leaks.cast();
}
} else {
throw ProcessException(
'Api tool finished with exit code ${runApiTool.exitCode}',
arguments,
);
}
}
return HealthCheckResult(
Expand Down

0 comments on commit 67bf2de

Please sign in to comment.