binary-compatibility-validator icon indicating copy to clipboard operation
binary-compatibility-validator copied to clipboard

Support reading classes from resulting jar

Open ilya-g opened this issue 3 years ago • 1 comments

... 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) }
}

ilya-g avatar Sep 28 '22 11:09 ilya-g

Two more questions:

  • what is the purpose of inputDependencies property? It seems not used in the task action. Can it be made optional?
  • can we make Project.sourceSets extension val internal? Due to being public, it leaks into client scripts and could cause some mess.

ilya-g avatar Oct 05 '22 15:10 ilya-g

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

qwwdfsad avatar Oct 18 '22 09:10 qwwdfsad

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.

ilya-g avatar Oct 18 '22 20:10 ilya-g