1- import org.apache.tools.ant.taskdefs.condition.Os
2-
31import java.text.SimpleDateFormat
42
53apply plugin : ' com.android.application'
64apply plugin : ' io.fabric'
5+ apply plugin : ' android-apt'
76
87def versionMajor = 2
98def versionMinor = 1
10- def versionPatch = 4
11- def versionBuild = 2
9+ def versionPatch = 5
10+ def versionBuild = 4
1211
1312def buildTime () {
1413 def df = new SimpleDateFormat (" yyyyMMdd HH:mm 'UTC'" )
@@ -22,8 +21,8 @@ def gitSha() {
2221
2322
2423android {
25- compileSdkVersion 23
26- buildToolsVersion ' 23 .0.3'
24+ compileSdkVersion 24
25+ buildToolsVersion ' 24 .0.3'
2726 defaultConfig {
2827 applicationId " org.gnucash.android"
2928 testApplicationId ' org.gnucash.android.test'
@@ -36,15 +35,7 @@ android {
3635 buildConfigField " boolean" , " CAN_REQUEST_RATING" , " false"
3736 buildConfigField " String" , " BUILD_TIME" , " \" ${ buildTime()} \" "
3837
39- if (project. hasProperty(" RELEASE_DROPBOX_APP_KEY" )){
40- resValue " string" , " dropbox_app_key" , RELEASE_DROPBOX_APP_KEY
41- resValue " string" , " dropbox_app_secret" , RELEASE_DROPBOX_APP_SECRET
42- resValue " string" , " manifest_dropbox_app_key" , " db-${ RELEASE_DROPBOX_APP_KEY} "
43- } else {
44- resValue " string" , " dropbox_app_key" , " dhjh8ke9wf05948"
45- resValue " string" , " dropbox_app_secret" , " h2t9fphj3nr4wkw"
46- resValue " string" , " manifest_dropbox_app_key" , " db-dhjh8ke9wf05948"
47- }
38+ multiDexEnabled true
4839 testInstrumentationRunner " org.gnucash.android.test.ui.util.GnucashAndroidTestRunner"
4940
5041 }
@@ -109,17 +100,41 @@ android {
109100 resValue " string" , " app_name" , " GnuCash-devel"
110101 versionName " ${ versionMajor} .${ versionMinor} .${ versionPatch} -dev${ versionBuild} _r${ gitSha()} "
111102 resValue " string" , " app_version_name" , " ${ versionName} "
103+
104+ resValue " string" , " dropbox_app_key" , " dhjh8ke9wf05948"
105+ resValue " string" , " dropbox_app_secret" , " h2t9fphj3nr4wkw"
106+ resValue " string" , " manifest_dropbox_app_key" , " db-dhjh8ke9wf05948"
112107 }
113108
114109 beta {
115110 resValue " string" , " app_name" , " GnuCash - beta"
116111 versionName " ${ versionMajor} .${ versionMinor} .${ versionPatch} -beta${ versionBuild} "
117112 resValue " string" , " app_version_name" , " ${ versionName} "
113+
114+ if (project. hasProperty(" RELEASE_DROPBOX_APP_KEY" )){
115+ resValue " string" , " dropbox_app_key" , RELEASE_DROPBOX_APP_KEY
116+ resValue " string" , " dropbox_app_secret" , RELEASE_DROPBOX_APP_SECRET
117+ resValue " string" , " manifest_dropbox_app_key" , " db-${ RELEASE_DROPBOX_APP_KEY} "
118+ } else {
119+ resValue " string" , " dropbox_app_key" , " dhjh8ke9wf05948"
120+ resValue " string" , " dropbox_app_secret" , " h2t9fphj3nr4wkw"
121+ resValue " string" , " manifest_dropbox_app_key" , " db-dhjh8ke9wf05948"
122+ }
118123 }
119124
120125 production {
121126 resValue " string" , " app_name" , " GnuCash"
122127 buildConfigField " boolean" , " CAN_REQUEST_RATING" , " true"
128+
129+ if (project. hasProperty(" RELEASE_DROPBOX_APP_KEY" )){
130+ resValue " string" , " dropbox_app_key" , RELEASE_DROPBOX_APP_KEY
131+ resValue " string" , " dropbox_app_secret" , RELEASE_DROPBOX_APP_SECRET
132+ resValue " string" , " manifest_dropbox_app_key" , " db-${ RELEASE_DROPBOX_APP_KEY} "
133+ } else {
134+ resValue " string" , " dropbox_app_key" , " dhjh8ke9wf05948"
135+ resValue " string" , " dropbox_app_secret" , " h2t9fphj3nr4wkw"
136+ resValue " string" , " manifest_dropbox_app_key" , " db-dhjh8ke9wf05948"
137+ }
123138 }
124139
125140 }
@@ -147,46 +162,35 @@ def initCrashlyticsPropertiesIfNeeded() {
147162 }
148163}
149164
150- def adb = Os . isFamily(Os . FAMILY_WINDOWS ) ? " ..\\ scripts\\ adb_all.bat" : " ../scripts/adb_all.sh"
151- // def adb = android.getAdbExe().toString()
152-
153165afterEvaluate {
166+ apply plugin : ' spoon'
167+ spoon {
168+ debug = true
169+ grantAllPermissions = true
170+ }
154171 initCrashlyticsPropertiesIfNeeded()
172+ }
155173
156- task grantTestPermissionsDevel(type : Exec , dependsOn : ' installDevelopmentDebug' ) { // or install{productFlavour}{buildType}
157- if (Os . isFamily(Os . FAMILY_WINDOWS )){
158- commandLine " cmd" , " /c" , " $adb " , " shell pm grant $android . productFlavors . development . applicationId android.permission.SET_ANIMATION_SCALE"
159- // commandLine "cmd", "/c", "$adb", "shell pm grant $android.productFlavors.development.applicationId android.permission.WRITE_EXTERNAL_STORAGE"
160- } else {
161- commandLine " $adb shell pm grant $android . productFlavors . development . applicationId android.permission.SET_ANIMATION_SCALE" . split(' ' )
162- // commandLine "$adb shell pm grant $android.productFlavors.development.applicationId android.permission.WRITE_EXTERNAL_STORAGE".split(' ')
163- }
164- }
174+ android. productFlavors. all { flavour ->
175+ def applicationId = flavour. applicationId
176+ def adb = android. getAdbExe(). toString()
165177
166- task grantTestPermissionsProduction(type : Exec , dependsOn : ' installProductionDebug' ){
167- if (Os . isFamily(Os . FAMILY_WINDOWS )) {
168- commandLine " cmd" , " /c" , " $adb " , " shell pm grant $android . productFlavors . development . applicationId android.permission.SET_ANIMATION_SCALE"
169- commandLine " cmd" , " /c" , " $adb " , " shell pm grant $android . productFlavors . development . applicationId android.permission.WRITE_EXTERNAL_STORAGE"
170- } else {
171- commandLine " $adb shell pm grant $android . defaultConfig . applicationId android.permission.SET_ANIMATION_SCALE" . split(' ' )
172- commandLine " $adb shell pm grant $android . defaultConfig . applicationId android.permission.WRITE_EXTERNAL_STORAGE" . split(' ' )
173- }
178+ def grantPermissionsTask = tasks. create(" grant${ flavour.name.capitalize()} Permissions" ) << {
179+ " ${ adb} shell pm grant ${ applicationId} android.permission.WRITE_EXTERNAL_STORAGE" . execute()
180+ " ${ adb} shell pm grant ${ applicationId} android.permission.SET_ANIMATION_SCALE" . execute()
174181 }
182+ grantPermissionsTask. description = " Grants permissions for Marshmallow"
175183
176- // When launching individual tests from Android Studio, it seems that only the assemble tasks
177- // get called directly, not the install* versions
178- tasks. each { task ->
179- if (task. name. startsWith(' assembleDevelopmentDebugAndroidTest' )){
180- task. dependsOn grantTestPermissionsDevel
181- } else if (task. name. startsWith(' assembleBetaDebugAndroidTest' )){
182- task. dependsOn grantTestPermissionsProduction
183- } else if (task. name. startsWith(' assembleProductionDebugAndroidTest' )){
184- task. dependsOn grantTestPermissionsProduction
184+ tasks. whenTaskAdded { theTask ->
185+ def assemblePattern = ~" assemble${flavour.name.capitalize()}DebugAndroidTest"
186+ if (assemblePattern. matcher(theTask. name). matches()) {
187+ theTask. dependsOn grantPermissionsTask. name
185188 }
186189 }
187190}
188191
189- def androidSupportVersion = " 23.3.0"
192+
193+ def androidSupportVersion = " 24.2.1"
190194def androidEspressoVersion = " 2.2.2"
191195def androidSupportTestVersion = " 0.5"
192196
@@ -205,21 +209,25 @@ dependencies {
205209 ' com.android.support:cardview-v7:' + androidSupportVersion,
206210 ' com.android.support:preference-v7:' + androidSupportVersion,
207211 ' com.android.support:recyclerview-v7:' + androidSupportVersion,
208- ' com.viewpagerindicator:library:2.4.1@aar' ,
209- ' com.code-troopers.betterpickers:library:2.5.5' ,
212+ ' com.code-troopers.betterpickers:library:3.0.1' ,
210213 ' org.jraf:android-switch-backport:2.0.1@aar' ,
211214 ' com.github.PhilJay:MPAndroidChart:v2.1.3' ,
212- ' joda-time:joda-time:2.7' ,
213- ' com.google.android.gms:play-services-drive:8.3.0' ,
214- ' com.jakewharton:butterknife:7.0.1' ,
215- ' io.github.kobakei:ratethisapp:1.0.3' ,
215+ ' joda-time:joda-time:2.9.4' ,
216+ ' com.google.android.gms:play-services-drive:9.6.1' ,
217+ ' io.github.kobakei:ratethisapp:1.1.0' ,
216218 ' com.squareup:android-times-square:1.6.5@aar' ,
217219 ' com.github.techfreak:wizardpager:1.0.3' ,
218- ' net.objecthunter:exp4j:0.4.5' ,
219- ' org.apache.jackrabbit:jackrabbit-webdav:2.11.1'
220+ ' net.objecthunter:exp4j:0.4.7' ,
221+ ' org.apache.jackrabbit:jackrabbit-webdav:2.13.3' ,
222+ ' com.dropbox.core:dropbox-core-sdk:2.1.2' ,
223+ ' com.facebook.stetho:stetho:1.4.1' ,
224+ ' com.android.support:multidex:1.0.1'
220225 )
221226
222- compile (' com.uservoice:uservoice-android-sdk:1.2.+' ) {
227+ compile ' com.jakewharton:butterknife:8.4.0'
228+ apt ' com.jakewharton:butterknife-compiler:8.4.0'
229+
230+ compile (' com.uservoice:uservoice-android-sdk:1.2.5' ) {
223231 exclude module : ' commons-logging'
224232 exclude module : ' httpcore'
225233 exclude module : ' httpclient'
@@ -229,13 +237,14 @@ dependencies {
229237 transitive = true ;
230238 }
231239
232- compile ' com.facebook.stetho:stetho:1.3.1'
233240
234- testCompile(' org.robolectric:robolectric:3.1' ,
241+ testCompile(' org.robolectric:robolectric:3.1.2 ' ,
235242 ' junit:junit:4.12' ,
236- ' joda-time:joda-time:2.7 ' ,
243+ ' joda-time:joda-time:2.9.4 ' ,
237244 ' org.assertj:assertj-core:1.7.1'
238245 )
246+ testCompile ' org.robolectric:shadows-multidex:3.0'
247+
239248 androidTestCompile (' com.android.support:support-annotations:' + androidSupportVersion,
240249 ' com.android.support.test:runner:' + androidSupportTestVersion,
241250 ' com.android.support.test:rules:' + androidSupportTestVersion,
@@ -252,4 +261,6 @@ dependencies {
252261 androidTestCompile(' com.squareup.assertj:assertj-android:1.1.1' ){
253262 exclude group : ' com.android.support' , module :' support-annotations'
254263 }
264+
265+ androidTestCompile ' com.squareup.spoon:spoon-client:1.6.4'
255266}
0 commit comments