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.
184 lines
5.1 KiB
184 lines
5.1 KiB
// Android pEp JNI adapter Aar gradle build script
|
|
|
|
def pEpEngineSrc = hasProperty('pEpEngineSrc') ? pEpEngineSrc : "../../pEpEngine"
|
|
def libpEpTransportSrc = hasProperty('libpEpTransportSrc') ? libpEpTransportSrc : "../../libpEpTransport"
|
|
def buildAutomatic = hasProperty('buildAutomatic') ? buildAutomatic : "true"
|
|
//CHeck M1 answers the correct thing off .avaialableprocessors here
|
|
//def threadsToUse = hasProperty('threadsToUse') ?
|
|
// threadsToUse : Runtime.getRuntime().availableProcessors()
|
|
def threadsToUse = 1
|
|
|
|
def pEpEngineDB = new File(new File(pEpEngineSrc), 'db')
|
|
ext.archsToCompile = "arm arm64 x86 x86_64"
|
|
|
|
apply from: 'gradle/plugins/set-pep-jniadapter-archs.gradle'
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:4.2.2'
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
android {
|
|
compileSdkVersion 31
|
|
|
|
defaultConfig {
|
|
minSdkVersion 21
|
|
targetSdkVersion 31
|
|
versionCode 7
|
|
versionName "2.1.43"
|
|
|
|
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', '--output-sync=none'
|
|
// 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 genlibpEpTransportSources(type:Exec) {
|
|
workingDir "${libpEpTransportSrc}"
|
|
commandLine 'make', "-j${threadsToUse}"
|
|
}
|
|
|
|
task genpEpEngineSyncSources(type:Exec, dependsOn: 'genlibpEpTransportSources') {
|
|
workingDir "${pEpEngineSrc}"
|
|
commandLine 'make', "-j${threadsToUse}", '-C', 'codegen'
|
|
}
|
|
|
|
|
|
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(dependsOn: ['genSources']) {
|
|
doLast {
|
|
println("buildExternal for abis: ${project.archsToCompile}")
|
|
exec {
|
|
workingDir 'external'
|
|
commandLine 'make', "-j${threadsToUse}", 'build', "archs=${project.archsToCompile}"
|
|
}
|
|
}
|
|
}
|
|
|
|
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 '25.1.8937393'
|
|
|
|
if(buildAutomatic == "true") {
|
|
buildpEpEngineSystemDB.dependsOn(buildExternal)
|
|
}
|
|
if(isIdeBuild()) {
|
|
buildExternal.dependsOn(setpEpJNIAdapterArchs)
|
|
}
|
|
|
|
// This ensures that assets are populated before collecting resources.
|
|
preBuild.dependsOn(cpDBAssets)
|
|
preBuild.dependsOn(externalAssets)
|
|
}
|
|
|
|
boolean isIdeBuild() {
|
|
boolean runningFromIde = project.properties['android.injected.invoked.from.ide'] == 'true'
|
|
if (runningFromIde) {
|
|
println("GRADLE RUNNING FROM IDE")
|
|
}
|
|
return runningFromIde
|
|
}
|
|
|