aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/java/Spotless.kt
blob: bab6f58de1b4e45421911fc03ed61875bcfa3187 (about) (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
/*
 * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
 * SPDX-License-Identifier: GPL-3.0-only
 */

import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure

fun Project.configureSpotless() {
  apply(plugin = "com.diffplug.spotless")
  configure<SpotlessExtension> {
    kotlin {
      ktfmt().googleStyle()
      target("**/*.kt")
      targetExclude("**/build/")
    }
    kotlinGradle {
      ktfmt().googleStyle()
      target("**/*.kts")
    }
    format("xml") {
      target("**/*.xml")
      targetExclude("**/build/", ".idea/")
      trimTrailingWhitespace()
      indentWithSpaces()
      endWithNewline()
    }
  }
}