async def loose_classfiles(classpath_entry: ClasspathEntry, unzip_binary: UnzipBinary) -> LooseClassfiles: dest_dir = "dest" process_results = await MultiGet( Get( ProcessResult, Process( argv=[ unzip_binary.path, "-d", dest_dir, filename, ], output_directories=(dest_dir, ), description=f"Extract {filename}", immutable_input_digests=dict( ClasspathEntry.immutable_inputs([classpath_entry])), level=LogLevel.TRACE, ), ) for filename in ClasspathEntry.immutable_inputs_args([classpath_entry]) ) merged_digest = await Get( Digest, MergeDigests(pr.output_digest for pr in process_results)) return LooseClassfiles(await Get(Digest, RemovePrefix(merged_digest, dest_dir)))
def root_immutable_inputs_args(self, *, prefix: str = "") -> Iterator[str]: """Returns root relative filenames for the given entries to be used as immutable_inputs.""" return ClasspathEntry.immutable_inputs_args(self.entries, prefix=prefix)