Skip to content

Commit

Permalink
[Kotlin] Add Kotlin source support to build chain (#37)
Browse files Browse the repository at this point in the history
This adds unidirectional Kotlin support for writing code in Kotlin and using it in Groovy.

Extracted from #29
  • Loading branch information
Nava2 authored Apr 23, 2023
1 parent 4c5c03d commit 59c8551
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
23 changes: 23 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import com.gradle.publish.PublishTask.GRADLE_PUBLISH_SECRET

plugins {
id("groovy")
id("org.jetbrains.kotlin.jvm") version "1.8.20"
id("io.gitlab.arturbosch.detekt") version "1.22.0"
id("com.gradle.plugin-publish") version "1.2.0"
id("java-gradle-plugin")
}
Expand Down Expand Up @@ -68,3 +70,24 @@ dependencies {
testImplementation("junit:junit:4.13.2")
}

tasks.compileGroovy {
classpath += files(tasks.compileKotlin.flatMap { it.destinationDirectory })
}

tasks.classes {
dependsOn(tasks.compileGroovy)
}

detekt {
parallel = true
autoCorrect = true

buildUponDefaultConfig = true // preconfigure defaults
config = files("$rootDir/config/detekt-config.yml")

allRules = false // activate all available (even unstable) rules.
}

dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.22.0")
}
20 changes: 20 additions & 0 deletions config/detekt-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
formatting:
active: true
Indentation:
active: true
indentSize: 2
PackageName:
active: false

style:
active: true
ReturnCount:
max: 4

complexity:
LongMethod:
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]

naming:
PackageNaming:
packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9_]*)*'

0 comments on commit 59c8551

Please sign in to comment.