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

com.avito.test.summary.TestSummaryTask.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

There is a newer version: 2022.1
Show newest version
package com.avito.test.summary

import com.avito.logger.GradleLoggerFactory
import com.avito.report.ReportsApi
import com.avito.report.model.ReportCoordinates
import com.avito.report.model.Team
import com.avito.slack.SlackClient
import com.avito.slack.model.SlackChannel
import org.gradle.api.DefaultTask
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction

abstract class TestSummaryTask : DefaultTask() {

    @get:Input
    abstract val reportCoordinates: Property

    @get:Input
    abstract val summaryChannel: Property

    @get:Input
    abstract val buildUrl: Property

    @Suppress("UnstableApiUsage")
    @get:Input
    abstract val unitToChannelMapping: MapProperty

    @get:Input
    abstract val mentionOnFailures: SetProperty

    @get:Input
    abstract val reserveSlackChannel: Property

    @get:Input
    abstract val slackUserName: Property

    @get:Internal
    abstract val slackClient: Property

    @get:Internal
    abstract val reportsApi: Property

    @get:Internal
    abstract val reportViewerUrl: Property

    @TaskAction
    fun doWork() {
        val testSummarySender: TestSummarySender = TestSummarySenderImpl(
            slackClient = slackClient.get(),
            reportViewerUrl = reportViewerUrl.get(),
            reportsApi = reportsApi.get(),
            loggerFactory = GradleLoggerFactory.fromTask(this),
            buildUrl = buildUrl.get(),
            reportCoordinates = reportCoordinates.get(),
            globalSummaryChannel = summaryChannel.get(),
            unitToChannelMapping = unitToChannelMapping.get(),
            mentionOnFailures = mentionOnFailures.get(),
            slackUserName = slackUserName.get()
        )

        testSummarySender.send()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy