-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
54 lines (49 loc) · 1.37 KB
/
build.gradle
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
plugins {
id "application"
id "eclipse"
id "java"
id "com.diffplug.spotless" version "5.1.0"
}
def javaVersion = JavaVersion.VERSION_1_8;
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
repositories {
jcenter()
}
task enforceJavaVersion {
doLast {
def foundVersion = JavaVersion.current();
if (foundVersion != javaVersion)
throw new IllegalStateException("You are using an incorrect version ("
+ foundVersion
+ "). Please set JAVA_HOME to point to a valid installation of Java "
+ javaVersion);
}
}
compileJava {
dependsOn enforceJavaVersion
options.encoding = 'UTF-8'
}
spotless {
java {
target 'src/main/**/*.java'
removeUnusedImports()
endWithNewline()
indentWithSpaces(4)
licenseHeaderFile rootProject.file('src/spotless/license-template.java')
trimTrailingWhitespace()
}
format 'misc', {
target project.fileTree(project.rootDir) {
include '**/.gitignore', '**/*.gradle', '**/*.md', '**/*.txt', 'src/spotless/**'
exclude '**/build/**'
exclude '**/bin/**'
exclude '**/out/**'
exclude '.gradle/**'
exclude '.idea/**'
}
endWithNewline()
indentWithSpaces(4)
trimTrailingWhitespace()
}
}