open-keychain/OpenKeychain/build.gradle
Dominik Schürmann 335cce4101 Version 5.7.5
2021-04-30 10:53:15 +02:00

268 lines
11 KiB
Groovy

apply plugin: 'com.android.application'
apply plugin: 'com.squareup.sqldelight'
dependencies {
// from local Android SDK
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
// JCenter etc.
implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
implementation 'com.google.zxing:core:3.4.0'
implementation 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1'
implementation 'org.sufficientlysecure:donations:2.5'
implementation 'com.squareup.okhttp3:okhttp:3.13.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
implementation 'org.apache.james:apache-mime4j-core:0.8.1'
implementation 'org.apache.james:apache-mime4j-dom:0.8.1'
// UI
implementation 'org.sufficientlysecure:html-textview:3.1'
implementation 'com.jpardogo.materialtabstrip:library:1.1.1'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.nispok:snackbar:2.11.0'
implementation 'com.cocosw:bottomsheet:1.5.0@aar'
// RecyclerView
implementation 'eu.davidea:flexible-adapter:5.1.0'
implementation 'eu.davidea:flexible-adapter-ui:1.0.0-b5'
implementation 'eu.davidea:flexible-adapter-livedata:1.0.0-b2'
// Material Drawer
implementation 'com.mikepenz:materialdrawer:6.1.2@aar'
implementation 'com.mikepenz:fastadapter:3.3.0'
implementation 'com.mikepenz:fastadapter-extensions-expandable:3.3.0'
implementation 'com.mikepenz:materialize:1.2.1'
implementation 'com.mikepenz:iconics-core:3.1.0@aar'
implementation 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
implementation 'com.mikepenz:fontawesome-typeface:5.3.1.1@aar'
implementation 'com.mikepenz:community-material-typeface:1.5.54.2@aar'
// Nordpol
implementation 'com.fidesmo:nordpol-android:0.1.22'
// libs as submodules
implementation project(':openpgp-api-lib')
implementation project(':nfcsweetspot')
implementation project(':sshauthentication-api')
implementation project(':extern:MaterialChipsInput')
// implementation project(':openkeychain:extern:bouncycastle:core')
implementation 'org.bouncycastle:bcprov-jdk15on:1.68'
implementation project(':extern:bouncycastle:pg')
// implementation project(':openkeychain:extern:bouncycastle:prov')
implementation 'androidx.work:work-runtime:2.3.4'
// 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
testImplementation 'junit:junit:4.13'
testImplementation ('org.robolectric:robolectric:3.8') {
exclude group: 'org.bouncycastle', module: 'bcprov-jdk16'
}
testImplementation 'org.mockito:mockito-core:2.18.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'org.glassfish:javax.annotation:10.0-b28'
api "com.google.auto.value:auto-value-annotations:1.6.5"
annotationProcessor "com.google.auto.value:auto-value:1.6.2"
implementation 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.6'
annotationProcessor "com.ryanharter.auto.value:auto-value-parcel:0.2.6"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'
implementation 'androidx.sqlite:sqlite-framework:2.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// for debugging the db. don't enable by default, this will expose the database no the network!
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.3'
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion 15
targetSdkVersion 29
versionCode 57500
versionName "5.7.5"
applicationId "org.sufficientlysecure.keychain"
// the androidjunitrunner is broken regarding coverage, see here:
// https://code.google.com/p/android/issues/detail?id=170607
testInstrumentationRunner "androidx.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_8
targetCompatibility JavaVersion.VERSION_1_8
}
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-base.pro',
'proguard-rules-bouncycastle.pro',
'proguard-rules-okio.pro',
'proguard-rules-okhttp.pro',
'proguard-rules-support.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 {
// ProGuard disabled for debug builds, instead multidex is enabled!
// faster consecutive build times for developing, https://github.com/open-keychain/open-keychain/pull/2247
minifyEnabled false
//proguardFiles = buildTypes.release.proguardFiles
//testProguardFiles 'proguard-rules-test.pro'
multiDexEnabled true
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
matchingFallbacks = ['debug'] // instead use this
}
}
flavorDimensions("freedom")
productFlavors {
google {
dimension "freedom"
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 {
dimension "freedom"
buildConfigField "boolean", "DONATIONS_GOOGLE", "false"
buildConfigField "String", "GOOGLE_PLAY_PUBKEY", "null"
buildConfigField "String", "PAYPAL_USER", "\"android@schuermann.eu\""
buildConfigField "String", "PAYPAL_CURRENCY_CODE", "\"EUR\""
buildConfigField "String", "BITCOIN_ADDRESS", "\"1LY6Hs6SurATjfxnihzLMDUMUuMxvQ4aEi\""
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\""
}
}
variantFilter { variant ->
if(variant.buildType.name == 'debug' && variant.getFlavors().get(0).name == 'google') {
variant.setIgnore(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')
}
dexOptions {
preDexLibraries true
// dexInProcess requires much RAM, which is not available on all dev systems
dexInProcess false
jumboMode true
javaMaxHeapSize "2g"
}
buildFeatures {
dataBinding true
}
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'
}
}