77 lines
1.8 KiB
Groovy
77 lines
1.8 KiB
Groovy
//
|
|
// WolfCrypt JNI Library
|
|
//
|
|
//
|
|
// will create an .aar file instead of .apk
|
|
apply plugin: 'com.android.library'
|
|
android {
|
|
compileSdkVersion 28
|
|
// a default can be used, but it is good practice to explicitly select build tools
|
|
buildToolsVersion '28.0.3'
|
|
|
|
defaultConfig {
|
|
// no applicationId with a library
|
|
// applicationId 'xyz.nc.android.wc'
|
|
minSdkVersion 23
|
|
targetSdkVersion 28
|
|
versionCode 1
|
|
versionName '1.0'
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments '-DANDROID_PLATFORM=android-23',
|
|
'-DANDROID_TOOLCHAIN=clang'
|
|
}
|
|
}
|
|
}
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
path 'CMakeLists.txt'
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// 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 'libwolfssl-jni/debug/'
|
|
}
|
|
from('build/intermediates/cmake/release/obj/') {
|
|
include '**/*.so'
|
|
into 'libwolfssl-jni/release/'
|
|
}
|
|
into "${destDir}/"
|
|
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation 'junit:junit:4.12'
|
|
}
|