bundletoolAvailableInOkaTools function

Future<bool> bundletoolAvailableInOkaTools({
  1. Directory? toolsDir,
})

True when a bundletool jar/wrapper sits under the oka tools dir (~/.oka/tools) — the doctor's presence signal for the AAB verification dependency (ADR-0004). toolsDir is injectable for tests.

Implementation

Future<bool> bundletoolAvailableInOkaTools({Directory? toolsDir}) async {
  final dir = toolsDir ?? defaultOkaToolsDir();
  if (!dir.existsSync()) return false;
  return dir.listSync().any(
        (e) => p.basename(e.path).startsWith('bundletool'),
      );
}