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

com.avito.test.gradle.plugin.PluginsSpec.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.PluginDependenciesSpec]
 * Use [plugins] to create an instance
 */
public class PluginsSpec(
    private val plugins: MutableList = mutableListOf()
) : GradleScriptCompatible {

    override fun getScriptRepresentation(): String {
        return """|plugins {
                  |    ${plugins.joinToString(separator = "\n    ") { it.getScriptRepresentation() }}
                  |}""".trimMargin()
    }

    override fun toString(): String = getScriptRepresentation()

    public fun id(id: String): PluginSpec {
        val spec = PluginSpec(id)
        plugins.add(spec)
        return spec
    }

    public fun plus(other: PluginsSpec): PluginsSpec {
        return PluginsSpec((this.plugins + other.plugins).toMutableList())
    }
}

public fun plugins(init: PluginsSpec.() -> Unit = {}): PluginsSpec {
    val plugins = PluginsSpec()
    plugins.init()
    return plugins
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy