-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
200 lines (176 loc) · 6.28 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
* Just run this script using "gradlew", and it will show you typical examples of how to use it.
*/
defaultTasks 'cgeoHelp'
task cgeoHelp {
doLast {
println ''
println 'These are some of the available commands for building cgeo.'
println ''
println 'cleaning all generated artifacts:'
println ' gradlew clean'
println ''
println 'build:'
println ' gradlew assembleDebug'
println ''
println 'install on connected device/emulator:'
println ' gradlew installBasicDebug'
println ''
println 'run app on connected device/emulator:'
println ' gradlew runBasicDebug'
println ''
println 'instrumentation tests on connected device/emulator:'
println ' gradlew connectedBasicDebugAndroidTest'
println ''
println 'pure unit tests WITHOUT device'
println ' gradlew testBasicDebugUnitTest'
println ''
println 'all unit tests (pure and instrumentation)'
println ' gradlew testDebug'
println ''
println 'check project dependencies for updates:'
println ' gradlew dependencies main:dependencies'
println ''
println 'check gradle dependencies for updates:'
println ' gradlew dependencyUpdates'
println ''
println 'Use "gradlew tasks" for more available tasks.'
println ''
println ''
println 'Available build types are: debug, nightly (requires an env var named NB), ' +
'rc (requires an env var named RC), release.'
}
}
configure(cgeoHelp) {
group = 'cgeo'
description = 'Displays help for building cgeo.'
}
/*
* Build scan plugin shall be applied first
*/
apply plugin: 'com.gradle.build-scan'
/*
* update check for all components in this gradle script
*/
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'idea'
buildscript {
repositories {
jcenter()
// gradle build-scan for profiling our build script
maven {
url 'https://plugins.gradle.org/m2'
}
google()
}
dependencies {
// these dependencies are used by gradle plugins, not by our projects
// check for updates of gradle plugin dependencies
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
// Android gradle plugin
classpath 'com.android.tools.build:gradle:3.0.1'
// un-mocking of portable Android classes
classpath 'de.mobilej.unmock:UnMockPlugin:0.6.4'
// Google Services (App Invite) has its own Gradle plugin
classpath 'com.google.gms:google-services:2.1.0'
// monitor our application method limit
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
// ribbonizer for easier distinction of non-release builds
classpath 'com.github.gfx.ribbonizer:plugin:1.0.0'
// gradle build script profiling
classpath 'com.gradle:build-scan-plugin:1.11'
}
}
// filter out non release version updates and other updates we cannot use
allprojects {
configurations {
all {
resolutionStrategy {
componentSelection {
all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'pr'].any { qualifier ->
selection.candidate.version.contains(qualifier)
}
// allow beta version of androidsvg
if (selection.candidate.group == 'com.caverock') {
rejected = false
}
// google auto service only available as rc2 right now
if (selection.candidate.group == 'com.google.auto.service') {
rejected = false
}
if (rejected) {
selection.reject('Release candidate')
}
// https://github.com/joel-costigliola/assertj-core/issues/345
if (selection.candidate.group == 'org.assertj' && selection.candidate.module == 'assertj-core' && selection.candidate.version.substring(0,1).toInteger() > 2) {
selection.reject("assertj 3.x or higher require Java 7 SE classes not available in Android")
}
// findbugs team has some release trouble
if (selection.candidate.group == 'com.google.code.findbugs' && selection.candidate.module == 'annotations' && selection.candidate.version == '3.0.1') {
selection.reject("3.0.1 is not an upgrade of 3.0.1u2")
}
// Apache Commons Lang 3.6 requires Java7, https://github.com/apache/commons-lang/commit/9b481a97010a19e375cf423ffe25dda1b40e0e47
if (selection.candidate.group == 'org.apache.commons' && selection.candidate.module == 'commons-lang3' && selection.candidate.version.substring(0,1).toInteger()*10+selection.candidate.version.substring(2,3).toInteger() > 35) {
selection.reject("Apache Commons Lang3 3.6 or higher requires Java 7.")
}
// Apache Commons IO 2.6 requires Java7, https://commons.apache.org/proper/commons-io/upgradeto2_6.html
if (selection.candidate.group == 'commons-io' && selection.candidate.module == 'commons-io' && selection.candidate.version.substring(0,1).toInteger()*10+selection.candidate.version.substring(2,3).toInteger() > 25) {
selection.reject("Apache Commons IO 2.6 or higher requires Java 7.")
}
// Apache Commons Compress 1.15 requires Java7 Sun classes
if (selection.candidate.group == 'org.apache.commons' && selection.candidate.module == 'commons-compress' && selection.candidate.version.substring(0,1).toInteger()*100+selection.candidate.version.substring(2,4).toInteger() > 114) {
selection.reject("Apache Commons Compress 1.15 or higher requires Java 7.")
}
}
}
}
}
}
repositories {
mavenCentral()
jcenter()
// hosts e.g. viewpagerindicator
maven {
url "https://jitpack.io"
}
// viewpager fork
maven {
url 'https://dl.bintray.com/alexeydanilov/maven'
}
// Android Support libraries are now in an online Maven repository
google()
}
}
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}
/*
* common configuration for the Java projects
*/
ext.minSdkVersion = 14
subprojects {
repositories {
mavenCentral()
jcenter()
// hosts e.g. viewpagerindicator
maven {
url "https://jitpack.io"
}
}
// disable warning of annotation processor about annotation types with no registered processor (like @NonNull)
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:-processing"
}
idea.module {
downloadJavadoc = true
downloadSources = true
}
}
/*
* Make sure that we use the source distribution when updating the wrapper from the command line.
*/
task wrapper(type: Wrapper) {
distributionType = "all"
}