aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/build.gradle
blob: 9b80e632f54c81bf0c99cb4b5fba03b79f49c60b (plain)
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
apply plugin: 'com.android.application'
apply plugin: 'witness'
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'

dependencies {
    // NOTE: Always use fixed version codes not dynamic ones, e.g. 0.7.3 instead of 0.7.+, see README for more information
    // NOTE: libraries are pinned to a specific build, see below

    // from local Android SDK
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:design:22.2.0'
    compile 'com.android.support:recyclerview-v7:22.2.0'
    compile 'com.android.support:cardview-v7:22.2.0'

    // Unit tests in the local JVM with Robolectric
    // https://developer.android.com/training/testing/unit-testing/local-unit-tests.html
    // http://robolectric.org/getting-started/
    // http://www.vogella.com/tutorials/Robolectric/article.html
    testCompile 'junit:junit:4.12'
    testCompile 'org.robolectric:robolectric:3.0'

    // UI testing with Espresso
    androidTestCompile 'com.android.support.test:runner:0.3'
    androidTestCompile 'com.android.support.test:rules:0.3'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
    androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'
    androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude module: 'recyclerview-v7'
    }

    // Temporary workaround for bug: https://code.google.com/p/android-test-kit/issues/detail?id=136
    // from https://github.com/googlesamples/android-testing/blob/master/build.gradle#L21
    configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:22.2.0'
    }

    // JCenter etc.
    compile 'com.eftimoff:android-patternview:1.0.1@aar'
    compile 'com.journeyapps:zxing-android-embedded:2.3.0@aar'
    compile 'com.journeyapps:zxing-android-integration:2.3.0@aar'
    compile 'com.google.zxing:core:3.2.0'
    compile 'com.jpardogo.materialtabstrip:library:1.0.9'
    compile 'com.getbase:floatingactionbutton:1.9.0'
    compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.0'
    compile 'com.splitwise:tokenautocomplete:1.3.3@aar'
    compile 'se.emilsjolander:stickylistheaders:2.6.0'
    compile 'org.sufficientlysecure:html-textview:1.2'
    compile 'com.mikepenz:materialdrawer:3.0.9@aar'
    compile 'com.mikepenz:iconics:1.0.2'
    compile 'com.mikepenz.iconics:octicons-typeface:2.2.0@aar'
    compile 'com.mikepenz.iconics:meteocons-typeface:1.1.1@aar'
    compile 'com.mikepenz.iconics:community-material-typeface:1.0.0@aar'
    compile 'com.nispok:snackbar:2.11.0'
    compile 'com.squareup.okhttp:okhttp:2.4.0'

    // libs as submodules
    compile project(':extern:openpgp-api-lib:openpgp-api')
    compile project(':extern:openkeychain-api-lib:openkeychain-intents')
    compile project(':extern:spongycastle:core')
    compile project(':extern:spongycastle:pg')
    compile project(':extern:spongycastle:pkix')
    compile project(':extern:spongycastle:prov')
    compile project(':extern:minidns')
    compile project(':extern:KeybaseLib:Lib')
    compile project(':extern:safeslinger-exchange:safeslinger-exchange')
}

// Output of ./gradlew -q calculateChecksums
// Comment out the libs referenced as git submodules!
dependencyVerification {
    verify = [
            'com.android.support:support-v4:7bb6e40a18774aa2595e4d8f9fe0ae14e61670f71a1279272fb0b79b8be71180',
            'com.android.support:appcompat-v7:2d5867698410b41f75140c91d6c1e58da74ae0f97baf6e0bdd1f7cc1017ceb2c',
            'com.android.support:design:41ff5f700d1bf8c190e1d3ac33582f92ad6e1f3b1080c8b8e2ac4f7b703be76a',
            'com.android.support:recyclerview-v7:3a8da14585fa1c81f06e7cef4d93a7641f0323d8f984ff9a7bd7a6e416b46888',
            'com.android.support:cardview-v7:15b934f69f10d85f5adc12231ba1b708618a7daf6e5102af42addf2c67a85e2c',
            'com.eftimoff:android-patternview:cec80e7265b8d8278b3c55b5fcdf551e4600ac2c8bf60d8dd76adca538af0b1e',
            'com.journeyapps:zxing-android-embedded:702a4f58154dbd9baa80f66b6a15410f7a4d403f3e73b66537a8bfb156b4b718',
            'com.journeyapps:zxing-android-integration:562737821b6d34c899b6fd2234ce0a8a31e02ff1fd7c59f6211961ce9767c7c8',
            'com.google.zxing:core:7fe5a8ff437635a540e56317649937b768b454795ce999ed5f244f83373dee7b',
            'com.jpardogo.materialtabstrip:library:c6ef812fba4f74be7dc4a905faa4c2908cba261a94c13d4f96d5e67e4aad4aaa',
            'com.getbase:floatingactionbutton:052aa2a94e49e5dccc97cb99f2add87e8698b84859f0e3ac181100c0bc7640ca',
            'org.commonjava.googlecode.markdown4j:markdown4j:e952e825d29e1317d96f79f346bfb6786c7c5eef50bd26e54a80823704b62e13',
            'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb',
            'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4',
            'org.sufficientlysecure:html-textview:1d3bed31ef837437154de8d2362a0e6b0e59b6c3535d87ee48c2fab12c84f9bb',
            'com.mikepenz:materialdrawer:70c3efb3842461db41df6a918ea93969a7da21e63c092be838b153e5a47a17bf',
            'com.mikepenz:iconics:c1a02203d8e0d638959463c00af3ab9096e0a7c1ad5928762eb10ef5ce8a63cd',
            'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be',
            'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b',
            'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f',
            'com.squareup.okhttp:okhttp:bc0da7ac1f5441619faa2082811938acf7df97e4a8e08f0e043ff4937414d5ad',
//            'OpenKeychain.extern.openpgp-api-lib:openpgp-api:bbbc0b964757450ec78823ec448b0754999e16c9c620e3587c14289cba8e87f8',
//            'OpenKeychain.extern.openkeychain-api-lib:openkeychain-intents:4b2f5637580b9bad786d57c32e8b86d6554e2d4ed55ccbfb028bbece655100cc',
//            'OpenKeychain.extern.spongycastle:core:4a2a3c86616944bfdaf8f3148a9e047d5007433f1af0a4b38a552b4ec94f6804',
//            'OpenKeychain.extern.spongycastle:pg:44690d345d806626d0a83eb5434ba9b52ccfcb37f5a775842333470658ffe28f',
//            'OpenKeychain.extern.spongycastle:pkix:bb08d67b726bcf09018cac43c57dfaa00bb7540d16e6e986f0378feb0fed5327',
//            'OpenKeychain.extern.spongycastle:prov:b9f0df403c1c9ac6ec7b0bb138fd8dda3d1ac72983c7a5e4a6dc9deab1d7a11e',
//            'OpenKeychain.extern:minidns:feb3bbbb3ce15e6e2a4711b35695a54f420188e4264b87116a03b8374b74eb86',
//            'OpenKeychain.extern.KeybaseLib:Lib:c80857e2347fb0a80f48a0da8aa510cdfe7c2486784af1d17fb385382f45fe6c',
//            'OpenKeychain.extern.safeslinger-exchange:safeslinger-exchange:781c4a5723b6a3c68d1178ac67908cd250d7bac6f11c39836618cc8fc8d0177f',
//            'OpenKeychain.extern.snackbar:lib:6847a73d2680558d35f0b384ac3ed006532c0a2306598b000db94ef18aab62aa',
            'com.android.support:support-annotations:beac5cae60bdb597df9af9c916f785c2f71f8c8ae4be9a32d4298dea85496a42',
            'com.squareup.okio:okio:b53c1760864e1c39b5275d9023e2a6fbe8f3189e6e67b4c87877b8ec8f92e05a',
            'com.nispok:snackbar:46b5eb9d630d329e13c2ce00ee9fb115ffb66c23c72cff32ee97eedd76824c6f',
    ]
}


