2016-10-05 18:25:09 +02:00
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
|
|
|
|
android {
|
2021-04-16 17:43:30 +02:00
|
|
|
compileSdkVersion 30
|
2016-10-05 18:25:09 +02:00
|
|
|
|
|
|
|
defaultConfig {
|
2021-04-30 14:51:46 +02:00
|
|
|
minSdkVersion 16
|
2021-04-16 17:43:30 +02:00
|
|
|
targetSdkVersion 30
|
2021-04-16 21:50:13 +02:00
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
|
|
|
|
// The following argument makes the Android Test Orchestrator run its
|
|
|
|
// "pm clear" command after each test invocation. This command ensures
|
|
|
|
// that the app's state is completely cleared between tests.
|
|
|
|
testInstrumentationRunnerArguments clearPackageData: 'true'
|
2021-04-30 14:51:46 +02:00
|
|
|
|
|
|
|
externalNativeBuild {
|
|
|
|
cmake {
|
|
|
|
arguments '-DANDROID_STL=c++_static',
|
|
|
|
'-DCMAKE_C_FLAGS=-fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wall',
|
|
|
|
'-DCMAKE_CXX_FLAGS=-fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wall',
|
|
|
|
'-DCMAKE_SHARED_LINKER_FLAGS=-z relro -z now',
|
|
|
|
'-DOLM_ANDROID_JNI=on',
|
|
|
|
'-DOLM_TESTS=off'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ndk {
|
|
|
|
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64', 'x86'
|
|
|
|
}
|
2016-10-05 18:25:09 +02:00
|
|
|
}
|
|
|
|
buildTypes {
|
2017-01-09 16:39:54 +01:00
|
|
|
debug {
|
|
|
|
resValue "string", "git_olm_revision", "\"${gitRevision()}\""
|
|
|
|
resValue "string", "git_olm_revision_unix_date", "\"${gitRevisionUnixDate()}\""
|
|
|
|
resValue "string", "git_olm_revision_date", "\"${gitRevisionDate()}\""
|
|
|
|
}
|
|
|
|
|
2016-10-05 18:25:09 +02:00
|
|
|
release {
|
2017-01-09 16:39:54 +01:00
|
|
|
resValue "string", "git_olm_revision", "\"${gitRevision()}\""
|
|
|
|
resValue "string", "git_olm_revision_unix_date", "\"${gitRevisionUnixDate()}\""
|
|
|
|
resValue "string", "git_olm_revision_date", "\"${gitRevisionDate()}\""
|
|
|
|
|
2016-10-05 18:25:09 +02:00
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
|
|
|
}
|
2021-04-30 14:51:46 +02:00
|
|
|
externalNativeBuild {
|
|
|
|
cmake {
|
|
|
|
path '../../CMakeLists.txt'
|
|
|
|
}
|
2016-10-05 18:25:09 +02:00
|
|
|
}
|
|
|
|
|
2021-04-16 17:43:30 +02:00
|
|
|
task buildJavaDoc(type: Javadoc) {
|
2016-10-26 18:15:37 +02:00
|
|
|
source = android.sourceSets.main.java.srcDirs
|
|
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
|
|
|
destinationDir = file("./doc/")
|
2016-11-07 11:00:01 +01:00
|
|
|
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PRIVATE
|
2016-10-26 18:15:37 +02:00
|
|
|
failOnError false
|
|
|
|
}
|
|
|
|
|
2016-10-06 19:55:03 +02:00
|
|
|
tasks.withType(JavaCompile) {
|
2021-04-16 17:43:30 +02:00
|
|
|
compileTask ->
|
|
|
|
compileTask.dependsOn buildJavaDoc
|
2016-10-05 18:25:09 +02:00
|
|
|
}
|
|
|
|
|
2016-11-23 00:01:34 +01:00
|
|
|
|
|
|
|
libraryVariants.all { variant ->
|
|
|
|
variant.outputs.each { output ->
|
2018-06-26 10:39:33 +02:00
|
|
|
def outputFile = output.outputFileName
|
|
|
|
if (outputFile != null && outputFile.endsWith('.aar')) {
|
|
|
|
output.outputFileName = outputFile.replace(".aar", "-${version}.aar")
|
2016-11-23 00:01:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-05 18:25:09 +02:00
|
|
|
}
|
|
|
|
|
2017-01-09 16:39:54 +01:00
|
|
|
def gitRevision() {
|
|
|
|
def cmd = "git rev-parse --short HEAD"
|
|
|
|
return cmd.execute().text.trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
def gitRevisionUnixDate() {
|
|
|
|
def cmd = "git show -s --format=%ct HEAD^{commit}"
|
|
|
|
return cmd.execute().text.trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
def gitRevisionDate() {
|
|
|
|
def cmd = "git show -s --format=%ci HEAD^{commit}"
|
|
|
|
return cmd.execute().text.trim()
|
|
|
|
}
|
|
|
|
|
2016-10-05 18:25:09 +02:00
|
|
|
dependencies {
|
2021-04-16 17:43:30 +02:00
|
|
|
testImplementation 'junit:junit:4.13.2'
|
|
|
|
androidTestImplementation 'junit:junit:4.13.2'
|
|
|
|
|
2021-04-16 21:50:13 +02:00
|
|
|
androidTestImplementation 'androidx.test:core:1.3.0'
|
2021-04-16 17:43:30 +02:00
|
|
|
androidTestImplementation 'androidx.test:runner:1.3.0'
|
|
|
|
androidTestImplementation 'androidx.test:rules:1.3.0'
|
2021-04-16 21:50:13 +02:00
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
2016-10-05 18:25:09 +02:00
|
|
|
}
|