summaryrefslogtreecommitdiff
path: root/kotlin/build.gradle.kts
blob: aff0720c660c50c2826b646c630aa89b2bc5ced1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
plugins {
  id("com.diffplug.spotless") version "5.8.2"
}

group = "com.google.flatbuffers"
version = "1.12.0-SNAPSHOT"

subprojects {

  repositories {
    maven { setUrl("https://plugins.gradle.org/m2/") }
    mavenCentral()
  }
}

buildscript {
  repositories {
    maven { setUrl("https://plugins.gradle.org/m2/") }
    gradlePluginPortal()
    mavenCentral()
  }
}

// plugin used to enforce code style
spotless {
  val klintConfig = mapOf("indent_size" to "2", "continuation_indent_size" to "2")
  kotlin {
    target("**/*.kt")
    ktlint("0.40.0").userData(klintConfig)
    trimTrailingWhitespace()
    indentWithSpaces()
    endWithNewline()
    licenseHeaderFile("$rootDir/spotless/spotless.kt").updateYearWithLatest(false)
    targetExclude("**/spotless.kt", "**/build/**")
  }
  kotlinGradle {
    target("*.gradle.kts")
    ktlint().userData(klintConfig)
  }
}