From cf0e6d0e5c9cc4340dd8cd0fc3f2315390ce1188 Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Sat, 31 Aug 2024 08:54:32 +0000 Subject: [PATCH] Replace internal `capitalized` extension 'capitalized(): String' is deprecated. This was never intended as a public API. --- .../kotlin/com/google/samples/apps/nowinandroid/Badging.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.kt index 4447b8602..59eac2322 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.kt @@ -35,12 +35,12 @@ import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction -import org.gradle.configurationcache.extensions.capitalized import org.gradle.kotlin.dsl.assign import org.gradle.kotlin.dsl.register import org.gradle.language.base.plugins.LifecycleBasePlugin import org.gradle.process.ExecOperations import java.io.File +import java.util.Locale import javax.inject.Inject @CacheableTask @@ -107,6 +107,10 @@ abstract class CheckBadgingTask : DefaultTask() { } } +private fun String.capitalized() = replaceFirstChar { + if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() +} + fun Project.configureBadgingTasks( baseExtension: BaseExtension, componentsExtension: ApplicationAndroidComponentsExtension,