@Override public CachedLayer call() throws IOException, CacheCorruptedException { String description = "Building " + layerType + " layer"; buildConfiguration.getEventDispatcher().dispatch(LogEvent.progress(description + "...")); try (ProgressEventDispatcher ignored = progressEventDispatcherFactory.create( BuildStepType.BUILD_AND_CACHE_APPLICATION_LAYER, "building " + layerType + " layer", 1); TimerEventDispatcher ignored2 = new TimerEventDispatcher(buildConfiguration.getEventDispatcher(), description)) { Cache cache = buildConfiguration.getApplicationLayersCache(); // Don't build the layer if it exists already. Optional<CachedLayer> optionalCachedLayer = cache.retrieve(layerConfiguration.getLayerEntries()); if (optionalCachedLayer.isPresent()) { return optionalCachedLayer.get(); } Blob layerBlob = new ReproducibleLayerBuilder(layerConfiguration.getLayerEntries()).build(); CachedLayer cachedLayer = cache.writeUncompressedLayer(layerBlob, layerConfiguration.getLayerEntries()); buildConfiguration .getEventDispatcher() .dispatch(LogEvent.debug(description + " built " + cachedLayer.getDigest())); return cachedLayer; } }
@Override public CachedLayer call() throws IOException, CacheCorruptedException { String description = "Building " + layerType + " layer"; buildConfiguration.getEventDispatcher().dispatch(LogEvent.progress(description + "...")); try (ProgressEventDispatcher ignored = progressEventDispatcherFactory.create("building " + layerType + " layer", 1); TimerEventDispatcher ignored2 = new TimerEventDispatcher(buildConfiguration.getEventDispatcher(), description)) { Cache cache = buildConfiguration.getApplicationLayersCache(); // Don't build the layer if it exists already. Optional<CachedLayer> optionalCachedLayer = cache.retrieve(layerConfiguration.getLayerEntries()); if (optionalCachedLayer.isPresent()) { return optionalCachedLayer.get(); } Blob layerBlob = new ReproducibleLayerBuilder(layerConfiguration.getLayerEntries()).build(); CachedLayer cachedLayer = cache.writeUncompressedLayer(layerBlob, layerConfiguration.getLayerEntries()); buildConfiguration .getEventDispatcher() .dispatch(LogEvent.debug(description + " built " + cachedLayer.getDigest())); return cachedLayer; } }
@Override public CachedLayer call() throws IOException, CacheCorruptedException { String description = "Building " + layerType + " layer"; buildConfiguration.getEventDispatcher().dispatch(LogEvent.progress(description + "...")); try (ProgressEventDispatcher ignored = progressEventDispatcherFactory.create("building " + layerType + " layer", 1); TimerEventDispatcher ignored2 = new TimerEventDispatcher(buildConfiguration.getEventDispatcher(), description)) { Cache cache = buildConfiguration.getApplicationLayersCache(); // Don't build the layer if it exists already. Optional<CachedLayer> optionalCachedLayer = cache.retrieve(layerConfiguration.getLayerEntries()); if (optionalCachedLayer.isPresent()) { return optionalCachedLayer.get(); } Blob layerBlob = new ReproducibleLayerBuilder(layerConfiguration.getLayerEntries()).build(); CachedLayer cachedLayer = cache.writeUncompressedLayer(layerBlob, layerConfiguration.getLayerEntries()); buildConfiguration .getEventDispatcher() .dispatch(LogEvent.debug(description + " built " + cachedLayer.getDigest())); return cachedLayer; } }