Interface BuildCacheManager

    • Method Detail

      • restoreCache

        boolean restoreCache​(@NotNull
                             String cacheName)
        Restores the contents (cached paths) and the metadata of a cache for the specified cacheName.
        Parameters:
        cacheName - the name of the cache to restore
        Returns:
        true if the cache was restored successfully
      • restoreCacheMetadataOnly

        boolean restoreCacheMetadataOnly​(@NotNull
                                         String cacheName)
        Restores the metadata of a cache without restoring the cache contents for the specified cacheName. This method should be called when only the metadata of the cache is needed, for example, for cache contents comparison when the cache will be published via registerCacheForPublishing(String, boolean, boolean) with isPublishOnlyChanged set to true.
        Parameters:
        cacheName - the name of the cache to restore the metadata for
        Returns:
        true if the cache metadata was restored successfully
      • registerCacheForPublishing

        void registerCacheForPublishing​(@NotNull
                                        String cacheName,
                                        boolean isPublishOnlyChanged,
                                        boolean isCalculateFilesChecksum)
        Registers the specific cache name for publishing at the end of the build. The actual publishing happens after all build steps of the build have finished. If isPublishOnlyChanged is set to true, the metadata of the current cache should be restored in advance by calling restoreCache(String) or restoreCacheMetadataOnly(String) (othewise it is impossible to detect changes).
        Parameters:
        cacheName - the name of the cache to publish
        isPublishOnlyChanged - when set to true the cache will be published only if its contents changed; cache metadata should be available in this case
        isCalculateFilesChecksum - indicates whether to calculate the checksum of cache contents
      • isCacheRegisteredForPublishing

        boolean isCacheRegisteredForPublishing​(@NotNull
                                               String cacheName)
        Checks if a cache was registered for publishing via registerCacheForPublishing(String, boolean, boolean).
        Parameters:
        cacheName - the name of the cache
        Returns:
        true if the cache is registered for publishing
      • addCachePathsForPublishingToRegisteredCache

        void addCachePathsForPublishingToRegisteredCache​(@NotNull
                                                         String cacheName,
                                                         @NotNull
                                                         List<String> cachePaths)
        Adds cache paths to be published in a specific build cache. The build cache with this name should be registered for publishing via registerCacheForPublishing(String, boolean, boolean) before calling this method.
        Parameters:
        cacheName - the name of the build cache
        cachePaths - the list of paths to include in the cache
      • addCachePathForPublishingToRegisteredCache

        void addCachePathForPublishingToRegisteredCache​(@NotNull
                                                        String cacheName,
                                                        @NotNull
                                                        String cachePath)
        Adds a single cache path to be published in a specific build cache. The build cache with this name should be registered for publishing via registerCacheForPublishing(String, boolean, boolean) before calling this method.
        Parameters:
        cacheName - the name of the build cache
        cachePath - the path to include in the cache
      • addCachePathForPublishingToRegisteredCache

        void addCachePathForPublishingToRegisteredCache​(@NotNull
                                                        String cacheName,
                                                        @NotNull
                                                        String cachePath,
                                                        @NotNull
                                                        Collection<String> exclusionRules,
                                                        @NotNull
                                                        Collection<String> inclusionRules)
        Adds a single cache path to be published in a specific build cache considering the rules for excluding/including specific directories or files under this cache path. The build cache with this name should be registered for publishing via registerCacheForPublishing(String, boolean, boolean) before calling this method.
        Parameters:
        cacheName - the name of the build cache
        cachePath - the path to include in the cache
        exclusionRules - the list of exclusion rules
        inclusionRules - the list of inclusion rules
      • addCachePathsForPublishing

        void addCachePathsForPublishing​(@NotNull
                                        String cacheName,
                                        boolean isPublishOnlyChanged,
                                        boolean isCalculateFilesChecksum,
                                        @NotNull
                                        List<String> cachePaths)
        Registers the cache for publishing (overriding isPublishOnlyChanged and isCalculateFilesChecksum if it has been registered already) and adds cache path for publishing to it. Basically, works as registerCacheForPublishing(String, boolean, boolean) and addCachePathsForPublishingToRegisteredCache(String, List) combined.
        Parameters:
        cacheName - the name of the cache to publish
        isPublishOnlyChanged - when set to true the cache will be published only if its contents changed; cache metadata should be available in this case
        isCalculateFilesChecksum - indicates whether to calculate the checksum of cache contents
        cachePaths - the list of paths to include in the cache