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.
160 lines
4.1 KiB
160 lines
4.1 KiB
// Android pEp JNI adapter Aar gradle build script
|
|
|
|
def pEpEngineSrc = hasProperty('pEpEngineSrc') ? pEpEngineSrc : "../../pEpEngine"
|
|
def buildAutomatic = hasProperty('buildAutomatic') ? buildAutomatic : "true"
|
|
def threadsToUse = hasProperty('threadsToUse') ?
|
|
threadsToUse : Runtime.getRuntime().availableProcessors()
|
|
|
|
def pEpEngineDB = new File(new File(pEpEngineSrc), 'db')
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:4.1.2'
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
android {
|
|
compileSdkVersion 30
|
|
|
|
defaultConfig {
|
|
minSdkVersion 19
|
|
targetSdkVersion 30
|
|
versionCode 4
|
|
versionName "2.1.8"
|
|
|
|
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', '../src/java']
|
|
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 "-j${threadsToUse}", 'NDK_LOG=1', 'NDK_DEBUG=1', 'NDEBUG=null'
|
|
// arguments '-B', 'NDK_DEBUG=1', 'NDEBUG=null', 'NDK_LOG=1'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
externalNativeBuild {
|
|
ndkBuild {
|
|
path 'jni/Android.mk'
|
|
}
|
|
}
|
|
|
|
// call source generation makefile target
|
|
task genSources(type:Exec, dependsOn: 'genpEpEngineAsn1Sources') {
|
|
workingDir '../src'
|
|
commandLine 'make', 'lib-java'
|
|
}
|
|
|
|
task genpEpEngineSyncSources(type:Exec) {
|
|
workingDir "${pEpEngineSrc}"
|
|
commandLine 'make', "-j${threadsToUse}", '-C', 'sync'
|
|
}
|
|
|
|
|
|
task genpEpEngineAsn1Sources(type:Exec, dependsOn: 'genpEpEngineSyncSources') {
|
|
workingDir "${pEpEngineSrc}"
|
|
commandLine 'make', "-j${threadsToUse}", '-C', 'asn.1'
|
|
}
|
|
|
|
task cleanGenSource(type:Exec) {
|
|
workingDir '../src'
|
|
commandLine 'make', "-j${threadsToUse}", 'clean'
|
|
}
|
|
|
|
// call external build (GnuPG, GPGME, etc)
|
|
task buildExternal(type:Exec, dependsOn: 'genSources') {
|
|
workingDir 'external'
|
|
commandLine 'make', "-j${threadsToUse}", 'build'
|
|
}
|
|
|
|
task externalAssets(type:Exec) {
|
|
workingDir 'external'
|
|
commandLine 'make', "-j${threadsToUse}", 'assets'
|
|
}
|
|
|
|
task cleanExternal(type:Exec) {
|
|
workingDir 'external'
|
|
commandLine 'make', "-j${threadsToUse}", 'clean'
|
|
}
|
|
|
|
task cleanExternalAssets(type:Exec) {
|
|
workingDir 'external'
|
|
commandLine 'make', 'clean-assets'
|
|
}
|
|
|
|
// builds pEpEnginge's system.db
|
|
task buildpEpEngineSystemDB(type:Exec) {
|
|
workingDir pEpEngineDB
|
|
commandLine 'make', "-j${threadsToUse}", 'system.db'
|
|
}
|
|
|
|
// copy pEpEngine's system.db to asset
|
|
task cpDBAssets(type: Copy, dependsOn: 'buildpEpEngineSystemDB') {
|
|
from file(new File(pEpEngineDB, 'system.db'))
|
|
into 'assets'
|
|
}
|
|
ndkVersion '21.0.6113669'
|
|
|
|
if(buildAutomatic == "true") {
|
|
buildpEpEngineSystemDB.dependsOn(buildExternal)
|
|
}
|
|
|
|
// This ensures that assets are populated before collecting resources.
|
|
preBuild.dependsOn(cpDBAssets)
|
|
preBuild.dependsOn(externalAssets)
|
|
}
|
|
|
|
|