blob: 3dfd8c343ce060f9f714a8e224eb91c7c02c764d [file] [log] [blame]
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'com.google.googlejavaformat:google-java-format:1.18.1'
}
}
apply plugin: 'com.diffplug.spotless'
spotless {
// We run the check separately on CI, so don't run this by default
enforceCheck = false
java {
licenseHeaderFile rootProject.file('config/spotless/spotless.header')
custom 'google-java-format', { source ->
com.google.googlejavaformat.java.JavaFormatterOptions options = new com.google.googlejavaformat.java.AutoValue_JavaFormatterOptions.Builder()
.style(com.google.googlejavaformat.java.JavaFormatterOptions.Style.AOSP)
.formatJavadoc(false)
.reorderModifiers(true)
.build()
com.google.googlejavaformat.java.Formatter formatter = new com.google.googlejavaformat.java.Formatter(options)
return formatter.formatSource(source)
}
// This test contains emulation of same-line stubbings. The formatter would put them on a separate line.
targetExclude 'src/test/java/org/mockitousage/internal/junit/UnusedStubbingsFinderTest.java'
}
}