Skip to content

Commit 89c1b22

Browse files
authored
Minor improvements (#101)
* Use the correct path delimiter in error messages * Make Project.sourceSets helper internal and migrate from deprecated convention
1 parent 661e03c commit 89c1b22

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ private fun Project.configureKotlinCompilation(
203203
configureCheckTasks(apiBuildDir, apiBuild, extension, targetConfig, commonApiDump, commonApiCheck)
204204
}
205205

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

209209
internal val Project.apiValidationExtensionOrNull: ApiValidationExtension?
210210
get() =

src/main/kotlin/KotlinApiCompareTask.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ open class KotlinApiCompareTask @Inject constructor(private val objects: ObjectF
9191

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

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

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

0 commit comments

Comments
 (0)