-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathbuild.gradle
73 lines (66 loc) · 2.33 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
apply plugin: 'com.diffplug.spotless'
apply plugin: "de.undercouch.download"
task downloadJavaLicense(type: Download) {
src 'https://raw.githubusercontent.com/hyperledger-web3j/web3j-build-tools/main/gradle/spotless/java.license'
dest new File("$rootDir/gradle/spotless",'java.license')
quiet true
onlyIfModified true
}
task downloadFormatterProperties(type: Download) {
src 'https://raw.githubusercontent.com/hyperledger-web3j/web3j-build-tools/main/gradle/spotless/formatter.properties'
dest new File("$rootDir/gradle/spotless",'formatter.properties')
quiet true
onlyIfModified true
}
spotless {
java {
// This path needs to be relative to each project
target fileTree('.') {
include '**/src/*/java/**/*.java'
exclude '**/.gradle/**'
exclude '**/generated/**'
exclude '**/build/install/**'
}
removeUnusedImports()
googleJavaFormat('1.17.0').aosp()
importOrder 'java', '', 'org.web3j', '\\#'
trimTrailingWhitespace()
endWithNewline()
licenseHeaderFile "$rootDir/gradle/spotless/java.license"
}
kotlin {
// This path needs to be relative to each project
target fileTree('.') {
include '**/*.kt'
exclude '**/.gradle/**'
exclude '**/build/install/**'
}
ktlint('0.49.1')
trimTrailingWhitespace()
endWithNewline()
licenseHeaderFile "$rootDir/gradle/spotless/java.license"
}
groovyGradle {
target '*.gradle'
greclipse().configFile("$rootDir/gradle/spotless/formatter.properties")
endWithNewline()
indentWithSpaces(4)
}
}
tasks.named('spotlessJava') {
dependsOn downloadJavaLicense, downloadFormatterProperties
mustRunAfter tasks.named('compileJava')
mustRunAfter tasks.named('spotlessGroovyGradle')
}
tasks.named('spotlessKotlin') {
dependsOn downloadJavaLicense, downloadFormatterProperties
mustRunAfter tasks.named('compileJava')
mustRunAfter tasks.named('spotlessGroovyGradle')
dependsOn tasks.named('spotlessJava')
}
tasks.named('spotlessCheck') {
dependsOn downloadJavaLicense, downloadFormatterProperties
dependsOn tasks.named('spotlessJava')
dependsOn tasks.named('spotlessKotlin')
dependsOn tasks.named('spotlessGroovyGradle')
}