forked from JakeWharton/u2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
206 lines (168 loc) · 5.95 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
201
202
203
204
205
206
buildscript {
repositories {
//maven {
// url 'https://oss.sonatype.org/content/repositories/snapshots/'
//}
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.3') {
// Workaround for https://github.com/stanfy/spoon-gradle-plugin/issues/33
exclude module: 'guava'
}
classpath 'com.google.guava:guava:17.0'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
}
// Exclude the lombok version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
// Manifest version information!
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'spoon'
apply plugin: 'me.tatarka.retrolambda'
repositories {
//maven {
// url 'https://oss.sonatype.org/content/repositories/snapshots/'
//}
mavenCentral()
}
def gitSha() {
def p = 'git rev-parse --short HEAD'.execute([], project.rootDir)
p.waitFor()
if (p.exitValue() != 0) {
throw new RuntimeException(p.errorStream.text)
}
return p.text.trim()
}
def gitTimestamp() {
def p = 'git log -n 1 --format=%at'.execute([], rootDir)
p.waitFor()
if (p.exitValue() != 0) {
throw new RuntimeException(p.errorStream.text)
}
return p.text.trim()
}
def isCi = "true".equals(System.getenv("CI"))
def preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !isCi
}
signingConfigs {
u2020 {
storeFile file('u2020.keystore')
storePassword 'android'
keyAlias 'android'
keyPassword 'android'
}
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
signingConfig signingConfigs.u2020
buildConfigField 'String', 'GIT_SHA', "\"${gitSha()}\""
buildConfigField 'long', 'GIT_TIMESTAMP', "${gitTimestamp()}L"
testInstrumentationRunner "com.jakewharton.u2020.U2020TestRunner"
}
buildTypes {
debug {
applicationIdSuffix '.debug'
}
}
productFlavors {
internal {
applicationId 'com.jakewharton.u2020.internal'
}
production {
applicationId 'com.jakewharton.u2020'
}
}
lintOptions {
textReport true
textOutput 'stdout'
fatal 'UnusedResources'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
// TODO remove eventually: http://b.android.com/162285
configurations {
internalDebugCompile
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.3.0'
}
}
dependencies {
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.squareup.dagger:dagger:1.2.2'
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-moshi:2.0.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
internalDebugCompile 'com.squareup.retrofit2:retrofit-mock:2.0.0'
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.jakewharton.timber:timber:4.0.1'
compile 'com.jakewharton.byteunits:byteunits:0.9.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.3.0'
internalDebugCompile 'com.jakewharton.madge:madge:1.1.3'
internalDebugCompile 'com.jakewharton.scalpel:scalpel:1.1.2'
internalDebugCompile 'com.jakewharton:process-phoenix:1.0.2'
internalCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
productionCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
compile 'io.reactivex:rxjava:1.1.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.jakewharton.threetenabp:threetenabp:1.0.2'
internalCompile 'com.mattprecious.telescope:telescope:1.5.0@aar'
compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.0'
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.3.0'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// TODO https://code.google.com/p/android-test-kit/issues/detail?id=157
//androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.squareup.spoon:spoon-client:1.2.0'
testCompile 'junit:junit:4.12'
testCompile 'com.google.truth:truth:0.27'
}
def installAll = tasks.create('installAll')
installAll.description = 'Install all applications.'
android.applicationVariants.all { variant ->
installAll.dependsOn(variant.install)
// Ensure we end up in the same group as the other install tasks.
installAll.group = variant.install.group
}
// The default 'assemble' task only applies to normal variants. Add test variants as well.
android.testVariants.all { variant ->
tasks.getByName('assemble').dependsOn variant.assemble
}