Skip to content

Removed configuration time check for plugin version #258

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

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ public class BinaryCompatibilityValidatorPlugin : Plugin<Project> {
for (project in ignored) {
require(project in all) { "Cannot find excluded project $project in all projects: $all" }
}
if (extension.klib.enabled) {
try {
LibraryAbiReader.javaClass
} catch (e: NoClassDefFoundError) {
throw IllegalStateException(
"KLib validation is not available. " +
"Make sure the project uses at least Kotlin 1.9.20 or disable KLib validation " +
"by setting apiValidation.klib.enabled to false", e
)
}
}
}
}

Expand Down
14 changes: 13 additions & 1 deletion src/main/kotlin/KotlinKlibAbiBuildTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.workers.WorkAction
import org.jetbrains.kotlin.library.abi.ExperimentalLibraryAbiReader
import org.jetbrains.kotlin.library.abi.LibraryAbiReader

/**
* Generates a text file with a KLib ABI dump for a single klib.
Expand Down Expand Up @@ -76,8 +78,18 @@ internal interface KlibAbiBuildParameters : BuildParametersBase {
}

internal abstract class KlibAbiBuildWorker : WorkAction<KlibAbiBuildParameters> {
@OptIn(ExperimentalBCVApi::class)
@OptIn(ExperimentalBCVApi::class, ExperimentalLibraryAbiReader::class)
override fun execute() {
try {
LibraryAbiReader.javaClass
} catch (e: NoClassDefFoundError) {
error(
"KLib validation is not available. " +
"Make sure the project uses at least Kotlin 1.9.20 or disable KLib validation " +
"by setting apiValidation.klib.enabled to false"
)
}

val outputFile = parameters.outputAbiFile.asFile.get()
outputFile.delete()
outputFile.parentFile.mkdirs()
Expand Down