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:25.0.0' compile 'com.android.support:appcompat-v7:25.0.0' compile 'com.android.support:design:25.0.0' compile 'com.android.support:recyclerview-v7:25.0.0' compile 'com.android.support:cardview-v7:25.0.0' compile 'com.android.support:support-annotations:25.0.0' // JCenter etc. compile 'com.journeyapps:zxing-android-embedded:3.4.0@aar' compile 'com.google.zxing:core:3.3.0' compile 'com.jpardogo.materialtabstrip:library:1.1.1' compile 'com.getbase:floatingactionbutton:1.10.1' compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.0' compile 'org.ocpsoft.prettytime:prettytime:4.0.1.Final' compile 'com.splitwise:tokenautocomplete:2.0.8@aar' compile 'org.sufficientlysecure:html-textview:2.0' compile 'org.sufficientlysecure:donations:2.4' compile 'com.nispok:snackbar:2.11.0' compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0' compile 'org.apache.james:apache-mime4j-core:0.8.0' compile 'org.apache.james:apache-mime4j-dom:0.8.0' compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0' compile 'com.cocosw:bottomsheet:1.3.0@aar' compile 'se.emilsjolander:stickylistheaders:2.7.0' compile 'com.tonicartos:superslim:0.4.13' compile 'com.futuremind.recyclerfastscroll:fastscroll:0.2.4' // Material Drawer compile 'com.mikepenz:materialdrawer:5.6.0@aar' compile 'com.mikepenz:fastadapter:1.8.2' compile 'com.mikepenz:materialize:1.0.0' compile 'com.mikepenz:iconics-core:2.8.1@aar' compile 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar' compile 'com.mikepenz:fontawesome-typeface:4.6.0.3@aar' compile 'com.mikepenz:community-material-typeface:1.5.54.2@aar' // Nordpol compile 'com.fidesmo:nordpol-android:0.1.18' // libs as submodules compile project(':openpgp-api-lib') compile project(':openkeychain-api-lib') compile project(':extern:bouncycastle:core') compile project(':extern:bouncycastle:pg') compile project(':extern:bouncycastle:prov') compile project(':extern:minidns') compile project(':KeybaseLib') compile project(':safeslinger-exchange') // 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.1.2') { exclude group: 'org.bouncycastle', module: 'bcprov-jdk16' } testCompile 'org.mockito:mockito-core:1.10.19' // UI testing with Espresso // Force usage of support libs in the test app, since they are internally used by the runner module. // https://github.com/googlesamples/android-testing/blob/master/ui/espresso/BasicSample/app/build.gradle#L28 androidTestCompile 'com.android.support:support-annotations:25.0.0' androidTestCompile 'com.android.support:appcompat-v7:25.0.0' androidTestCompile 'com.android.support:design:25.0.0' androidTestCompile 'com.android.support.test:runner:0.5' androidTestCompile 'com.android.support.test:rules:0.5' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2' androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.2') { exclude group: 'com.android.support', module: 'appcompat' exclude group: 'com.android.support', module: 'support-v4' exclude module: 'recyclerview-v7' } } // Output of ./gradlew -q calculateChecksums // Comment out the libs referenced as git submodules! dependencyVerification { verify = [ 'com.android.support:support-v4:c25c657954152c4315584572f5008a6780b086169519f67acd20c2617b9da325', 'com.android.support:appcompat-v7:bc0b13b1ba63ed226ae509044c880fdfe225cb86d21924ef19f2fb97a71c877e', 'com.android.support:design:2fc13bacb1d293e3f35d9de509da6be6f5f0f50cf8c3796296fabbd63d76e9ab', 'com.android.support:recyclerview-v7:fc6d6a9b802ed3a26789812f29167135cac7b4d956f4deda54fc1f317721da64', 'com.android.support:cardview-v7:b9b214512995fd98490466bd98af08404866369e9526b450c0e2cf7b1e607bb5', 'com.android.support:support-annotations:18766c4a12f18a0d96a383bc8c84d7a9c31ba2d1721622e0af814f8413ff06ec', 'com.journeyapps:zxing-android-embedded:2422d83c2c09a7b645f516c8458ececba6a7da47b94e40778d876facf495c660', 'com.google.zxing:core:bba7724e02a997cec38213af77133ee8e24b0d5cf5fa7ecbc16a4fa93f11ee0d', 'com.jpardogo.materialtabstrip:library:4ee2f1211c302b45fb8c627cc5b240dc6b38b7aaaab1b8bffc81663e1b108013', 'com.getbase:floatingactionbutton:3edefa511aac4d90794c7b0496aca59cff2eee1e32679247b4f85acbeee05240', 'org.commonjava.googlecode.markdown4j:markdown4j:e952e825d29e1317d96f79f346bfb6786c7c5eef50bd26e54a80823704b62e13', 'org.ocpsoft.prettytime:prettytime:ef7098d973ae78b57d1a22dc37d3b8a771bf030301300e24055d676b6cdc5e75', 'com.splitwise:tokenautocomplete:f921f83ee26b5265f719b312c30452ef8e219557826c5ce5bf02e29647967939', 'org.sufficientlysecure:html-textview:302c449167f9573313e5293ccab689010e028e4d09aee2ccc2682b3211227ce7', 'org.sufficientlysecure:donations:96f8197bab26dfe41900d824f10f8f1914519cd62eedb77bdac5b223eccdf0a6', 'com.nispok:snackbar:46b5eb9d630d329e13c2ce00ee9fb115ffb66c23c72cff32ee97eedd76824c6f', 'com.squareup.okhttp3:okhttp:a41cdb7b024c56436a21e38f00b4d12e3b7e01451ffe6c4f545acba805bba03b', 'com.squareup.okhttp3:okhttp-urlconnection:7d6598a6665c166e2d4b78956a96056b9be7de192b3c923ccf4695d08e580833', 'org.apache.james:apache-mime4j-core:561987f604911e1870b2b4eabf0b0658d666c66cb1e65fba3e9e4bffe63acab9', 'org.apache.james:apache-mime4j-dom:e18717fe6d36f32e5c5f7cbeea1a9bf04645fdabc84e7e8374d9da10fd52e78d', 'org.thoughtcrime.ssl.pinning:AndroidPinning:afa1d74e699257fa75cb109ff29bac50726ef269c6e306bdeffe8223cee06ef4', 'com.cocosw:bottomsheet:4af6112a7f4cad4e2b70e5fdf1edc39f51275523a0f53011a012837dc103e597', 'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb', 'com.tonicartos:superslim:ca89b5c674660cc6918a8f8fd385065bffeee27983e0d33c7c2f0ad7b34d2d49', 'com.futuremind.recyclerfastscroll:fastscroll:ae655201885a9dbb5fabecb4adfefbb23ffdbca26a2b4ea255ec1bf6f214c606', 'com.mikepenz:materialdrawer:8bba1428dcef5ad7c2decf49c612ad980b38e2f1031cbd66c152a8a104793929', 'com.mikepenz:fastadapter:21d4ecb5c128bcda37b14e7998d799ed52cfc768b72cdf3d5578bb6775769ebd', 'com.mikepenz:materialize:942ccf5e2aa1a46803aa884e8dc7bbaf2a9e8e9996a0cf92e3fe2f44a8592ba4', 'com.mikepenz:iconics-core:478d7e245098f7c28b5b20a0e6b1e5cb108ef3eaf595af7190bc60f91063aa3d', 'com.mikepenz:google-material-typeface:f27c629ba5d2a90ecfbd7f221ff98cd363e1ee6be06b099b82bae490766e14a5', 'com.mikepenz:fontawesome-typeface:ee47b7fe97b90412f01f2fcdd78f65a4edb0ab00006f5ef59ed00516baca9309', 'com.mikepenz:community-material-typeface:d6035d261c5eba880cd7fe5dcb8cc00b09bfe6d41063b881b759e9897dc7b7c9', 'com.fidesmo:nordpol-android:56f43fe2b1676817bcb4085926de14a08282ef6729c855c198d81aec62b20d65', // 'OpenKeychain:openpgp-api-lib:8ee931094b4c596fce55907b226616b0adae614b2877a0e530f726898bf63259', // 'OpenKeychain:openkeychain-api-lib:a61e822cca9f7b34ea7750532ecd3bad7e05e6872bf218583f2a25d98c8b3c68', // 'OpenKeychain.extern.bouncycastle:core:72c07a72f304b9ff96bc4027861df5adbfbeb5dfccc740198c1d5de393980d8b', // 'OpenKeychain.extern.bouncycastle:pg:f61645e289fdbcc38b24dc2c5e9186eb9460d3eb76b7607e2dd68ed3f2115202', // 'OpenKeychain.extern.bouncycastle:prov:2dc9e69d1a2a91096716af024b02d1e29af19243127eae71f00a957be52d7f69', // 'OpenKeychain.extern:minidns:5349807fe5b2134862ad05cadc8be3fd3fb7aa55c2b129d7ba8f4904faf3333b', // 'OpenKeychain:KeybaseLib:75c70462e244d99c647da6638dea4b790455fb9f539574398ea9da7571f5ee8f', // 'OpenKeychain:safeslinger-exchange:be515e3012549b07bfdf779a262d1f8bb335a98c35c059db6563c1d0b58bde75', // 'com.android.databinding:library:def2976cb30dd5abf9f3a35d70c70cfb5485af4fb4ae022f5b9a6e2f8cff6386', // 'com.android.databinding:baseLibrary:47cb0d2d4d1aae4af3f860c31540493332a26278c016bbae90d22fdde3b0b83d', // 'com.android.databinding:adapters:0dd06349dad760f3cb56769f8e9f46451634be6a8a1bfdb2e88a5ca10afcebd6', 'com.android.support:support-compat:94648aef50a1938b541465d6d126769f20e77e247c7bca10b9b8cb61caa43398', 'com.android.support:support-media-compat:8665ae69c74b2879bdce2bdea6d3b7296126487d0ea6fa2f9dd9ffdd5a5cee86', 'com.android.support:support-core-utils:1808deca97864e78066d93d998f71bf71b0a774b6ea39c4e91fc1376d090728d', 'com.android.support:support-core-ui:cdd0e8ec4d82e30f4c8ff2897997d59330992b670023fd2793a89a226ac960d6', 'com.android.support:support-fragment:e47441b6a0e01b20cf744e3a8383ab60d922badcfde37c0b35fb078c84f2eae0', 'com.android.support:support-vector-drawable:0758104bc324c1638705cd3cddf773639679bab5af28e3a63093655113d75d20', 'com.android.support:animated-vector-drawable:9539f5dd8a919692cef064f72658034bf921a19ec14a4ff4abdfa3b478f3a3f9', 'com.android.support:transition:331d4152f878442b7bf92c4320335ec7f707d1f6248da2fb3667be436dd508d1', 'com.squareup.okio:okio:114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266', 'com.fidesmo:nordpol-core:3de58e850a00bba5b4d3a604d1399bcd89f695ea191ec0b03a57222e18062d15', ] } android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion 15 targetSdkVersion 25 versionCode 42000 versionName "4.2 beta1" 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 } testOptions.unitTests.all { // log results of tests to console, useful for travis testLogging { events 'passed', 'skipped', 'failed' //, 'standardOut', 'standardError' } } 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\"" buildConfigField "String", "PROVIDER_CONTENT_AUTHORITY", "\"org.sufficientlysecure.keychain.provider\"" // Reference them in .xml files. resValue "string", "account_type", "org.sufficientlysecure.keychain.account" resValue "string", "provider_content_authority", "org.sufficientlysecure.keychain.provider" // Github API buildConfigField "String", "GITHUB_CLIENT_ID", "\"c942cd81844d94e7e41b\"" buildConfigField "String", "GITHUB_CLIENT_SECRET", "\"f1dd17e70a0614abbd9310b00a310e23c6c8edff\"" } debug { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' testProguardFile('proguard-rules.pro') applicationIdSuffix ".debug" // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\"" buildConfigField "String", "PROVIDER_CONTENT_AUTHORITY", "\"org.sufficientlysecure.keychain.debug.provider\"" // Reference them in .xml files. resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account" resValue "string", "provider_content_authority", "org.sufficientlysecure.keychain.debug.provider" // Github API buildConfigField "String", "GITHUB_CLIENT_ID", "\"c942cd81844d94e7e41b\"" buildConfigField "String", "GITHUB_CLIENT_SECRET", "\"f1dd17e70a0614abbd9310b00a310e23c6c8edff\"" } // Workaround for http://stackoverflow.com/questions/27909613/cannot-see-parameter-value-in-android-studio-when-breakpoint-is-in-first-line-of debugWithTestCoverage.initWith(debug) debugWithTestCoverage { // Enable code coverage (Jacoco) testCoverageEnabled true } } productFlavors { google { buildConfigField "boolean", "DONATIONS_GOOGLE", "true" buildConfigField "String", "GOOGLE_PLAY_PUBKEY", "\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwX9SOQ/EL4u5pvbYmYMagN5DDenuSaMaVs2cVPzqxMaIHp6/9/nGuzj2/CpcB4ASd2vvfLlE9tZRkPmFTULWc4Sp4OR+JenQufZZr7Y8WGPkFyqd+dOxhIqKKLtH1QuqSyhby3gEMlWzydJY3rHXlH2Bpu65Uroawq76nynnELXNlzsCM231XWgj4HA87qxv9hSWLCpu16wKxZIX3d6mwZLZmGF+xYJAzVr291oDYYl+h6BDoIcAfmQFsv5MexNwBFO+TLVrvL0e5qdGHZxwwD1/68VSY8FxAEfM+yq7jovdVSdcXlJQjZrV5TRDdFWrtEB6njGA3YZWXP6B6MMMoQIDAQAB\"" buildConfigField "String", "PAYPAL_USER", "null" buildConfigField "String", "PAYPAL_CURRENCY_CODE", "null" buildConfigField "String", "BITCOIN_ADDRESS", "null" buildConfigField "String", "FLATTR_PROJECT_URL", "null" buildConfigField "String", "FLATTR_URL", "null" } fdroid { buildConfigField "boolean", "DONATIONS_GOOGLE", "false" buildConfigField "String", "GOOGLE_PLAY_PUBKEY", "null" buildConfigField "String", "PAYPAL_USER", "\"dominik@sufficientlysecure.org\"" buildConfigField "String", "PAYPAL_CURRENCY_CODE", "\"EUR\"" buildConfigField "String", "BITCOIN_ADDRESS", "\"1JZfAKTbTU5LJTkDELhPUF4Xa6VstEZgz6\"" buildConfigField "String", "FLATTR_PROJECT_URL", "\"https://www.openkeychain.org\"" buildConfigField "String", "FLATTR_URL", "\"flattr.com/submit/auto?fid=4vzg0p&url=https%3A%2F%2Fwww.openkeychain.org\"" } } /* * 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') } dexOptions { preDexLibraries = true // dexInProcess requires much RAM, which is not available on all dev systems dexInProcess = false jumboMode = true javaMaxHeapSize "2g" } packagingOptions { exclude 'LICENSE.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' exclude '.readme' } dataBinding { enabled = true } } task jacocoTestReport(type:JacocoReport, dependsOn: "testFdroidDebugWithTestCoverageUnitTest") { group = "Reporting" description = "Generate Jacoco coverage reports" classDirectories = fileTree( dir: "${buildDir}/intermediates/classes/fdroid/debugWithTestCoverage", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/BuildConfig.*', '**/Manifest*.*', '**/*Activity*.*', '**/*Fragment*.*'] ) sourceDirectories = files("${buildDir.parent}/src/main/java") additionalSourceDirs = files([ "${buildDir}/generated/source/buildConfig/fdroid/debugWithTestCoverage", "${buildDir}/generated/source/r/fdroid/debugWithTestCoverage" ]) executionData = fileTree(dir: "${buildDir}/jacoco", include: "**/*.exec") 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 } }