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

com.avito.test.gradle.plugin.PluginSpec.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

There is a newer version: 2024.32
Show newest version
package com.avito.test.gradle.plugin

import com.avito.test.gradle.dependencies.GradleScriptCompatible

/**
 * Analogue of [org.gradle.plugin.use.PluginDependencySpec].
 * Use [plugin] or [PluginsSpec.id] to create an instance
 */
public class PluginSpec(
    public val id: String
) : GradleScriptCompatible {

    public var version: String? = null
        private set
    public var apply: Boolean = true
        private set

    public fun version(version: String?): PluginSpec {
        this.version = version
        return this
    }

    public fun apply(apply: Boolean): PluginSpec {
        this.apply = apply
        return this
    }

    override fun getScriptRepresentation(): String {
        return buildString {
            append("id(\"$id\")")
            if (version != null) {
                append(" version(\"$version\")")
            }
            if (!apply) {
                append(" apply(false)")
            }
        }
    }

    override fun toString(): String = getScriptRepresentation()
}

public fun plugin(id: String): PluginSpec = PluginSpec(id)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy