forked from artem-zinnatullin/qualitymatters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (134 loc) · 6.44 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
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'
// 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 {
minSdkVersion = 16
targetSdkVersion = 23
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
preDexLibs = !project.hasProperty('disablePreDex')
supportLibsVersion = '23.1.1'
daggerVersion = '2.0.2'
okHttpVersion = '2.6.0'
retrofitVersion = '2.0.0-beta2'
espressoVersion = '2.2.1'
stethoVersion = '1.2.0'
}
ext.libraries = [
dagger : 'com.google.dagger:dagger:' + daggerVersion,
daggerCompiler : 'com.google.dagger:dagger-compiler:' + daggerVersion,
javaxInject : 'javax.inject:javax.inject:1',
javaxAnnotationApi : 'javax.annotation:javax.annotation-api:1.2',
rxJava : 'io.reactivex:rxjava:1.0.17',
okHttp : 'com.squareup.okhttp:okhttp:' + okHttpVersion,
okHttpLoggingInterceptor: 'com.squareup.okhttp:logging-interceptor:' + okHttpVersion,
retrofit : 'com.squareup.retrofit:retrofit:' + retrofitVersion,
retrofitJacksonConverter: 'com.squareup.retrofit:converter-jackson:' + retrofitVersion,
retrofitRxJavaAdapter : 'com.squareup.retrofit:adapter-rxjava:' + retrofitVersion,
jacksonDataBind : 'com.fasterxml.jackson.core:jackson-databind:2.6.3',
autoValue : 'com.google.auto.value:auto-value:1.1',
supportAnnotations : 'com.android.support:support-annotations:' + supportLibsVersion,
supportAppCompat : 'com.android.support:appcompat-v7:' + supportLibsVersion,
supportDesign : 'com.android.support:design:' + supportLibsVersion,
supportRecyclerView : 'com.android.support:recyclerview-v7:' + supportLibsVersion,
supportCardView : 'com.android.support:cardview-v7:' + supportLibsVersion,
butterKnife : 'com.jakewharton:butterknife:7.0.1',
picasso : 'com.squareup.picasso:picasso:2.5.2',
timber : 'com.jakewharton.timber:timber:4.1.0',
// Developer Tools
stetho : 'com.facebook.stetho:stetho:' + stethoVersion,
stethoOkHttp : 'com.facebook.stetho:stetho-okhttp:' + stethoVersion,
leakCanary : 'com.squareup.leakcanary:leakcanary-android:1.3.1',
tinyDancer : 'com.github.brianPlummer:tinydancer:0.0.7',
// Test dependencies
junit : 'junit:junit:4.12',
robolectric : 'org.robolectric:robolectric:3.0',
assertJ : 'org.assertj:assertj-core:1.7.1',
equalsVerifier : 'nl.jqno.equalsverifier:equalsverifier:1.7.5',
okHttpMockWebServer : 'com.squareup.okhttp:mockwebserver:' + okHttpVersion,
mockitoCore : 'org.mockito:mockito-core:1.10.19',
supportTestRunner : 'com.android.support.test:runner:0.4.1',
supportTestRules : 'com.android.support.test:rules:0.4.1',
espressoCore : 'com.android.support.test.espresso:espresso-core:' + espressoVersion,
espressoContrib : 'com.android.support.test.espresso:espresso-contrib:' + espressoVersion,
]
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')
task pmd(type: Pmd) {
ignoreFailures = false // Fail early.
ruleSets = ['java-basic', 'java-braces', 'java-strings', 'java-design', 'java-unusedcode']
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.
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
}
}
}
}