/
build.gradle
223 lines (181 loc) · 9.23 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
import org.ajoberstar.grgit.Commit
import org.ajoberstar.grgit.Grgit
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'io.fabric'
apply plugin: 'com.github.triplet.play'
apply plugin: 'checkstyle'
check.dependsOn('checkstyle')
Properties local_properties = new Properties()
local_properties.load(new FileInputStream(rootProject.file('local.properties')))
apply from: '../settings/frisbee.gradle'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
dexOptions {
// Skip pre-dexing when running on CI or when disabled via -Dpre-dex=false.
preDexLibraries = rootProject.ext.preDexEnabled && !rootProject.ext.ci
javaMaxHeapSize "3g"
}
defaultConfig {
applicationId "org.gdg.frisbee.android"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
buildConfigField "String", "COMMIT_SHA", "\"${commitSha()}\""
buildConfigField "String", "COMMIT_TIME", "\"${commitTime()}\""
resConfigs "en", "ar", "cs", "de", "es", "fr", "hi", "hu", "hy-rAM", "it", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "sr", "sk", "th", "tr", "uk", "zh-rCN", "zh-rHK", "zh-rTW"
testInstrumentationRunner "org.gdg.frisbee.android.FrisbeeTestRunner"
//KEYS
buildConfigField "long", "DOORBELL_ID", local_properties.doorbell_id ?: "0"
buildConfigField "String", "DOORBELL_APP_KEY", "\"" + (local_properties.doorbell_app_key ?: "") + "\""
resValue "string", "play_app_id", "429371117063"
resValue "string", "android_backup_key", local_properties.android_backup_key ?: ""
}
buildTypes {
release {
//Library specific proguard files
//More info: https://github.com/krschultz/android-proguard-snippets
proguardFile '../settings/proguard/proguard-support-v7-appcompat.pro'
proguardFile '../settings/proguard/proguard-support-v7-cardview.pro'
proguardFile '../settings/proguard/proguard-google-play-services.pro'
proguardFile '../settings/proguard/proguard-gson.pro'
proguardFile '../settings/proguard/proguard-square-okio.pro'
proguardFile '../settings/proguard/proguard-square-okhttp3.pro'
proguardFile '../settings/proguard/proguard-square-picasso.pro'
proguardFile '../settings/proguard/proguard-square-retrofit2.pro'
proguardFile '../settings/proguard/proguard-crashlytics.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled true
zipAlignEnabled true
shrinkResources true
buildConfigField "String", "IP_SIMPLE_API_ACCESS_KEY", "\"$local_properties.ip_simple_api_access_key\""
buildConfigField "String", "ANDROID_SIMPLE_API_ACCESS_KEY", "\"$local_properties.android_simple_api_access_key\""
resValue "string", "android_simple_api_access_key", local_properties.android_simple_api_access_key ?: ""
resValue "string", "authority", "org.gdg.frisbee.android.provider"
}
alpha.initWith(release)
debug {
ext.enableCrashlytics = false
debuggable true
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
buildConfigField "String", "IP_SIMPLE_API_ACCESS_KEY", "\"$local_properties.ip_simple_api_access_key_debug\""
buildConfigField "String", "ANDROID_SIMPLE_API_ACCESS_KEY", "\"$local_properties.android_simple_api_access_key_debug\""
resValue "string", "android_simple_api_access_key", local_properties.android_simple_api_access_key_debug ?: ""
resValue "string", "authority", "org.gdg.frisbee.android.debug.provider"
}
}
lintOptions {
ignoreWarnings ci
textReport true
textOutput 'stdout'
warning 'InvalidPackage'
warning 'ImpliedQuantity'
warning 'MissingQuantity'
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
play {
jsonFile = file(local_properties.service_account_json_file ?: 'no-file.json')
track = System.getProperty('track', 'alpha')
}
configurations {
compile.exclude module: 'httpclient'
all {
resolutionStrategy.force "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
}
}
dependencies {
//Android Support
compile "com.android.support:support-v4:$rootProject.supportLibraryVersion"
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:design:$rootProject.supportLibraryVersion"
compile "com.android.support:customtabs:$rootProject.supportLibraryVersion"
compile "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espressoVersion"
//Play Services
compile "com.google.android.gms:play-services-auth:$rootProject.playServicesVersion"
compile "com.google.android.gms:play-services-plus:$rootProject.playServicesVersion"
compile "com.google.android.gms:play-services-analytics:$rootProject.playServicesVersion"
compile "com.google.android.gms:play-services-appindexing:$rootProject.playServicesVersion"
compile "com.google.firebase:firebase-invites:$rootProject.playServicesVersion"
compile "com.google.firebase:firebase-messaging:$rootProject.playServicesVersion"
//Google
compile 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
//Square
compile "com.squareup.okhttp3:okhttp:$rootProject.okHttpVersion"
compile "com.squareup.okhttp3:logging-interceptor:$rootProject.okHttpVersion"
compile 'com.squareup.picasso:picasso:2.5.2'
compile "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
androidTestCompile "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakCanaryVersion"
debugCompile "com.squareup.leakcanary:leakcanary-android:$rootProject.leakCanaryVersion"
alphaCompile "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakCanaryVersion"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakCanaryVersion"
//Jake Wharton
compile "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
apt "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
compile "com.jakewharton.timber:timber:$rootProject.timberVersion"
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
//Others
compile 'io.doorbell:android-sdk:0.2.6@aar'
compile 'org.jsoup:jsoup:1.8.2'
compile "net.danlew:android.joda:$rootProject.jodaTimeAndroidVersion"
compile 'com.tasomaniac:delayed-progress:0.4'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
transitive = true;
}
//Local
compile fileTree(dir: 'libs', include: ['*.jar'])
// Android Wear
wearApp project(':wear')
// Dependencies for local unit tests
testCompile "junit:junit:$rootProject.junitVersion"
testCompile "org.mockito:mockito-all:$rootProject.mockitoVersion"
testCompile "org.hamcrest:hamcrest-all:$rootProject.hamcrestVersion"
testCompile "org.robolectric:robolectric:$rootProject.robolectricVersion"
testCompile "org.robolectric:shadows-multidex:$rootProject.robolectricVersion"
testCompile "joda-time:joda-time:$rootProject.jodaTimeVersion"
// Needs an older version since newer versions are compiled against java 8
androidTestCompile 'org.assertj:assertj-core:1.7.1'
// Android Testing Support Library's runner and rules
androidTestCompile "com.android.support.test:runner:$rootProject.runnerVersion"
androidTestCompile "com.android.support.test:rules:$rootProject.runnerVersion"
// Espresso UI Testing dependencies.
androidTestCompile "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
androidTestCompile "com.android.support.test.espresso:espresso-intents:$rootProject.espressoVersion"
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
apply plugin: 'com.google.gms.google-services'
def commitSha() {
def file = new File(project.buildDir, "commit-sha.txt")
if (file.exists()) {
return file.text
}
def value = getHeadGitCommit().abbreviatedId
file.parentFile.mkdirs()
file.text = value
return value
}
def commitTime() {
def file = new File(project.buildDir, "commit-timestamp.txt")
if (file.exists()) {
return file.text
}
def date = getHeadGitCommit().date
def value = date.format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
file.parentFile.mkdirs()
file.text = value
return value
}
@SuppressWarnings("GroovyAssignabilityCheck")
private Commit getHeadGitCommit() {
Grgit.open(dir: rootProject.file('.')).head()
}