From 24be0cfa29d8a54d478014376c2aae8851297c47 Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Tue, 17 Dec 2024 10:48:44 +0100 Subject: [PATCH] Replaced `capitalized` --- .gitignore | 1 + .../kotlin/io/github/gmazzo/codeowners/CodeOwnersPlugin.kt | 5 ++--- .../main/kotlin/io/github/gmazzo/codeowners/KotlinSupport.kt | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f24a57b..f563307 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .kotlin/ build/ kotlin-js-store/ +local.properties diff --git a/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/CodeOwnersPlugin.kt b/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/CodeOwnersPlugin.kt index 55c3f24..e502477 100644 --- a/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/CodeOwnersPlugin.kt +++ b/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/CodeOwnersPlugin.kt @@ -13,7 +13,6 @@ import org.gradle.api.provider.Property import org.gradle.api.provider.Provider import org.gradle.api.tasks.SourceSetContainer import org.gradle.api.tasks.TaskProvider -import org.gradle.configurationcache.extensions.capitalized import org.gradle.kotlin.dsl.listProperty import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.reportTask @@ -127,7 +126,7 @@ open class CodeOwnersPlugin>( mappings.from(this@ss.mappings) } - reportTask = tasks.register("codeOwners${this@ss.name.capitalized()}Report") { + reportTask = tasks.register("codeOwners${this@ss.name.replaceFirstChar { it.uppercase() }}Report") { group = TASK_GROUP description = "Generates CODEOWNERS report for '${this@ss.name}'" @@ -171,7 +170,7 @@ open class CodeOwnersPlugin>( if (plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) the() .targets.withType() - .firstOrNull()?.name?.let { "${it}${name.capitalized()}" } + .firstOrNull()?.name?.let { "${it}${name.replaceFirstChar { it.uppercase() }}" } else null val sourceSet = extension.sourceSets.maybeCreate(kotlinAwareSourceSetName ?: name) diff --git a/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/KotlinSupport.kt b/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/KotlinSupport.kt index 23f5c06..2725487 100644 --- a/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/KotlinSupport.kt +++ b/plugins/base-plugin/src/main/kotlin/io/github/gmazzo/codeowners/KotlinSupport.kt @@ -2,7 +2,6 @@ package io.github.gmazzo.codeowners import org.gradle.api.Project import org.gradle.api.tasks.SourceSet -import org.gradle.configurationcache.extensions.capitalized import org.gradle.kotlin.dsl.getValue import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension @@ -30,7 +29,7 @@ class KotlinSupport(private val project: Project) { val KotlinCompilation<*>.codeOwnersSourceSetName get() = when (val classifier = target.disambiguationClassifier?.takeUnless { it.isBlank() }) { null -> name - else -> "$classifier${name.takeUnless { it == SourceSet.MAIN_SOURCE_SET_NAME }?.capitalized().orEmpty()}" + else -> "$classifier${name.takeUnless { it == SourceSet.MAIN_SOURCE_SET_NAME }?.replaceFirstChar { it.uppercase() }.orEmpty()}" } }