Skip to content

Commit

Permalink
Move codestyle config to build-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Jan 20, 2025
1 parent 6a81052 commit 2460e90
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 28 deletions.
1 change: 1 addition & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
implementation(libs.dokka.gradlePlugin)
implementation(libs.develocity)
implementation(libs.gradleDoctor)
implementation(libs.kotlinter)

// A hack to make version catalogs accessible from buildSrc sources
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
Expand Down
15 changes: 15 additions & 0 deletions build-logic/src/main/kotlin/ktorbuild.codestyle.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import ktorbuild.internal.ktorBuild

plugins {
id("org.jmailen.kotlinter")
}

kotlinter {
// Don't fail lint tasks on CI as we don't want TeamCity to show a build failure in addition to an actual lint report
ignoreLintFailures = ktorBuild.isCI.get()
reporters = arrayOf("checkstyle", "plain")
}
1 change: 1 addition & 0 deletions build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ plugins {
id("ktorbuild.base")
kotlin("multiplatform")
id("org.jetbrains.kotlinx.atomicfu")
id("ktorbuild.codestyle")
}

kotlin {
Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ subprojects {
} else {
apply(plugin = "ktorbuild.project.internal")
}

configureCodestyle()
}

println("Using Kotlin compiler version: ${libs.versions.kotlin.get()}")
Expand Down
2 changes: 0 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ dependencies {
implementation(libs.kotlin.gradlePlugin)
implementation(libs.kotlin.serialization)

implementation(libs.kotlinter)

// A hack to make version catalogs accessible from buildSrc sources
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
Expand Down
21 changes: 0 additions & 21 deletions buildSrc/src/main/kotlin/Codestyle.kt

This file was deleted.

3 changes: 0 additions & 3 deletions buildSrc/src/main/kotlin/KotlinExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.the
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jmailen.gradle.kotlinter.KotlinterExtension

fun Project.kotlin(block: KotlinMultiplatformExtension.() -> Unit) {
configure(block)
}

val Project.kotlin: KotlinMultiplatformExtension get() = the()

val Project.kotlinter: KotlinterExtension get() = the()

fun NamedDomainObjectContainer<KotlinSourceSet>.commonMain(block: KotlinSourceSet.() -> Unit) {
val sourceSet = getByName("commonMain")
block(sourceSet)
Expand Down

0 comments on commit 2460e90

Please sign in to comment.