-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
103 lines (87 loc) · 2.83 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import com.github.sherter.googlejavaformatgradleplugin.GoogleJavaFormat
buildscript {
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath "org.jmailen.gradle:kotlinter-gradle:1.20.1"
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.16'
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.7.1"
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects { project ->
apply plugin: 'net.ltgt.errorprone'
apply from: rootProject.file('ktlint.gradle')
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.1'
}
if (!project.name.endsWith("sample") && project.name != "mixpanel") {
apply plugin: "com.github.sherter.google-java-format"
apply plugin: 'checkstyle'
apply plugin: 'pmd'
task pmd(type: Pmd) {
ruleSetFiles = files("${project.rootDir}/pmd.xml")
ruleSets = ["java-basic", "java-braces"]
source 'src/main/java'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
consoleOutput = true
}
task checkstyle(type: Checkstyle) {
configFile rootProject.file('checkstyle.xml')
source 'src/main/java'
ignoreFailures false
showViolations true
include '**/*.java'
classpath = files()
}
googleJavaFormat {
group "formatting"
options style: 'AOSP'
}
task format(type: GoogleJavaFormat) {
source 'src/main/java'
include '**/*.java'
exclude '**/gen/**'
}
project.afterEvaluate {
def task = null
if (project.tasks.findByName('preBuild')) {
task = preBuild
} else if (project.tasks.findByName('clean')) {
task = clean
}
if (task != null) {
task.dependsOn "format"
tasks['pmd'].shouldRunAfter format
tasks['checkstyle'].shouldRunAfter format
task.dependsOn "formatKotlin"
tasks['lintKotlin'].shouldRunAfter formatKotlin
}
}
}
}