From 30402a61261e90448ce7843bf0c38299429658c8 Mon Sep 17 00:00:00 2001 From: JohnE Date: Thu, 7 Feb 2019 13:24:32 -0800 Subject: [PATCH] NEW: ccc/build.sh will properly clean and build, name of lib is now libwolfssl-jni --- .gitignore | 2 +- ccc/build.gradle | 18 ++++++++++++++++++ ccc/build.sh | 10 ++++++++++ ccc/src/main/cpp/wolfcrypt/CMakeLists.txt | 14 +++++++------- 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 ccc/build.sh diff --git a/.gitignore b/.gitignore index 789cbdc..80b3e93 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ libwebp .DS_Store wolfssl-git var/ - +dist/ diff --git a/ccc/build.gradle b/ccc/build.gradle index e501cb0..59a6bb2 100644 --- a/ccc/build.gradle +++ b/ccc/build.gradle @@ -46,6 +46,24 @@ android { } } + +// Copies files to the dist/ folder, adds a timestamp +// instead of using a bash script I ventured out to try this file copy in Groovy (Gradle) +// ...and yay, I was successful =) +task copyLibs(type: Copy) { + def thisDate = new Date().format('yyyyMMdd_HHmmssSSS') + from('build/intermediates/cmake/debug/obj/') { + include '**/*.so' + into 'debug' + } + from('build/intermediates/cmake/release/obj/') { + include '**/*.so' + into 'release' + } + into "dist/wolfssl-jni_${thisDate}/" +} + + dependencies { // compile fileTree(dir: 'libs', include: ['*.jar']) // implementation fileTree(dir: 'libs', include: ['*.jar']) diff --git a/ccc/build.sh b/ccc/build.sh new file mode 100644 index 0000000..161fee2 --- /dev/null +++ b/ccc/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# BUILD this JNI library +# - gradle task 'copyLibs' was created by me to copy the .so files to dist/ +# +gradle clean +# there is a bug in the cleaner task, we need to blow away this artifact directory too +rm -rf .externalNativeBuild/ +# build and copy the libs +gradle build copyLibs diff --git a/ccc/src/main/cpp/wolfcrypt/CMakeLists.txt b/ccc/src/main/cpp/wolfcrypt/CMakeLists.txt index 69c74bf..82698c6 100644 --- a/ccc/src/main/cpp/wolfcrypt/CMakeLists.txt +++ b/ccc/src/main/cpp/wolfcrypt/CMakeLists.txt @@ -1,6 +1,6 @@ -# create a build target of "ccc-jni" +# create a build target of "wolfssl-jni" # library is a SHARED (not STATIC), to be used with JNI -add_library( ccc-jni +add_library( wolfssl-jni SHARED jni/jni_fips.c jni/jni_native_struct.c @@ -33,9 +33,9 @@ include_directories( jni/include # set(distribution_DIR ${CMAKE_SOURCE_DIR}/dist) -set_target_properties( ccc-jni - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY - "${CMAKE_SOURCE_DIR}/dist/ccc-jni/${ANDROID_ABI}" ) +# set_target_properties( wolfssl-jni +# PROPERTIES +# ARCHIVE_OUTPUT_DIRECTORY +# "${CMAKE_SOURCE_DIR}/dist/wolfssl-jni/${ANDROID_ABI}" ) -target_link_libraries( ccc-jni wolfssl-oem ) \ No newline at end of file +target_link_libraries( wolfssl-jni wolfssl-oem ) \ No newline at end of file