2
0

Tweak include paths & add clean support to android libs.

This commit is contained in:
Maarten Billemont 2018-07-03 11:21:48 -04:00
parent d6617563fc
commit b25130f4d2
6 changed files with 28 additions and 18 deletions

View File

@ -13,12 +13,12 @@ add_library( mpw SHARED
add_library( sodium SHARED IMPORTED )
set_target_properties( sodium PROPERTIES IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../lib/libsodium/build-android~/out/lib/${ANDROID_ABI}/libsodium.so" )
target_include_directories( mpw PRIVATE "${PROJECT_SOURCE_DIR}/../lib/libsodium/build-android~/out" )
target_include_directories( mpw PRIVATE "${PROJECT_SOURCE_DIR}/../lib/libsodium/src/libsodium/include" )
target_compile_definitions( mpw PRIVATE -DMPW_SODIUM=1 )
target_link_libraries( mpw PRIVATE sodium )
add_library( json-c SHARED IMPORTED )
set_target_properties( json-c PROPERTIES IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../lib/libjson-c/build-android~/out/lib/${ANDROID_ABI}/libjson-c.so" )
target_include_directories( mpw PRIVATE "${PROJECT_SOURCE_DIR}/../lib/libjson-c/build-android~/out" )
target_include_directories( mpw PRIVATE "${PROJECT_SOURCE_DIR}/../lib/libjson-c/build-android~/out/include" )
target_compile_definitions( mpw PRIVATE -DMPW_JSON=1 )
target_link_libraries( mpw PRIVATE json-c )

View File

@ -22,8 +22,8 @@ android {
}
sourceSets {
main {
jniLibs.srcDirs "$projectDir/../lib/libsodium/build-android~/out/lib",
"$projectDir/../lib/libjson-c/build-android~/out/lib"
jniLibs.srcDirs "$rootDir/../lib/libsodium/build-android~/out/lib",
"$rootDir/../lib/libjson-c/build-android~/out/lib"
}
}
@ -65,3 +65,13 @@ preBuild {
} )
}
clean {
dependsOn task( type: Exec, 'clean_libsodium-android', {
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-android", 'clean'
environment 'ANDROID_NDK_HOME', android.ndkDirectory
} )
dependsOn task( type: Exec, 'clean_libjson-c-android', {
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-android", 'clean'
environment 'ANDROID_NDK_HOME', android.ndkDirectory
} )
}

View File

@ -60,22 +60,22 @@ library {
project.dependencies {
add( linkLibraries.name,
fileTree( "../../../lib/libsodium/build-${system}~/out/lib" ) )
fileTree( "$rootDir/../lib/libsodium/build-${system}~/out/lib" ) )
}
archive.dependsOn project.tasks.maybeCreate( "build_libsodium-${system}", Exec.class ).configure {
commandLine 'bash', '-x', "$rootDir/../lib/bin/build_libsodium-${system}"
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}"
privateHeaders.from "$rootDir/../lib/libsodium/src/libsodium/include"
}
clean.dependsOn project.tasks.maybeCreate( "clean_libsodium-${system}", Exec.class ).configure {
commandLine 'bash', '-x', "$rootDir/../lib/bin/build_libsodium-${system}", 'clean'
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}", 'clean'
}
archive.dependsOn project.tasks.maybeCreate( "build_libjson-c-${system}", Exec.class ).configure {
commandLine 'bash', '-x', "$rootDir/../lib/bin/build_libjson-c-${system}"
privateHeaders.from "$rootDir/../lib/libjson-c/build-${system}~/out"
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}"
privateHeaders.from "$rootDir/../lib/libjson-c/build-${system}~/out/include"
}
clean.dependsOn project.tasks.maybeCreate( "clean_libjson-c-${system}", Exec.class ).configure {
commandLine 'bash', '-x', "$rootDir/../lib/bin/build_libjson-c-${system}", 'clean'
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}", 'clean'
}
}
}
@ -92,7 +92,7 @@ static String standardOperatingSystem(NativePlatform platform) {
else if (os.isLinux())
return OperatingSystemFamily.LINUX
// Other systems will need to use a Linux compatibility layer for now.
// Other systems will need to use a Linux compatibility layer.
return OperatingSystemFamily.LINUX
}

View File

@ -20,11 +20,12 @@ dependencies {
}
processResources {
dependsOn task( type: Sync, 'copyResources', {
dependsOn task( type: Sync, 'processResources-lib', {
into new File( processResources.outputs.files.singleFile, "lib" )
dependsOn configurations.lib {
files.each { libFile ->
from zipTree( libFile )
into new File( processResources.outputs.files.singleFile, "lib" )
from( zipTree( libFile ) )
}
}
} )
@ -33,7 +34,7 @@ processResources {
compileJava {
doLast {
ant.javah( class: 'com.lyndir.masterpassword.impl.MPAlgorithmV0',
outputFile: '../../c/core/src/mpw-jni.h',
outputFile: new File( project( ':masterpassword-core' ).projectDir, 'src/mpw-jni.h' ),
classpath: files( sourceSets.main.compileClasspath, sourceSets.main.output ).asPath )
}
}

View File

@ -21,4 +21,5 @@ dependencies {
testImplementation group: 'org.testng', name: 'testng', version: '6.8.5'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
}
test.useTestNG()

View File

@ -13,7 +13,5 @@ dependencies {
testImplementation group: 'org.testng', name: 'testng', version: '6.8.5'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
}
//tasks.withType(Test) {
// systemProperty "java.library.path", "/Users/lhunath/Documents/workspace/lyndir/MasterPassword/core/java/algorithm/build/libs/mpw/shared"
//}
test.useTestNG()