binary-compatibility-validator
binary-compatibility-validator copied to clipboard
Support reading classes from resulting jar
... and allow configuring tasks without link to ApiValidationExtension
An example of using manually configured tasks in a project without applying the plugin:
plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version ... apply false
}
tasks {
val apiBuildDir = file("build/api")
val apiReferenceDir = file("api")
val apiBuild by registering(KotlinApiBuildTask::class) {
outputApiDir = apiBuildDir
inputJar.value(jar.flatMap { it.archiveFile })
inputDependencies = files()
}
val apiDump by registering(Sync::class) {
dependsOn(apiBuild)
from(apiBuildDir)
into(apiReferenceDir)
}
val apiCompare by registering(KotlinApiCompareTask::class) {
dependsOn(apiBuild)
compareApiDumps(apiReferenceDir, apiBuildDir)
}
check { dependsOn(apiCompare) }
}
Two more questions:
- what is the purpose of
inputDependenciesproperty? It seems not used in the task action. Can it be made optional? - can we make
Project.sourceSetsextension val internal? Due to being public, it leaks into client scripts and could cause some mess.
what is the purpose of inputDependencies property? It seems not used in the task action. Can it be made optional?
Yes, it can be. It is required to manually track compilations output and react on its changes even if the corresponding dependent task hasn't been launched
can we make Project.sourceSets extension val internal?
Sure
I've added a test and a readme section.
I'm going to make the other improvements (e.g. making Project.sourceSets internal) in a further PR.