fixtureAnnotationsZip function

String? fixtureAnnotationsZip(
  1. Directory dir
)

Packs fixtures/java/basic/annotations (external annotations in the annotations.zip layout) into <dir>/annotations.zip with the JDK's jar tool. Returns null when jar is unavailable.

Implementation

String? fixtureAnnotationsZip(Directory dir) {
  final src = p.join(
    findRepoRoot(),
    'fixtures',
    'java',
    'basic',
    'annotations',
  );
  final out = p.join(dir.path, 'annotations.zip');
  try {
    final r = Process.runSync('jar', [
      '--create',
      '--no-manifest',
      '--file',
      out,
      '-C',
      src,
      '.',
    ]);
    return r.exitCode == 0 ? out : null;
  } on ProcessException {
    return null;
  }
}