pEp for Java
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

166 lines
4.2 KiB

// Android pEp JNI adapter Aar gradle build script
def pEpEngineSrc = hasProperty('pEpEngineSrc') ? pEpEngineSrc : "../../pEpEngine"
def buildAutomatic = hasProperty('buildAutomatic') ? buildAutomatic : "true"
def pEpAppPackageName = hasProperty('pEpAppPackageName') ? pEpAppPackageName : "pep.android.k9"
def libetpanAndroid = file('external/libetpan/build-android')
def pEpEngineDB = new File(new File(pEpEngineSrc), 'db')
buildscript {
repositories {
jcenter()
//maven {url 'https://maven.google.com'}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
//classpath 'com.android.tools.build:gradle:2.2.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
externalNativeBuild {
ndkBuild {
abiFilters "armeabi-v7a"
}
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
// where to find generated Java source
java.srcDirs = ['../src', 'src']
assets.srcDirs = ['assets', 'external/assets']
}
}
dependencies {
compile 'commons-io:commons-io:2.4'
}
lintOptions {
abortOnError false
}
buildTypes {
release {
jniDebuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
jniDebuggable true
externalNativeBuild {
ndkBuild {
arguments '-B', 'NDK_DEBUG=1', 'NDEBUG=null', 'NDK_LOG=1'
}
}
}
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
ext {
//FIXME> improve that build to be able to build without the need of unzip deps // Get rid of unziping
libEtPanZip = new File(libetpanAndroid, 'libetpan-android-1.zip')
}
// call source generation makefile target
task genSources(type:Exec, dependsOn: 'genpEpEngineSyncSources') {
workingDir '../src'
commandLine 'make', 'gensource'
}
task genpEpEngineSyncSources(type:Exec, dependsOn: 'genpEpEngineAsn1Sources') {
workingDir '../../pEpEngine'
commandLine 'make', '-C', 'sync'
}
task genpEpEngineAsn1Sources(type:Exec) {
workingDir '../../pEpEngine'
commandLine 'make', '-C', 'asn.1', 'generate'
}
task cleanGenSource(type:Exec) {
workingDir '../src'
commandLine 'make', 'clean'
}
// call external build (GnuPG, GPGME, etc)
task buildExternal(type:Exec, dependsOn: 'genSources') {
workingDir 'external'
commandLine 'make', 'build', 'PEP_PACKAGE_NAME='+pEpAppPackageName
}
task externalAssets(type:Exec) {
workingDir 'external'
commandLine 'make', 'assets', 'PEP_PACKAGE_NAME='+pEpAppPackageName
}
task cleanExternal(type:Exec) {
workingDir 'external'
commandLine 'make', 'clean', 'PEP_PACKAGE_NAME='+pEpAppPackageName
}
task cleanExternalAssets(type:Exec) {
workingDir 'external'
commandLine 'make', 'clean-assets', 'PEP_PACKAGE_NAME='+pEpAppPackageName
}
// unzip some of the dependencies
task unzipDeps(type: Copy, dependsOn: 'buildExternal') {
from zipTree(libEtPanZip)
into file("${buildDir}")
}
// builds pEpEnginge's system.db
task buildpEpEngineSystemDB(type:Exec) {
workingDir pEpEngineDB
commandLine 'make', 'system.db'
}
// copy pEpEnginge's system.db to asset
task cpDBAssets(type: Copy, dependsOn: 'buildpEpEngineSystemDB') {
from file(new File(pEpEngineDB, 'system.db'))
into 'assets'
}
if(buildAutomatic == "true") {
buildpEpEngineSystemDB.dependsOn(unzipDeps)
}
// This ensures that assets are populated before collecting resources.
preBuild.dependsOn(cpDBAssets)
preBuild.dependsOn(externalAssets)
}