Skip to content

Commit

Permalink
Removed configuration time check for plugin version (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshin authored Jul 19, 2024
1 parent f1e2076 commit 1305a6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
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

0 comments on commit 1305a6a

Please sign in to comment.