linphone-android/liblinphone_tester/build.gradle
2018-05-17 14:38:48 +02:00

139 lines
3.8 KiB
Groovy

// Project information
buildDir = 'bin'
def getPackageName() {
return "org.linphone.tester"
}
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
google()
}
}
apply plugin: 'com.android.application'
dependencies {
androidTestCompile 'org.apache.commons:commons-compress:1.16.1'
androidTestCompile group: 'junit', name: 'junit', version: '+'
androidTestCompile group: 'com.jayway.android.robotium', name: 'robotium', version: '+'
androidTestCompile fileTree(dir: 'libs', include: 'android-junit-report*.jar')
compile 'org.apache.commons:commons-compress:1.16.1'
compile group: 'junit', name: 'junit', version: '+'
compile group: 'com.jayway.android.robotium', name: 'robotium-solo', version: '+'
compile fileTree(dir: 'libs', include: 'android-junit-report*.jar')
compile project(":libLinphoneAndroidSdk")
}
android {
defaultConfig {
compileSdkVersion 26
buildToolsVersion "26.0.0"
applicationId getPackageName()
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDir 'libs'
// Exclude some useless files
packagingOptions {
exclude '**/gdb.*'
}
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
sourceSets {
androidTest {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDir 'libs'
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
testOptions {
unitTests.all {
// All the usual Gradle options.
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
// Grant permissions
android.applicationVariants.all { variant ->
def applicationId = getPackageName()
def applicationIdtest = "${getPackageName()}.test"
def adb = android.getAdbExecutable().toString()
def variantName = variant.name.capitalize()
def grantPermissionTask = tasks.create("grant${variantName}Permissions") << {
"${adb} devices".execute().text.eachLine {
if(it.endsWith("device")){
def device = it.split()[0]
println "Granting permissions on devices ${device}"
"${adb} shell pm grant ${applicationId} android.permission.RECORD_AUDIO".execute()
"${adb} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE".execute()
"${adb} shell pm grant ${applicationId} android.permission.CAMERA".execute()
"${adb} shell pm grant ${applicationIdtest} android.permission.RECORD_AUDIO".execute()
"${adb} shell pm grant ${applicationIdtest} android.permission.WRITE_EXTERNAL_STORAGE".execute()
"${adb} shell pm grant ${applicationIdtest} android.permission.CAMERA".execute()
}
}
}
}
tasks.withType(Test) {
testLogging {
exceptionFormat 'full'
showCauses true
showExceptions true
showStackTraces true
showStandardStreams false
ignoreFailures = true
}
connectedAndroidTest {
ignoreFailures = true
}
}