Search in sources :

Example 1 with FetchSourceFilesResponse

use of com.facebook.buck.distributed.thrift.FetchSourceFilesResponse in project buck by facebook.

the class DistBuildService method fetchSourceFile.

public InputStream fetchSourceFile(String hashCode) throws IOException {
    FrontendRequest request = createFetchSourceFileRequest(hashCode);
    FrontendResponse response = makeRequestChecked(request);
    Preconditions.checkState(response.isSetFetchSourceFilesResponse());
    Preconditions.checkState(response.getFetchSourceFilesResponse().isSetFiles());
    FetchSourceFilesResponse fetchSourceFilesResponse = response.getFetchSourceFilesResponse();
    Preconditions.checkState(1 == fetchSourceFilesResponse.getFilesSize());
    FileInfo file = fetchSourceFilesResponse.getFiles().get(0);
    Preconditions.checkState(file.isSetContent());
    return new ByteArrayInputStream(file.getContent());
}
Also used : FetchSourceFilesResponse(com.facebook.buck.distributed.thrift.FetchSourceFilesResponse) FileInfo(com.facebook.buck.distributed.thrift.FileInfo) ByteArrayInputStream(java.io.ByteArrayInputStream) FrontendResponse(com.facebook.buck.distributed.thrift.FrontendResponse) FrontendRequest(com.facebook.buck.distributed.thrift.FrontendRequest)

Aggregations

FetchSourceFilesResponse (com.facebook.buck.distributed.thrift.FetchSourceFilesResponse)1 FileInfo (com.facebook.buck.distributed.thrift.FileInfo)1 FrontendRequest (com.facebook.buck.distributed.thrift.FrontendRequest)1 FrontendResponse (com.facebook.buck.distributed.thrift.FrontendResponse)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1