当前位置: 首页>>代码示例>>Java>>正文


Java BuildCacheEntryWriter类代码示例

本文整理汇总了Java中org.gradle.caching.BuildCacheEntryWriter的典型用法代码示例。如果您正苦于以下问题:Java BuildCacheEntryWriter类的具体用法?Java BuildCacheEntryWriter怎么用?Java BuildCacheEntryWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BuildCacheEntryWriter类属于org.gradle.caching包,在下文中一共展示了BuildCacheEntryWriter类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(final BuildCacheKey key, final BuildCacheEntryWriter result) throws BuildCacheException {
    persistentCache.useCache("store build cache entry", new Runnable() {
        @Override
        public void run() {
            File file = getFile(key.getHashCode());
            try {
                Closer closer = Closer.create();
                OutputStream output = closer.register(new FileOutputStream(file));
                try {
                    result.writeTo(output);
                } finally {
                    closer.close();
                }
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:LocalDirectoryBuildCache.java

示例2: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(BuildCacheKey key, BuildCacheEntryWriter writer) {
  logger.info("Start storing cache entry '{}' in S3 bucket", key.getHashCode());
  ObjectMetadata meta = new ObjectMetadata();
  meta.setContentType(BUILD_CACHE_CONTENT_TYPE);

  try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
    writer.writeTo(os);
    meta.setContentLength(os.size());
    try (InputStream is = new ByteArrayInputStream(os.toByteArray())) {
        PutObjectRequest request = getPutObjectRequest(key, meta, is);
        if(this.reducedRedundancy) {
          request.withStorageClass(StorageClass.ReducedRedundancy);
        }
        s3.putObject(request);
    }
  } catch (IOException e) {
    throw new BuildCacheException("Error while storing cache object in S3 bucket", e);
  }
}
 
开发者ID:myniva,项目名称:gradle-s3-build-cache,代码行数:21,代码来源:AwsS3BuildCacheService.java

示例3: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(BuildCacheKey buildCacheKey, BuildCacheEntryWriter buildCacheEntryWriter)
    throws BuildCacheException {
  Blob blob = cloudStorage.get(cacheKeyToBlobId(buildCacheKey));
  if (blob == null || !blob.exists()) {
    blob =
        cloudStorage.create(
            BlobInfo.newBuilder(cacheKeyToBlobId(buildCacheKey))
                .setContentType(BUILD_CACHE_CONTENT_TYPE)
                .build());
  }
  try (OutputStream os = Channels.newOutputStream(blob.writer())) {
    buildCacheEntryWriter.writeTo(os);
  } catch (IOException e) {
    throw new UncheckedIOException("Error writing file from cloud storage.", e);
  }
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:18,代码来源:CloudStorageBuildCacheService.java

示例4: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(BuildCacheKey key, BuildCacheEntryWriter writer) throws BuildCacheException {
    if (stageCacheEntries) {
        delegate.store(key, new StagingBuildCacheEntryWriter(writer, temporaryFileProvider));
    } else {
        delegate.store(key, writer);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:StagingBuildCacheDecorator.java

示例5: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(BuildCacheKey key, BuildCacheEntryWriter writer) throws BuildCacheException {
    try {
        LOGGER.debug("storing cache key {}", key);
        delegate.store(key, writer);
    } catch (BuildCacheException e) {
        LOGGER.warn("Could not store cache entry for cache key {}", key, e);
        throw e;
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:LoggingBuildCacheDecorator.java

示例6: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(BuildCacheKey key, BuildCacheEntryWriter writer) throws BuildCacheException {
    try {
        delegate.store(key, writer);
    } catch (BuildCacheException e) {
        // Assume its OK to not push anything.
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:LenientBuildCacheDecorator.java

示例7: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(BuildCacheKey key, BuildCacheEntryWriter writer) throws BuildCacheException {
    if (enabled.get()) {
        try {
            delegate.store(key, writer);
        } catch (BuildCacheException e) {
            recordFailure();
            throw e;
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:ShortCircuitingErrorHandlerBuildCacheDecorator.java

示例8: store

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
@Override
public void store(BuildCacheKey key, final BuildCacheEntryWriter output) throws BuildCacheException {
    final URI uri = root.resolve(key.getHashCode());
    HttpPut httpPut = new HttpPut(uri);
    httpPut.setEntity(new AbstractHttpEntity() {
        @Override
        public boolean isRepeatable() {
            return true;
        }

        @Override
        public long getContentLength() {
            return -1;
        }

        @Override
        public InputStream getContent() throws IOException, UnsupportedOperationException {
            throw new UnsupportedOperationException();
        }

        @Override
        public void writeTo(OutputStream outstream) throws IOException {
            output.writeTo(outstream);
        }

        @Override
        public boolean isStreaming() {
            return false;
        }
    });
    CloseableHttpResponse response = null;
    try {
        response = httpClient.execute(httpPut);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Response for PUT {}: {}", safeUri(uri), response.getStatusLine());
        }
        // TODO: We should examine the status to make sure the PUT was successful
    } catch (IOException e) {
        // TODO: We should consider different types of exceptions as fatal/recoverable.
        // Right now, everything is considered recoverable.
        throw new BuildCacheException(String.format("storing key '%s' in %s", key, getDescription()), e);
    } finally {
        HttpClientUtils.closeQuietly(response);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:46,代码来源:HttpBuildCache.java

示例9: StagingBuildCacheEntryWriter

import org.gradle.caching.BuildCacheEntryWriter; //导入依赖的package包/类
private StagingBuildCacheEntryWriter(BuildCacheEntryWriter writer, TemporaryFileProvider temporaryFileProvider) {
    this.writer = writer;
    this.temporaryFileProvider = temporaryFileProvider;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:StagingBuildCacheDecorator.java


注:本文中的org.gradle.caching.BuildCacheEntryWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。