diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaPlugin.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaPlugin.kt index c30fc181936..313092dd7aa 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaPlugin.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaPlugin.kt @@ -8,6 +8,7 @@ import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.withType import org.gradle.util.GradleVersion import org.jetbrains.dokka.DokkaDefaults +import java.util.Locale open class DokkaPlugin : Plugin { override fun apply(project: Project) { @@ -106,7 +107,7 @@ open class DokkaPlugin : Plugin { private fun Project.configureEachAbstractDokkaTask() { tasks.withType().configureEach { - val formatClassifier = name.removePrefix("dokka").decapitalize() + val formatClassifier = name.removePrefix("dokka").replaceFirstChar { it.lowercase(Locale.getDefault()) } outputDirectory.convention(project.layout.buildDirectory.dir("dokka/$formatClassifier")) cacheRoot.set(DokkaDefaults.cacheRoot) } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/dokkaDefaultOutputDirectory.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/dokkaDefaultOutputDirectory.kt index 0a7ab5340c7..3e1f475d275 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/dokkaDefaultOutputDirectory.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/dokkaDefaultOutputDirectory.kt @@ -2,12 +2,13 @@ package org.jetbrains.dokka.gradle import org.gradle.api.Task import java.io.File +import java.util.Locale internal fun Task.defaultDokkaOutputDirectory(): File { return defaultDokkaOutputDirectory(project.buildDir, name) } internal fun defaultDokkaOutputDirectory(buildDir: File, taskName: String): File { - val formatClassifier = taskName.removePrefix("dokka").decapitalize() + val formatClassifier = taskName.removePrefix("dokka").replaceFirstChar { it.lowercase(Locale.getDefault()) } return File(buildDir, "dokka${File.separator}$formatClassifier") } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt index 15989217b32..23d147eab21 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt @@ -5,6 +5,7 @@ import com.android.build.gradle.api.LibraryVariant import org.gradle.api.Project import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmAndroidCompilation +import java.util.Locale internal fun Project.isMainSourceSet(sourceSet: KotlinSourceSet): Boolean { return isMainSourceSet(allCompilationsOf(sourceSet)) @@ -23,7 +24,7 @@ private fun isMainCompilation(compilation: KotlinCompilation): Boolean { } } catch (e: NoSuchMethodError) { // Kotlin Plugin version below 1.4 - return !compilation.name.toLowerCase().endsWith("test") + return !compilation.name.lowercase(Locale.getDefault()).endsWith("test") } return compilation.name == "main" } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt index 116104e8283..af3d3c2bda7 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt @@ -6,6 +6,7 @@ import org.gradle.api.internal.project.ProjectInternal import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.withType import org.gradle.testfixtures.ProjectBuilder +import java.util.Locale import kotlin.test.* class AndroidAutoConfigurationTest { @@ -47,7 +48,7 @@ class AndroidAutoConfigurationTest { project as ProjectInternal project.evaluate() dokkaTasks.flatMap { it.dokkaSourceSets }.forEach { sourceSet -> - if ("test" in sourceSet.name.toLowerCase()) { + if ("test" in sourceSet.name.lowercase(Locale.getDefault())) { assertTrue( sourceSet.suppress.get(), "Expected source set `${sourceSet.name}` to be suppressed by default"