ru.tinkoff.plugins.buildmetrics.gradle.labels.BuildResultLabelsFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of build-metrics-gradle Show documentation
Show all versions of build-metrics-gradle Show documentation
Extension for tinkoff build metrics gradle plugin.
package ru.tinkoff.plugins.buildmetrics.gradle.labels
import org.gradle.api.flow.BuildWorkResult
import ru.tinkoff.plugins.buildmetrics.api.builds.BuildWorkResultListener
import ru.tinkoff.plugins.buildmetrics.api.factories.Factory
import ru.tinkoff.plugins.buildmetrics.api.labels.Label
import kotlin.jvm.optionals.getOrNull
/**
* Labels:
* - gradle_build_success;
*/
class BuildResultLabelsFactory : Factory.Labels, BuildWorkResultListener {
@Transient
private var failure: String? = null
override fun reinitialize() {
failure = null
}
override fun onBuildWorkResult(result: BuildWorkResult) {
result.failure.getOrNull()?.let { buildFailure ->
failure = buildFailure.toString()
}
}
override fun create(): List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy