Esempio n. 1
0
 def immutable_inputs(self,
                      *,
                      prefix: str = "") -> Iterator[tuple[str, Digest]]:
     """Returns (relpath, Digest) tuples for use with `Process.immutable_input_digests`."""
     return ClasspathEntry.immutable_inputs(ClasspathEntry.closure(
         self.entries),
                                            prefix=prefix)
Esempio n. 2
0
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)))