NEW: updated the build to publish to local maven repo for flutter purposes, updated docs because I confused myself..arrg

This commit is contained in:
JohnE 2019-05-13 11:48:53 -07:00
parent f5fddbe3ee
commit 660af53553
7 changed files with 49 additions and 12 deletions

View File

@ -3,18 +3,25 @@ DEVELOPER README
================
application details
-------------------
Project Details
---------------
* ./wolfssl-lib
- builds source from OEM WolfSSL repository!! =)
- only needs to be built once (when you want a new library)
- generates BOTH shared (.so) and static (.a)
- static (.a) is really just a zip of all the files compiled staticly
* ./wolfssl-jni
- JNI for the WolfSSL library
- contains BOTH C and Java files (for JNI to work dummy)
- expects "libwolfssl.a" file to link with during cmake compile
- example: ./wolfssl-jni/libs/wolfssl-lib/arm64-v8a
- OUTPUT: "wolfssl-jni.aar"
* ./ccc-jni (default main source code)
- JNI, java connections to the native binaries
- C files
- TEST: test code only, does nothing more, no C files at this time
- no C files at this time, just java files to test lib
- broken!! maybe replace

View File

@ -2,6 +2,7 @@
buildscript {
repositories {
mavenLocal()
google()
jcenter()
}
@ -12,6 +13,7 @@ buildscript {
allprojects {
repositories {
mavenLocal()
google()
jcenter()
}

View File

@ -30,7 +30,7 @@ android {
sourceSets {
main {
// let gradle pack the shared library into apk
jniLibs.srcDirs = ['lib/wolfssl-jni']
jniLibs.srcDirs = ['nc-libs/wolfssl-jni']
}
}
// externalNativeBuild {

View File

@ -7,4 +7,5 @@ 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
# copy maven local so that flutter can find the lib (because Goog sucks at engineering)
gradle build copyLibs publishToMavenLocal

View File

@ -1,4 +1,9 @@
// include this at the top, for shared libraries
// include ':wolfssl-lib'
// include ':wolfssl-jni'
include ':ccc-jni'
// contains Java and C for JNI purposes
// will generate a .aar file in ./dist folder
include ':wolfssl-jni'
// broken, was test code, but now we use .aar file
// include ':nc-jni'

View File

@ -28,22 +28,44 @@ android {
}
}
// we are going to "publish" to local maven repository
apply plugin: 'maven-publish'
project.afterEvaluate {
publishing {
publications {
library(MavenPublication) {
groupId 'io.malloc.ccc'
artifactId 'nc-jni'
version "1.1"
artifact(bundleReleaseAar)
}
}
}
}
// 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')
def destDir = "dist/wolfssl-jni_${thisDate}"
// copy the library package
from('build/outputs/aar/') {
include '**/*.aar'
}
from('build/intermediates/cmake/debug/obj/') {
include '**/*.so'
into 'debug'
into 'libwolfssl-jni/debug/'
}
from('build/intermediates/cmake/release/obj/') {
include '**/*.so'
into 'release'
into 'libwolfssl-jni/release/'
}
into "dist/wolfssl-jni_${thisDate}/"
}
into "${destDir}/"
}
dependencies {
testImplementation 'junit:junit:4.12'