witty-crayon-22786
04/13/2018, 3:31 AM@rule(JVMImports, [Select(Snapshot)])
def extract_imports(snapshot):
# TODO
cmd = tuple(['/Users/stuhood/src/pants/extractimports'] + [f.path for f in snapshot.files])
result = yield Get(ExecuteProcessResult,
ExecuteProcessRequest(cmd, [], snapshot.fingerprint, snapshot.digest_length))
if result.exit_code:
raise Exception('Import extraction `{}` failed ({}):\n{}'.format(
' '.join(cmd), result.exit_code, result.stderr))
def packages():
matched = set()
for p in result.stdout.splitlines():
match = _PACKAGE_RE.match(p.strip())
if match:
yield JVMPackageName(match.group(1))
yield JVMImports(set(packages()))