2
0

Android support for new native masterpassword-core.

This commit is contained in:
Maarten Billemont 2018-06-17 01:11:16 -04:00
parent f9289a3e9e
commit 1cbb584011
5 changed files with 37 additions and 9 deletions

View File

@ -11,8 +11,8 @@ allprojects {
} }
tasks.withType( FindBugs ) { tasks.withType( FindBugs ) {
reports { reports {
xml.enabled false xml.enabled = false
html.enabled true html.enabled = true
} }
} }
} }

@ -1 +1 @@
Subproject commit 3e5ad38a83a05b641cd84414a67a64992bf0e8c6 Subproject commit e3752b58945d23895535857ed136a5185bad02ce

View File

@ -4,11 +4,6 @@ android {
compileSdkVersion 25 compileSdkVersion 25
buildToolsVersion '27.0.3' buildToolsVersion '27.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig { defaultConfig {
applicationId 'com.lyndir.masterpassword' applicationId 'com.lyndir.masterpassword'
minSdkVersion 19 minSdkVersion 19
@ -16,6 +11,21 @@ android {
versionCode 20501 versionCode 20501
versionName '2.5.1' versionName '2.5.1'
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path 'CMakeLists.txt'
}
}
sourceSets {
main {
jniLibs.srcDirs "$projectDir/../lib/libsodium/build-android~/out/lib",
"$projectDir/../lib/libjson-c/build-android~/out/lib"
}
}
// release with: STORE_PW=$(mpw masterpassword.keystore) KEY_PW_ANDROID=$(mpw masterpassword-android) gradle masterpassword-android:assembleRelease // release with: STORE_PW=$(mpw masterpassword.keystore) KEY_PW_ANDROID=$(mpw masterpassword-android) gradle masterpassword-android:assembleRelease
signingConfigs { signingConfigs {
@ -43,3 +53,13 @@ dependencies {
implementation group: 'com.jakewharton', name: 'butterknife', version: '8.5.1' implementation group: 'com.jakewharton', name: 'butterknife', version: '8.5.1'
annotationProcessor group: 'com.jakewharton', name: 'butterknife-compiler', version: '8.5.1' annotationProcessor group: 'com.jakewharton', name: 'butterknife-compiler', version: '8.5.1'
} }
preBuild {
dependsOn task( type: Exec, 'buildLibSodium', {
commandLine "$projectDir/../lib/bin/build_libsodium-android"
} )
dependsOn task( type: Exec, 'buildLibJson-c', {
commandLine "$projectDir/../lib/bin/build_libjson-c-android"
} )
}

View File

@ -6,6 +6,14 @@
// TODO: We may need to zero the jbytes safely. // TODO: We may need to zero the jbytes safely.
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
JNIEnv* env;
if (vm->GetEnv(&env, JNI_VERSION_1_6) != JNI_OK)
return -1;
return JNI_VERSION_1_6;
}
/* native int _masterKey(final String fullName, final byte[] masterPassword, final Version version) */ /* native int _masterKey(final String fullName, final byte[] masterPassword, final Version version) */
JNIEXPORT jbyteArray JNICALL Java_com_lyndir_masterpassword_impl_MPAlgorithmV0__1masterKey(JNIEnv *env, jobject obj, JNIEXPORT jbyteArray JNICALL Java_com_lyndir_masterpassword_impl_MPAlgorithmV0__1masterKey(JNIEnv *env, jobject obj,
jstring fullName, jbyteArray masterPassword, jint algorithmVersion) { jstring fullName, jbyteArray masterPassword, jint algorithmVersion) {

View File

@ -16,7 +16,7 @@ dependencies {
api group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' api group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
api group: 'com.google.code.findbugs', name: 'findbugs-annotations', version: '3.0.1' api group: 'com.google.code.findbugs', name: 'findbugs-annotations', version: '3.0.1'
lib project( path: ':masterpassword-core', configuration: 'default' ) //lib project( path: ':masterpassword-core', configuration: 'default' )
} }
processResources { processResources {