chiark / gitweb /
Merge branch 'support-vagrant-cachier' into 'master'
[fdroidserver.git] / tests / source-files / open-keychain / open-keychain / OpenKeychain / build.gradle
1 apply plugin: 'com.android.application'
2 apply plugin: 'witness'
3 apply plugin: 'jacoco'
4 apply plugin: 'com.github.kt3k.coveralls'
5
6 dependencies {
7     // NOTE: Always use fixed version codes not dynamic ones, e.g. 0.7.3 instead of 0.7.+, see README for more information
8     // NOTE: libraries are pinned to a specific build, see below
9
10     // from local Android SDK
11     compile 'com.android.support:support-v4:22.1.1'
12     compile 'com.android.support:appcompat-v7:22.1.1'
13     compile 'com.android.support:recyclerview-v7:22.1.0'
14     compile 'com.android.support:cardview-v7:22.1.0'
15     
16     // Unit tests in the local JVM with Robolectric
17     // https://developer.android.com/training/testing/unit-testing/local-unit-tests.html
18     // https://github.com/nenick/AndroidStudioAndRobolectric
19     // http://www.vogella.com/tutorials/Robolectric/article.html
20     testCompile 'junit:junit:4.12'
21     testCompile 'org.robolectric:robolectric:3.0-rc3'
22
23     // UI testing with Espresso
24     androidTestCompile 'com.android.support.test:runner:0.3'
25     androidTestCompile 'com.android.support.test:rules:0.3'
26     androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
27     androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2') {
28         exclude group: 'com.android.support', module: 'appcompat'
29         exclude group: 'com.android.support', module: 'support-v4'
30         exclude module: 'recyclerview-v7'
31     }
32
33     // Temporary workaround for bug: https://code.google.com/p/android-test-kit/issues/detail?id=136
34     // from https://github.com/googlesamples/android-testing/blob/master/build.gradle#L21
35     configurations.all {
36         resolutionStrategy.force 'com.android.support:support-annotations:22.1.1'
37     }
38
39     // JCenter etc.
40     compile 'com.eftimoff:android-patternview:1.0.1@aar'
41     compile 'com.journeyapps:zxing-android-embedded:2.3.0@aar'
42     compile 'com.journeyapps:zxing-android-integration:2.3.0@aar'
43     compile 'com.google.zxing:core:3.2.0'
44     compile 'com.jpardogo.materialtabstrip:library:1.0.9'
45     compile 'com.getbase:floatingactionbutton:1.9.0'
46     compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.0'
47     compile 'com.splitwise:tokenautocomplete:1.3.3@aar'
48     compile 'se.emilsjolander:stickylistheaders:2.6.0'
49     compile 'org.sufficientlysecure:html-textview:1.1'
50     compile 'com.mikepenz.materialdrawer:library:2.8.2@aar'
51     compile 'com.mikepenz.iconics:library:0.9.1@aar'
52     compile 'com.mikepenz.iconics:octicons-typeface:2.2.0@aar'
53     compile 'com.mikepenz.iconics:meteocons-typeface:1.1.1@aar'
54     compile 'com.mikepenz.iconics:community-material-typeface:1.0.0@aar'
55     compile 'com.nispok:snackbar:2.10.8'
56
57     // libs as submodules
58     compile project(':extern:openpgp-api-lib:openpgp-api')
59     compile project(':extern:openkeychain-api-lib:openkeychain-intents')
60     compile project(':extern:spongycastle:core')
61     compile project(':extern:spongycastle:pg')
62     compile project(':extern:spongycastle:pkix')
63     compile project(':extern:spongycastle:prov')
64     compile project(':extern:minidns')
65     compile project(':extern:KeybaseLib:Lib')
66     compile project(':extern:safeslinger-exchange')
67 }
68
69 // Output of ./gradlew -q calculateChecksums
70 // Comment out the libs referenced as git submodules!
71 dependencyVerification {
72     verify = [
73             'com.android.support:support-v4:1e2e4d35ac7fd30db5ce3bc177b92e4d5af86acef2ef93e9221599d733346f56',
74             'com.android.support:appcompat-v7:9a2355537c2f01cf0b95523605c18606b8d824017e6e94a05c77b0cfc8f21c96',
75             'com.android.support:recyclerview-v7:522d323079a29bcd76173bd9bc7535223b4af3e5eefef9d9287df1f9e54d0c10',
76             'com.android.support:cardview-v7:8dc99af71fec000baa4470c3907755264f15f816920861bc015b2babdbb49807',
77             'com.eftimoff:android-patternview:cec80e7265b8d8278b3c55b5fcdf551e4600ac2c8bf60d8dd76adca538af0b1e',
78             'com.journeyapps:zxing-android-embedded:702a4f58154dbd9baa80f66b6a15410f7a4d403f3e73b66537a8bfb156b4b718',
79             'com.journeyapps:zxing-android-integration:562737821b6d34c899b6fd2234ce0a8a31e02ff1fd7c59f6211961ce9767c7c8',
80             'com.google.zxing:core:7fe5a8ff437635a540e56317649937b768b454795ce999ed5f244f83373dee7b',
81             'com.jpardogo.materialtabstrip:library:c6ef812fba4f74be7dc4a905faa4c2908cba261a94c13d4f96d5e67e4aad4aaa',
82             'com.getbase:floatingactionbutton:052aa2a94e49e5dccc97cb99f2add87e8698b84859f0e3ac181100c0bc7640ca',
83             'org.commonjava.googlecode.markdown4j:markdown4j:e952e825d29e1317d96f79f346bfb6786c7c5eef50bd26e54a80823704b62e13',
84             'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb',
85             'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4',
86             'org.sufficientlysecure:html-textview:ca24b1522be88378634093815ce9ff1b4920c72e7513a045a7846e14069ef988',
87             'com.mikepenz.materialdrawer:library:970317ed1a3cb96317f7b8d62ff592b3103eb46dfd68d9b244e7143623dc6d7a',
88             'com.mikepenz.iconics:library:4698a36ee4c2af765d0a85779c61474d755b90d66a59020105b6760a8a909e9e',
89             'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be',
90             'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b',
91             'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f',
92             'com.nispok:snackbar:80bebc8e5d8b3d728cd5f2336e2d0c1cc2a6b7dc4b55d36acd6b75a78265590a',
93 //            'OpenKeychain.extern:openpgp-api-lib:f05a9215cdad3a6597e4c5ece6fcec92b178d218195a3e88d2c0937c48dd9580',
94 //            'OpenKeychain.extern:openkeychain-api-lib:50f6ebb5452d3fdc7be137ccf857a0ff44d55539fcb7b91baef495766ed7f429',
95 //            'com.madgag.spongycastle:core:df8fcc028a95ac5ffab3b78c9163f5cfa672e41cd50128ca55d458b6cfbacf4b',
96 //            'com.madgag.spongycastle:pg:160b345b10a2c92dc731453eec87037377f66a8e14a0648d404d7b193c4e380d',
97 //            'com.madgag.spongycastle:pkix:0b4f3301ea12dd9f25d71770e6ea9f75e0611bf53062543e47be5bc15340a7e4',
98 //            'com.madgag.spongycastle:prov:7325942e0b39f5fb35d6380818eed4b826e7dfc7570ad35b696d778049d8c36a',
99 //            'OpenKeychain.extern:minidns:77b1786d29469e3b21f9404827cab811edc857cd68bc732cd57f11307c332eae',
100 //            'OpenKeychain.extern.KeybaseLib:Lib:c91cda4a75692d8664644cd17d8ac962ce5bc0e266ea26673a639805f1eccbdf',
101 //            'OpenKeychain.extern:safeslinger-exchange:d222721bb35408daaab9f46449364b2657112705ee571d7532f81cbeb9c4a73f',
102 //            'OpenKeychain.extern.snackbar:lib:52357426e5275412e2063bdf6f0e6b957a3ea74da45e0aef35d22d9afc542e23',
103             'com.android.support:support-annotations:7bc07519aa613b186001160403bcfd68260fa82c61cc7e83adeedc9b862b94ae',
104     ]
105 }
106
107 android {
108     compileSdkVersion rootProject.ext.compileSdkVersion
109     buildToolsVersion rootProject.ext.buildToolsVersion
110
111     defaultConfig {
112         minSdkVersion 15
113         targetSdkVersion 22
114         versionCode 32300
115         versionName "3.2.3"
116         applicationId "org.sufficientlysecure.keychain"
117         // the androidjunitrunner is broken regarding coverage, see here:
118         // https://code.google.com/p/android/issues/detail?id=170607
119         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
120         // this workaround runner fixes the coverage problem, BUT doesn't work
121         // with android studio single test execution. use it to generate coverage
122         // data, but keep the other one otherwis
123         // testInstrumentationRunner "org.sufficientlysecure.keychain.JacocoWorkaroundJUnitRunner"
124     }
125
126     compileOptions {
127         sourceCompatibility JavaVersion.VERSION_1_7
128         targetCompatibility JavaVersion.VERSION_1_7
129     }
130     
131     buildTypes {
132         release {
133             minifyEnabled true
134             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
135             
136             // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
137             buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\""
138
139             // Reference them in .xml files.
140             resValue "string", "account_type", "org.sufficientlysecure.keychain.account"
141         }
142
143         debug {
144             applicationIdSuffix ".debug"
145             
146             // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
147             buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\""
148
149             // Reference them in .xml files.
150             resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account"
151             
152             // Enable code coverage (Jacoco)
153             testCoverageEnabled true
154         }
155     }
156
157     /*
158      * To sign release build, create file gradle.properties in ~/.gradle/ with this content:
159      *
160      * signingStoreLocation=/home/key.store
161      * signingStorePassword=xxx
162      * signingKeyAlias=alias
163      * signingKeyPassword=xxx
164      */
165     if (project.hasProperty('signingStoreLocation') &&
166             project.hasProperty('signingStorePassword') &&
167             project.hasProperty('signingKeyAlias') &&
168             project.hasProperty('signingKeyPassword')) {
169         println "Found sign properties in gradle.properties! Signing build…"
170
171         signingConfigs {
172             release {
173                 storeFile file(signingStoreLocation)
174                 storePassword signingStorePassword
175                 keyAlias signingKeyAlias
176                 keyPassword signingKeyPassword
177             }
178         }
179
180         buildTypes.release.signingConfig = signingConfigs.release
181     } else {
182         buildTypes.release.signingConfig = null
183     }
184
185     // NOTE: Lint is disabled because it slows down builds,
186     // to enable it comment out the code at the bottom of this build.gradle
187     lintOptions {
188         // Do not abort build if lint finds errors
189         abortOnError false
190
191         checkAllWarnings true
192         htmlReport true
193         htmlOutput file('lint-report.html')
194     }
195
196     // Disable preDexing, causes com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000) on some systems
197     dexOptions {
198         preDexLibraries = false
199     }
200
201     packagingOptions {
202         exclude 'LICENSE.txt'
203     }
204 }
205
206 // apply plugin: 'spoon'
207
208 task jacocoTestReport(type:JacocoReport) {
209     group = "Reporting"
210     description = "Generate Jacoco coverage reports"
211
212     classDirectories = fileTree(
213             dir: "${buildDir}/intermediates/classes/debug",
214             excludes: ['**/R.class',
215                        '**/R$*.class',
216                        '**/*$ViewInjector*.*',
217                        '**/BuildConfig.*',
218                        '**/Manifest*.*']
219     )
220
221     sourceDirectories = files("${buildDir.parent}/src/main/java")
222     additionalSourceDirs = files([
223             "${buildDir}/generated/source/buildConfig/debug",
224             "${buildDir}/generated/source/r/debug"
225     ])
226     executionData = files([
227         "${buildDir}/jacoco/testDebug.exec",
228         "${buildDir}/outputs/code-coverage/connected/coverage.ec"
229     ])
230
231     reports {
232         xml.enabled = true
233         html.enabled = true
234     }
235 }
236
237 // Fix for: No report file available: [/home/travis/build/open-keychain/open-keychain/OpenKeychain/build/reports/cobertura/coverage.xml, /home/travis/build/open-keychain/open-keychain/OpenKeychain/build/reports/jacoco/test/jacocoTestReport.xml]
238 coveralls {
239     jacocoReportPath 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
240 }
241
242 // NOTE: This disables Lint!
243 tasks.whenTaskAdded { task ->
244     if (task.name.contains('lint')) {
245         task.enabled = false
246     }
247 }
248