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.
 
 
 
 
 
 

170 lines
4.4 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 {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
externalNativeBuild {
ndkBuild {
abiFilters "armeabi-v7a"
//abiFilters ["armeabi-v7a"]
//abiFilters ["arm64-v8a, armeabi-v7a"]
}
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
// where to find generated Java source
java.srcDirs = ['../src', 'src']
jniLibs.srcDirs = ['libs',
// 'external/data/data/security.pEp/app_opt/lib'
]
assets.srcDirs = ['assets', 'external/assets']
resources.srcDirs = ['res']
}
}
dependencies {
implementation '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: 'genpEpEngineAsn1Sources') {
workingDir '../src'
commandLine 'make', 'pEp.jar'
}
task genpEpEngineSyncSources(type:Exec) {
workingDir '../../pEpEngine'
commandLine 'make', '-C', 'sync'
}
task genpEpEngineAsn1Sources(type:Exec, dependsOn: 'genpEpEngineSyncSources') {
workingDir '../../pEpEngine'
commandLine 'make', '-C', 'asn.1'
}
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)
}