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 13, 2024
1 parent 56902c5 commit 8010563
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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? {
Expand Down

0 comments on commit 8010563

Please sign in to comment.