Skip to content

Commit

Permalink
Replaced capitalized
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Dec 17, 2024
1 parent 308df3b commit 24be0cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.kotlin/
build/
kotlin-js-store/
local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -127,7 +126,7 @@ open class CodeOwnersPlugin<Extension : CodeOwnersExtension<*>>(
mappings.from(this@ss.mappings)
}

reportTask = tasks.register<CodeOwnersReportTask>("codeOwners${this@ss.name.capitalized()}Report") {
reportTask = tasks.register<CodeOwnersReportTask>("codeOwners${this@ss.name.replaceFirstChar { it.uppercase() }}Report") {
group = TASK_GROUP
description = "Generates CODEOWNERS report for '${this@ss.name}'"

Expand Down Expand Up @@ -171,7 +170,7 @@ open class CodeOwnersPlugin<Extension : CodeOwnersExtension<*>>(
if (plugins.hasPlugin("org.jetbrains.kotlin.multiplatform"))
the<KotlinTargetsContainer>()
.targets.withType<KotlinAndroidTarget>()
.firstOrNull()?.name?.let { "${it}${name.capitalized()}" }
.firstOrNull()?.name?.let { "${it}${name.replaceFirstChar { it.uppercase() }}" }
else null

val sourceSet = extension.sourceSets.maybeCreate(kotlinAwareSourceSetName ?: name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()}"
}

}
Expand Down

0 comments on commit 24be0cf

Please sign in to comment.