Browse Source

Merge pull request 'PEMA-103 pEpJNIAdapter android compilation' (#35) from TSaschabc/pEpJNIAdapter:PEMA-103 into master

Reviewed-on: https://gitea.pep.foundation/pEp.foundation/pEpJNIAdapter/pulls/35
pull/44/head v3.2.0-RC6
heck 2 years ago
parent
commit
6ed9fdf5b0
  1. 2
      DEPENDENCIES
  2. 12
      android/build.gradle
  3. 2
      android/external/MakefileTemplate
  4. 2
      android/jni/Android.mk
  5. 15
      android/src/foundation/pEp/jniadapter/AndroidHelper.java
  6. 1
      src/cxx/identity_api.cc

2
DEPENDENCIES

@ -1,6 +1,6 @@
# 1st Party Dependencies
## Prefer git tags instead of SHA hashes when possible.
pEpEngine=v3.2.0-RC22
pEpEngine=v3.2.0-RC23
libpEpAdapter=v3.2.0-RC3
libpEpCxx11=v3.2.0-RC0

12
android/build.gradle

@ -2,6 +2,7 @@
def pEpEngineSrc = hasProperty('pEpEngineSrc') ? pEpEngineSrc : "../../pEpEngine"
def libpEpTransportSrc = hasProperty('libpEpTransportSrc') ? libpEpTransportSrc : "../../libpEpTransport"
def libCxx11Src = hasProperty('libCxx11Src') ? libCxx11Src : "../../libpEpCxx11"
def buildAutomatic = hasProperty('buildAutomatic') ? buildAutomatic : "true"
//CHeck M1 answers the correct thing off .avaialableprocessors here
//def threadsToUse = hasProperty('threadsToUse') ?
@ -34,7 +35,6 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 21
targetSdkVersion 31
@ -96,9 +96,13 @@ android {
path 'jni/Android.mk'
}
}
task genlibCxx11Sources(type:Exec) {
workingDir "${libCxx11Src}"
commandLine 'make', "-j${threadsToUse}", 'install'
}
// call source generation makefile target
task genSources(type:Exec, dependsOn: 'genpEpEngineAsn1Sources') {
task genSources(type:Exec, dependsOn: ['genlibCxx11Sources', 'genpEpEngineAsn1Sources']) {
workingDir '../src'
commandLine 'make', 'lib-java'
}
@ -162,6 +166,10 @@ android {
into 'assets'
}
ndkVersion '25.1.8937393'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
if(buildAutomatic == "true") {
buildpEpEngineSystemDB.dependsOn(buildExternal)

2
android/external/MakefileTemplate

@ -42,7 +42,7 @@ LDFLAGS += $(MYLDFLAGS)
# GNU Tools trickery
# point pkg-config to the .pc files generated from these builds
export PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig
export PKG_CONFIG_PATH=$(LOCAL)/lib/src/pEpEngineSequoiaBackend/target/release
# workaround for cross-compiling bug in autoconf
export ac_cv_func_malloc_0_nonnull=yes

2
android/jni/Android.mk

@ -59,10 +59,8 @@ LOCAL_SRC_FILES := \
../../src/cxx/jniutils.cc
LOCAL_C_INCLUDES += $(GPGBUILD)/$(TARGET_ARCH_ABI)/include
#LOCAL_C_INCLUDES += $(ENGINE_PATH)/build-android/include/pEp
LOCAL_C_INCLUDES += $(LIB_PEP_ADAPTER_PATH)/build-android/include $(SRC_PATH)/libpEpAdapter
LOCAL_C_INCLUDES += $(LIB_PEP_CXX11_PATH)/build-android/include $(SRC_PATH)/libpEpCxx11
#LOCAL_C_INCLUDES += $(LIB_PEP_TRANSPORT_PATH)/build-android/include $(SRC_PATH)/libpEpTransport
LOCAL_C_INCLUDES += $(ENGINE_PATH)/asn.1
LOCAL_LDFLAGS = -Wl,--allow-multiple-definition

15
android/src/foundation/pEp/jniadapter/AndroidHelper.java

@ -31,7 +31,8 @@ public class AndroidHelper {
// TODO : Increment when needed.
// TODO : Check if this version tracking is really needed and Automatize it
public static String ENGINE_VERSION_CODE = "Release_2.1.56";
// TODO : This could be automatically generated as the version is tied to git tag && other files in the JNI part.
public static String ENGINE_VERSION_CODE = "v3.2.0-RC3";
private static File shareDir;
@ -141,12 +142,14 @@ public class AndroidHelper {
byte[] pubringBytes = new byte[(int) pubring.length()];
pubring.readFully(pubringBytes);
Engine pEpEngine = new Engine();
pEpEngine.importKey(pubringBytes);
Log.d("boss", "init engine objc at "+Thread.currentThread().getId());
try (Engine pEpEngine = new Engine()) {
pEpEngine.importKey(pubringBytes);
byte[] secringBytes = new byte[(int) secring.length()];
secring.readFully(secringBytes);
pEpEngine.importKey(secringBytes);
byte[] secringBytes = new byte[(int) secring.length()];
secring.readFully(secringBytes);
pEpEngine.importKey(secringBytes);
}
//TODO: MARK KEYRING AS IMPORTED

1
src/cxx/identity_api.cc

@ -1,5 +1,6 @@
#include <pEp/message_api.h>
#include <pEp/pEpLog.hh>
#include "foundation_pEp_jniadapter_Identity.h"
#include "jniutils.hh"

Loading…
Cancel
Save