-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
134 lines (107 loc) · 3.57 KB
/
build.gradle
File metadata and controls
134 lines (107 loc) · 3.57 KB
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
133
import com.android.build.gradle.internal.tasks.AndroidTestTask
buildscript {
// Gradle will not find vars defined in an external file when referring to them
// in the build script block, unless you link it from the build script block, too.
apply from: 'dependencies.gradle'
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
dependencies {
classpath gradlePlugins.androidToolsPlugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
// 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.1'
}
task pmd(type: Pmd) {
ignoreFailures = true
ruleSetFiles = project.files(rootProject.file("config/pmd/pmd.xml"))
ruleSets = []
source = fileTree('src/main/java')
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
}
}
plugins.apply('findbugs')
task findbugs(type: FindBugs) {
ignoreFailures = true
effort = "max"
reportLevel = "high"
excludeFilter = rootProject.file('config/findbugs/findbugs.xml')
classes = files("${project.rootDir}/app/build/intermediates/classes")
source = fileTree('src/main/java')
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
}
classpath = files()
}
plugins.apply('checkstyle')
checkstyle {
toolVersion = '6.7'
}
task checkstyle(type: Checkstyle) {
configFile rootProject.file('config/checkstyle/checkstyle.xml')
configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/code_quality/checkstyle/suppressions.xml").absolutePath
ignoreFailures true
showViolations true
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
}
afterEvaluate {
tasks.findByName('pmd').dependsOn('assemble')
tasks.findByName('findbugs').dependsOn('assemble')
def checkTask = tasks.findByName('check')
//Disabled for now
checkTask.dependsOn('pmd')
//checkTask.dependsOn('findbugs')
checkTask.dependsOn('checkstyle')
// Log instrumentation tests results.
tasks.withType(AndroidTestTask) { task ->
task.doFirst {
logging.level = LogLevel.INFO
}
task.doLast {
logging.level = LogLevel.LIFECYCLE
}
}
}
}