All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.tinkoff.plugins.buildmetrics.gradle.internal.utils.ConfigurationCacheData.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC2
Show newest version
package ru.tinkoff.plugins.buildmetrics.gradle.internal.utils

import org.gradle.internal.configurationcache.ConfigurationCacheLoadBuildOperationType
import org.gradle.internal.configurationcache.ConfigurationCacheStoreBuildOperationType
import ru.tinkoff.plugins.buildmetrics.api.builds.internal.BuildOperationData

internal class ConfigurationCacheData(
    val loaded: Boolean,
    val stored: Boolean,
    val reused: Boolean,
) {

    internal class Builder {

        private var loaded: Boolean = false

        private var stored: Boolean = false

        fun onBuildOperationData(data: BuildOperationData) {
            when (data.details) {
                is ConfigurationCacheLoadBuildOperationType.Details -> {
                    loaded = true
                }

                is ConfigurationCacheStoreBuildOperationType.Details -> {
                    stored = true
                }
            }
        }

        fun build(): ConfigurationCacheData = ConfigurationCacheData(
            loaded = loaded,
            stored = stored,
            reused = loaded && stored.not(),
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy