forked from artem-zinnatullin/qualitymatters
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
132 lines (100 loc) · 3.86 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'dependencies.gradle'
buildscript {
// Gradle will not find vars defined in an external file when referring to them
// in the buildscript block, unless you link it from the buildscript block, too.
apply from: 'dependencies.gradle'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// APT compile-time annotation processing
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// Backport of some Java 8 language features such as Lambdas and method references.
classpath 'me.tatarka:gradle-retrolambda:3.2.4'
// Workaround for Lint + Retrolambda.
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
// Generates build info without breaking incremental builds
classpath libraries.paperworkPlugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// Part of workaround for Lint + Retrolambda.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
allprojects {
repositories {
jcenter()
}
// Workaround to prevent Gradle from stealing focus from other apps during tests run/etc.
// https://gist.github.com/artem-zinnatullin/4c250e04636e25797165
tasks.withType(JavaForkOptions) {
jvmArgs '-Djava.awt.headless=true'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ('com.android.build.gradle.AppPlugin'.equals(plugin.class.name) || 'com.android.build.gradle.LibraryPlugin'.equals(plugin.class.name)) {
// enable or disable pre-dexing
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
plugins.apply('pmd')
pmd {
toolVersion = '5.4.0'
}
task pmd(type: Pmd) {
ignoreFailures = false // Fail early.
ruleSetFiles = project.files(rootProject.file("code_quality_tools/pmd.xml"))
ruleSets = []
source = fileTree('src/main/java')
}
plugins.apply('findbugs')
task findbugs(type: FindBugs) {
ignoreFailures = false // Fail early.
effort = 'max'
reportLevel = 'low' // Report even low priority problems.
reports {
xml {
enabled = true
withMessages = true
}
}
classes = files("${project.projectDir}/build/intermediates/classes")
source = fileTree('src/main/java')
// If somebody has an idea how to make this work with support libraries -> open a PR please.
classpath = files()
excludeFilter = rootProject.file('code_quality_tools/findbugs-filter.xml')
}
plugins.apply('checkstyle')
task checkstyle(type: Checkstyle) {
configFile rootProject.file('code_quality_tools/checkstyle.xml')
ignoreFailures false // Fail early.
showViolations true
source 'src'
include '**/*.java'
classpath = files()
}
afterEvaluate {
tasks.findByName('pmd').dependsOn('assemble')
tasks.findByName('findbugs').dependsOn('assemble')
def checkTask = tasks.findByName('check')
checkTask.dependsOn('pmd')
checkTask.dependsOn('findbugs')
checkTask.dependsOn('checkstyle')
// Log instrumentation tests results.
tasks.withType(com.android.build.gradle.internal.tasks.AndroidTestTask) { task ->
task.doFirst {
logging.level = LogLevel.INFO
}
task.doLast {
logging.level = LogLevel.LIFECYCLE
}
}
}
}