Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading classes from resulting jar #99

Merged
merged 5 commits into from Oct 20, 2022
Merged

Support reading classes from resulting jar #99

merged 5 commits into from Oct 20, 2022

Conversation

ilya-g
Copy link
Member

@ilya-g ilya-g commented Sep 28, 2022

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

…t hierarchy

If there's an ApiValidationExtension somewhere in the project or in its parent projects,
it uses its properties as defaults for the corresponding task properties.
It is still possible to instantiate a task without extension and to set or override properties
individually.
@ilya-g
Copy link
Member Author

ilya-g commented Oct 5, 2022

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.

@qwwdfsad
Copy link
Member

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

It allows to use the default task setup created by BCV plugin and only configure
input jar to switch to another source of classes.
@ilya-g
Copy link
Member Author

ilya-g commented Oct 18, 2022

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.

@qwwdfsad qwwdfsad self-requested a review October 19, 2022 12:26
Copy link
Member

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Do you want me to make a release with the PR or should I wait for a follow-up?

@ilya-g ilya-g merged commit 661e03c into master Oct 20, 2022
@qwwdfsad qwwdfsad deleted the input-jar branch October 20, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants