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

com.bugsnag.android.gradle.internal.VariantTaskCompanion.kt Maven / Gradle / Ivy

There is a newer version: 8.1.0
Show newest version
package com.bugsnag.android.gradle.internal

import com.android.build.api.variant.VariantOutput
import com.android.build.api.variant.impl.VariantOutputImpl
import com.android.build.gradle.api.BaseVariantOutput
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskProvider

internal interface VariantTaskCompanion {
    fun taskNameFor(variantOutputName: String): String
    fun taskNameFor(output: BaseVariantOutput): String = taskNameFor(output.name)
    fun taskNameFor(output: VariantOutput): String =
        taskNameFor((output as VariantOutputImpl).baseName)
}

internal inline fun  VariantTaskCompanion.register(
    project: Project,
    output: BaseVariantOutput,
    noinline configure: T.() -> Unit
) = project.tasks.register(taskNameFor(output), configure)

internal inline fun  VariantTaskCompanion.register(
    project: Project,
    output: VariantOutput,
    noinline configure: T.() -> Unit
) = project.tasks.register(taskNameFor(output), configure)

internal inline fun  VariantTaskCompanion.forBuildOutput(
    project: Project,
    output: BaseVariantOutput
): TaskProvider {
    return project.tasks
        .withType(T::class.java)
        .named(taskNameFor(output))
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy