olm/android/olm-sdk/build.gradle

95 lines
3 KiB
Groovy
Raw Normal View History

apply plugin: 'com.android.library'
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
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'
externalNativeBuild {
cmake {
arguments '-DCMAKE_C_FLAGS=-fstack-protector-all -Wall',
'-DCMAKE_CXX_FLAGS=-fstack-protector-all -Wall',
'-DOLM_ANDROID_JNI=on',
'-DOLM_TESTS=off'
}
}
}
buildTypes {
debug {
resValue "string", "git_olm_revision", "\"${gitRevision()}\""
resValue "string", "git_olm_revision_unix_date", "\"${gitRevisionUnixDate()}\""
resValue "string", "git_olm_revision_date", "\"${gitRevisionDate()}\""
}
release {
resValue "string", "git_olm_revision", "\"${gitRevision()}\""
resValue "string", "git_olm_revision_unix_date", "\"${gitRevisionUnixDate()}\""
resValue "string", "git_olm_revision_date", "\"${gitRevisionDate()}\""
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path '../../CMakeLists.txt'
}
}
task buildJavaDoc(type: Javadoc) {
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
failOnError false
}
tasks.withType(JavaCompile) {
compileTask ->
compileTask.dependsOn buildJavaDoc
}
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFileName
if (outputFile != null && outputFile.endsWith('.aar')) {
output.outputFileName = outputFile.replace(".aar", "-${version}.aar")
}
}
}
}
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()
}
dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:core:1.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
}