com.toasttab.expediter.gradle.config.IgnoreSpec.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plugin Show documentation
Show all versions of plugin Show documentation
Check ABI compatibility at build time
package com.toasttab.expediter.gradle.config
import com.toasttab.expediter.ignore.Ignore
import org.slf4j.LoggerFactory
open class IgnoreSpec {
companion object {
private val LOGGER = LoggerFactory.getLogger(PlatformSpec::class.java)
}
var file: Any? = null
set(value) {
LOGGER.warn("file property is deprecated, use the file function instead: ignore { file('path') }")
value?.let(files::add)
}
val files = mutableListOf()
val ignores = mutableListOf()
fun file(file: Any) {
files.add(file)
}
fun targetStartsWith(vararg partial: String) = or(Ignore.TargetStartsWith(*partial))
fun callerStartsWith(vararg partial: String) = or(Ignore.CallerStartsWith(*partial))
fun or(ignore: Ignore) {
ignores.add(ignore)
}
fun buildIgnore() = if (ignores.isEmpty()) {
Ignore.NOTHING
} else if (ignores.size == 1) {
ignores[0]
} else {
Ignore.Or(*ignores.toTypedArray())
}
}