Skip to content

Commit

Permalink
Described a klib validation pipeline, fixed task names, improved erro…
Browse files Browse the repository at this point in the history
…r messages
  • Loading branch information
fzhinkin committed Feb 5, 2024
1 parent 0a2d44f commit cac5669
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ internal class KLibVerificationTests : BaseKotlinGradleTest() {
}

runner.buildAndFail().apply {
assertTaskFailure(":klibApiPrepareAbiForValidation")
assertTaskFailure(":klibApiExtractForValidation")
}
}

Expand Down Expand Up @@ -527,7 +527,7 @@ internal class KLibVerificationTests : BaseKotlinGradleTest() {
}

runner.buildAndFail().apply {
assertTaskFailure(":linuxArm64ApiInferAbiDump")
assertTaskFailure(":linuxArm64ApiInfer")
Assertions.assertThat(output).contains(
"The target linuxArm64 is not supported by the host compiler " +
"and there are no targets similar to linuxArm64 to infer a dump from it."
Expand Down Expand Up @@ -590,7 +590,7 @@ internal class KLibVerificationTests : BaseKotlinGradleTest() {

runner.buildAndFail().apply {
Assertions.assertThat(output).contains(
"KLib ABI dump/validation requires at least enabled klib target, but none were found."
"KLib ABI dump/validation requires at least one enabled klib target, but none were found."
)
}
}
Expand Down
106 changes: 72 additions & 34 deletions src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/kotlin/KotlinApiBuildTask.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 JetBrains s.r.o.
* Copyright 2016-2024 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/KotlinApiCompareTask.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 JetBrains s.r.o.
* Copyright 2016-2024 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/KotlinKlibAbiBuildTask.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 JetBrains s.r.o.
* Copyright 2016-2024 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

Expand Down Expand Up @@ -68,7 +68,7 @@ public abstract class KotlinKlibAbiBuildTask : BuildTaskBase() {
val parsedAbi = try {
LibraryAbiReader.readAbiInfo(klibFile.singleFile, filters)
} catch (e: Exception) {
throw IllegalStateException("Can't read a KLib: ${klibFile.singleFile}", e)
throw IllegalStateException("Can't read a klib: ${klibFile.singleFile}", e)
}

val supportedVersions = parsedAbi.signatureVersions.asSequence()
Expand All @@ -83,7 +83,7 @@ public abstract class KotlinKlibAbiBuildTask : BuildTaskBase() {
AbiSignatureVersion.resolveByVersionNumber(signatureVersion!!)
} else {
supportedVersions.maxByOrNull(AbiSignatureVersion::versionNumber)
?: throw IllegalStateException("Can't choose abiSignatureVersion")
?: throw IllegalStateException("Can't choose signatureVersion")
}

outputApiFile.bufferedWriter().use {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public abstract class KotlinKlibExtractSupportedTargetsAbiTask : DefaultTask() {
if (targetsToRemove.isNotEmpty() && strictValidation) {
throw IllegalStateException(
"Validation could not be performed as some targets are not available " +
"and the strictValidation mode was enabled"
"and the strictValidation mode was enabled."
)
}
for (target in targetsToRemove) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/KotlinKlibInferAbiForUnsupportedTargetTask.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 JetBrains s.r.o.
* Copyright 2016-2024 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

Expand Down Expand Up @@ -105,10 +105,10 @@ public abstract class KotlinKlibInferAbiForUnsupportedTargetTask : DefaultTask()
}

logger.warn(
"An ABI dump for target $unsupportedTarget was inferred from the ABI generated for target " +
"[${matchingTargets.joinToString(",")}] " +
"as the former target is not supported by the host compiler. " +
"Inferred dump may not reflect actual ABI for the target $unsupportedTarget. " +
"An ABI dump for target $unsupportedTarget was inferred from the ABI generated for the following targets " +
"as the former target is not supported by the host compiler: " +
"[${matchingTargets.joinToString(",")}]. " +
"Inferred dump may not reflect an actual ABI for the target $unsupportedTarget. " +
"It is recommended to regenerate the dump on the host supporting all required compilation target."
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/KotlinKlibMergeAbiTask.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 JetBrains s.r.o.
* Copyright 2016-2024 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

Expand Down

0 comments on commit cac5669

Please sign in to comment.