-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
100 lines (77 loc) · 3.15 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
// 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()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
// See dependencies.gradle for declaration of plugins.
classpath gradlePlugins.android
// Compile-time annotation processing.
classpath gradlePlugins.apt
// Backport of some Java 8 language features such as Lambdas and method references.
classpath gradlePlugins.retrolambda
// Needed for Lint + Retrolambda.
classpath gradlePlugins.lombok
// Code coverage.
classpath gradlePlugins.jacoco
// Performance metrics library for Android development.
classpath gradlePlugins.androidDevMetrics
// Catches common Java mistakes as compile-time errors.
classpath gradlePlugins.errorProne
// Method count plugin for android projects
classpath gradlePlugins.dexcount
// Check latest version of dependencies, task: dependencyUpdates
classpath gradlePlugins.versions
}
// 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
}
}
project.plugins.apply('net.ltgt.errorprone')
configurations.errorprone {
resolutionStrategy.force "com.google.errorprone:error_prone_core:${versions.errorProneCoreVersion}"
}
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')
dependencyUpdates.outputDir = new File("${projectDir}/build/reports/versions")
// 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
}
}
}
}