Skip to content

Commit 1305a6a

Browse files
authored
Removed configuration time check for plugin version (#258)
1 parent f1e2076 commit 1305a6a

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ public class BinaryCompatibilityValidatorPlugin : Plugin<Project> {
3838
for (project in ignored) {
3939
require(project in all) { "Cannot find excluded project $project in all projects: $all" }
4040
}
41-
if (extension.klib.enabled) {
42-
try {
43-
LibraryAbiReader.javaClass
44-
} catch (e: NoClassDefFoundError) {
45-
throw IllegalStateException(
46-
"KLib validation is not available. " +
47-
"Make sure the project uses at least Kotlin 1.9.20 or disable KLib validation " +
48-
"by setting apiValidation.klib.enabled to false", e
49-
)
50-
}
51-
}
5241
}
5342
}
5443

src/main/kotlin/KotlinKlibAbiBuildTask.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import org.gradle.api.file.RegularFileProperty
1111
import org.gradle.api.provider.Property
1212
import org.gradle.api.tasks.*
1313
import org.gradle.workers.WorkAction
14+
import org.jetbrains.kotlin.library.abi.ExperimentalLibraryAbiReader
15+
import org.jetbrains.kotlin.library.abi.LibraryAbiReader
1416

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

7880
internal abstract class KlibAbiBuildWorker : WorkAction<KlibAbiBuildParameters> {
79-
@OptIn(ExperimentalBCVApi::class)
81+
@OptIn(ExperimentalBCVApi::class, ExperimentalLibraryAbiReader::class)
8082
override fun execute() {
83+
try {
84+
LibraryAbiReader.javaClass
85+
} catch (e: NoClassDefFoundError) {
86+
error(
87+
"KLib validation is not available. " +
88+
"Make sure the project uses at least Kotlin 1.9.20 or disable KLib validation " +
89+
"by setting apiValidation.klib.enabled to false"
90+
)
91+
}
92+
8193
val outputFile = parameters.outputAbiFile.asFile.get()
8294
outputFile.delete()
8395
outputFile.parentFile.mkdirs()

0 commit comments

Comments
 (0)