android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 34100
        versionName "3.4.1"
        applicationId "org.sufficientlysecure.keychain"
        // the androidjunitrunner is broken regarding coverage, see here:
        // https://code.google.com/p/android/issues/detail?id=170607
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        // this workaround runner fixes the coverage problem, BUT doesn't work
        // with android studio single test execution. use it to generate coverage
        // data, but keep the other one otherwis
        // testInstrumentationRunner "org.sufficientlysecure.keychain.JacocoWorkaroundJUnitRunner"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
            buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\""

            // Reference them in .xml files.
            resValue "string", "account_type", "org.sufficientlysecure.keychain.account"
        }

        debug {
            applicationIdSuffix ".debug"

            // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
            buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\""

            // Reference them in .xml files.
            resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account"

            // Enable code coverage (Jacoco)
            testCoverageEnabled true
        }
    }

    /*
     * To sign release build, create file gradle.properties in ~/.gradle/ with this content:
     *
     * signingStoreLocation=/home/key.store
     * signingStorePassword=xxx
     * signingKeyAlias=alias
     * signingKeyPassword=xxx
     */
    if (project.hasProperty('signingStoreLocation') &&
            project.hasProperty('signingStorePassword') &&
            project.hasProperty('signingKeyAlias') &&
            project.hasProperty('signingKeyPassword')) {
        println "Found sign properties in gradle.properties! Signing build…"

        signingConfigs {
            release {
                storeFile file(signingStoreLocation)
                storePassword signingStorePassword
                keyAlias signingKeyAlias
                keyPassword signingKeyPassword
            }
        }

        buildTypes.release.signingConfig = signingConfigs.release
    } else {
        buildTypes.release.signingConfig = null
    }

    // NOTE: Lint is disabled because it slows down builds,
    // to enable it comment out the code at the bottom of this build.gradle
    lintOptions {
        // Do not abort build if lint finds errors
        abortOnError false

        checkAllWarnings true
        htmlReport true
        htmlOutput file('lint-report.html')
    }

    // Disable preDexing, causes com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000) on some systems
    dexOptions {
        preDexLibraries = false
    }

    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude '.readme'
    }
}

// apply plugin: 'spoon'

task jacocoTestReport(type:JacocoReport) {
    group = "Reporting"
    description = "Generate Jacoco coverage reports"

    classDirectories = fileTree(
            dir: "${buildDir}/intermediates/classes/debug",
            excludes: ['**/R.class',
                       '**/R$*.class',
                       '**/*$ViewInjector*.*',
                       '**/BuildConfig.*',
                       '**/Manifest*.*']
    )

    sourceDirectories = files("${buildDir.parent}/src/main/java")
    additionalSourceDirs = files([
            "${buildDir}/generated/source/buildConfig/debug",
            "${buildDir}/generated/source/r/debug"
    ])
    executionData = files([
        "${buildDir}/jacoco/testDebug.exec",
        "${buildDir}/outputs/code-coverage/connected/coverage.ec"
    ])

    reports {
        xml.enabled = true
        html.enabled = true
    }
}

// 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]
coveralls {
    jacocoReportPath 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
}

// NOTE: This disables Lint!
tasks.whenTaskAdded { task ->
    if (task.name.contains('lint')) {
        task.enabled = false
    }
}