Skip to content

Commit

Permalink
[ABI Validation] Minor improvements
Browse files Browse the repository at this point in the history
* Use the correct path delimiter in error messages
* Make Project.sourceSets helper internal and migrate from deprecated convention
Pull request Kotlin/binary-compatibility-validator#101
  • Loading branch information
ilya-g authored and shanshin committed Dec 3, 2024
1 parent c149b0e commit 40c2c39
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -203,8 +203,8 @@ private fun Project.configureKotlinCompilation(
configureCheckTasks(apiBuildDir, apiBuild, extension, targetConfig, commonApiDump, commonApiCheck)
}

val Project.sourceSets: SourceSetContainer
get() = convention.getPlugin(JavaPluginConvention::class.java).sourceSets
internal val Project.sourceSets: SourceSetContainer
get() = extensions.getByName("sourceSets") as SourceSetContainer

internal val Project.apiValidationExtensionOrNull: ApiValidationExtension?
get() =
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ open class KotlinApiCompareTask @Inject constructor(private val objects: ObjectF

var expectedApiDeclaration = apiBuildDirFiles.keys.single()
if (expectedApiDeclaration !in expectedApiFiles) {
error("File ${expectedApiDeclaration.lastName} is missing from ${projectApiDir.relativePath()}, please run " +
error("File ${expectedApiDeclaration.lastName} is missing from ${projectApiDir.relativeDirPath()}, please run " +
":$subject:apiDump task to generate one")
}
// Normalize case-sensitivity
@@ -108,8 +108,8 @@ open class KotlinApiCompareTask @Inject constructor(private val objects: ObjectF
}
}

private fun File.relativePath(): String {
return relativeTo(rootDir).toString() + "/"
private fun File.relativeDirPath(): String {
return toRelativeString(rootDir) + File.separator
}

private fun compareFiles(checkFile: File, builtFile: File): String? {

0 comments on commit 40c2c39

Please sign in to comment.