Skip to content

Commit

Permalink
Minor improvements (#101)
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
  • Loading branch information
ilya-g committed Oct 20, 2022
1 parent 661e03c commit 89c1b22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt
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
6 changes: 3 additions & 3 deletions src/main/kotlin/KotlinApiCompareTask.kt
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 89c1b22

Please sign in to comment.