2017-02-21 10:55:48 +00:00
|
|
|
// Project information
|
|
|
|
buildDir = 'bin'
|
2017-02-24 14:20:31 +00:00
|
|
|
|
|
|
|
def getPackageName() {
|
2018-02-02 15:04:30 +00:00
|
|
|
return "org.linphone"
|
2017-02-24 14:20:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def firebaseEnable() {
|
2018-02-02 15:04:30 +00:00
|
|
|
File googleFile = new File('google-services.json')
|
|
|
|
return googleFile.exists()
|
2017-02-24 14:20:31 +00:00
|
|
|
}
|
2017-02-21 10:55:48 +00:00
|
|
|
|
2014-10-30 15:42:15 +00:00
|
|
|
buildscript {
|
2018-02-02 15:04:30 +00:00
|
|
|
File googleFile = new File('google-services.json')
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
mavenCentral()
|
|
|
|
mavenLocal()
|
|
|
|
google()
|
|
|
|
}
|
|
|
|
dependencies {
|
2018-05-04 09:57:19 +00:00
|
|
|
classpath 'com.android.tools.build:gradle:3.1.0'
|
2018-05-04 11:38:08 +00:00
|
|
|
if (googleFile.exists()) {
|
2018-02-06 12:57:54 +00:00
|
|
|
classpath 'com.google.gms:google-services:3.1.0'
|
2018-05-04 11:38:08 +00:00
|
|
|
}
|
2017-02-24 10:30:13 +00:00
|
|
|
}
|
2014-10-30 15:42:15 +00:00
|
|
|
}
|
2017-02-24 10:30:13 +00:00
|
|
|
|
2017-04-27 13:14:17 +00:00
|
|
|
allprojects {
|
2018-02-02 15:04:30 +00:00
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
mavenCentral()
|
|
|
|
mavenLocal()
|
|
|
|
google()
|
|
|
|
}
|
2017-04-27 13:14:17 +00:00
|
|
|
}
|
|
|
|
|
2017-02-13 14:45:05 +00:00
|
|
|
apply plugin: 'com.android.application'
|
2014-10-30 15:42:15 +00:00
|
|
|
|
|
|
|
dependencies {
|
2018-05-04 09:57:19 +00:00
|
|
|
androidTestImplementation('com.android.support.test.espresso:espresso-core:+') {
|
2018-02-02 15:04:30 +00:00
|
|
|
exclude module: 'support-annotations'
|
|
|
|
}
|
2018-05-04 09:57:19 +00:00
|
|
|
androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.3'
|
|
|
|
androidTestImplementation 'junit:junit:4.12'
|
|
|
|
implementation 'org.apache.commons:commons-compress:1.16.1'
|
2018-02-02 15:04:30 +00:00
|
|
|
if (firebaseEnable()) {
|
2018-05-11 09:43:02 +00:00
|
|
|
implementation 'com.google.firebase:firebase-messaging:15.0.2'
|
2018-02-02 15:04:30 +00:00
|
|
|
}
|
2018-06-22 12:19:41 +00:00
|
|
|
implementation 'com.android.support:support-v4:27.1.1'
|
|
|
|
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
2018-05-28 13:38:44 +00:00
|
|
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
|
|
|
implementation 'com.android.support:design:27.1.1'
|
2018-05-25 12:39:56 +00:00
|
|
|
implementation project(':liblinphone-sdk')
|
2014-10-30 15:42:15 +00:00
|
|
|
}
|
|
|
|
|
2017-03-02 16:50:54 +00:00
|
|
|
if (firebaseEnable()) {
|
2018-02-02 15:04:30 +00:00
|
|
|
apply plugin: 'com.google.gms.google-services'
|
2017-03-02 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
2017-04-04 12:17:01 +00:00
|
|
|
///// Exclude Files /////
|
|
|
|
def excludeFiles = []
|
|
|
|
// Exclude firebase file if not enable
|
|
|
|
if (!firebaseEnable()) {
|
2018-02-02 15:04:30 +00:00
|
|
|
excludeFiles.add('**/Firebase*')
|
|
|
|
println '[Push Notification] Firebase disabled'
|
2017-04-04 12:17:01 +00:00
|
|
|
} else {
|
2018-02-02 15:04:30 +00:00
|
|
|
excludeFiles.add('**/gcm*')
|
|
|
|
println '[Push Notification] Firebase enabled'
|
2017-04-04 12:17:01 +00:00
|
|
|
}
|
2018-05-25 12:39:56 +00:00
|
|
|
|
2017-10-17 17:57:58 +00:00
|
|
|
excludeFiles.add('src/android/org/linphone/tutorials/*.java')
|
2017-05-16 14:35:58 +00:00
|
|
|
|
|
|
|
def excludePackage = []
|
|
|
|
|
|
|
|
excludePackage.add('**/gdb.*')
|
|
|
|
excludePackage.add('**/libopenh264**')
|
|
|
|
excludePackage.add('**/**tester**')
|
2017-05-19 12:00:53 +00:00
|
|
|
excludePackage.add('**/LICENSE.txt')
|
2017-04-04 12:17:01 +00:00
|
|
|
/////////////////////////
|
|
|
|
|
2014-10-30 15:42:15 +00:00
|
|
|
android {
|
2018-02-02 15:04:30 +00:00
|
|
|
defaultConfig {
|
2018-06-11 13:36:06 +00:00
|
|
|
compileSdkVersion 28
|
|
|
|
buildToolsVersion "28.0.0"
|
2018-02-02 15:04:30 +00:00
|
|
|
applicationId getPackageName()
|
|
|
|
multiDexEnabled true
|
|
|
|
|
|
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
2017-02-21 10:55:48 +00:00
|
|
|
}
|
2018-02-02 15:04:30 +00:00
|
|
|
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
|
|
|
|
disable 'MissingTranslation', 'UnusedResources'
|
2017-02-21 10:55:48 +00:00
|
|
|
}
|
2018-02-02 15:04:30 +00:00
|
|
|
// Signing
|
|
|
|
signingConfigs {
|
|
|
|
release {
|
|
|
|
storeFile file(RELEASE_STORE_FILE)
|
|
|
|
storePassword RELEASE_STORE_PASSWORD
|
|
|
|
keyAlias RELEASE_KEY_ALIAS
|
|
|
|
keyPassword RELEASE_KEY_PASSWORD
|
|
|
|
}
|
2017-11-14 14:26:22 +00:00
|
|
|
}
|
2018-02-02 15:04:30 +00:00
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
}
|
|
|
|
packaged {
|
|
|
|
initWith release
|
|
|
|
signingConfig null
|
2018-05-25 12:39:56 +00:00
|
|
|
matchingFallbacks = ['debug', 'release']
|
2018-02-02 15:04:30 +00:00
|
|
|
}
|
2017-04-03 10:23:45 +00:00
|
|
|
}
|
2018-02-02 15:04:30 +00:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
manifest.srcFile 'AndroidManifest.xml'
|
2018-05-25 12:39:56 +00:00
|
|
|
def srcDirs = ['src/android']
|
2018-02-02 15:04:30 +00:00
|
|
|
java.srcDirs = srcDirs
|
|
|
|
resources.srcDirs = srcDirs
|
|
|
|
aidl.srcDirs = srcDirs
|
|
|
|
renderscript.srcDirs = srcDirs
|
|
|
|
res.srcDirs = ['res']
|
|
|
|
assets.srcDirs = ['assets']
|
|
|
|
java.excludes = excludeFiles
|
|
|
|
|
|
|
|
// Exclude some useless files
|
|
|
|
packagingOptions {
|
|
|
|
excludes = excludePackage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
debug.setRoot('build-types/debug')
|
|
|
|
release.setRoot('build-types/release')
|
|
|
|
}
|
|
|
|
sourceSets {
|
|
|
|
androidTest {
|
|
|
|
manifest.srcFile 'AndroidManifest.xml'
|
2018-05-25 12:39:56 +00:00
|
|
|
def srcDirs = ['src/android', 'src/androidTest']
|
2018-02-02 15:04:30 +00:00
|
|
|
java.srcDirs = srcDirs
|
|
|
|
resources.srcDirs = srcDirs
|
|
|
|
aidl.srcDirs = srcDirs
|
|
|
|
renderscript.srcDirs = srcDirs
|
|
|
|
res.srcDirs = ['res']
|
|
|
|
assets.srcDirs = ['assets']
|
|
|
|
java.excludes = excludeFiles
|
|
|
|
|
|
|
|
// Exclude some useless files
|
|
|
|
packagingOptions {
|
|
|
|
excludes = excludePackage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
debug.setRoot('build-types/debug')
|
|
|
|
release.setRoot('build-types/release')
|
|
|
|
}
|
|
|
|
packagingOptions {
|
|
|
|
pickFirst 'META-INF/NOTICE'
|
|
|
|
pickFirst 'META-INF/LICENSE'
|
2018-06-11 12:23:30 +00:00
|
|
|
exclude 'META-INF/MANIFEST.MF'
|
2017-02-21 10:55:48 +00:00
|
|
|
}
|
2017-05-03 14:03:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Grant permissions
|
|
|
|
android.applicationVariants.all { variant ->
|
2018-02-02 15:04:30 +00:00
|
|
|
def applicationId = getPackageName()
|
|
|
|
def adb = android.getAdbExecutable().toString()
|
|
|
|
def variantName = variant.name.capitalize()
|
|
|
|
def grantPermissionTask = tasks.create("grant${variantName}Permissions").doLast({
|
|
|
|
"${adb} devices".execute().text.eachLine {
|
|
|
|
"${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 ${applicationId} android.permission.READ_PHONE_STATE".execute()
|
|
|
|
"${adb} shell pm grant ${applicationId} android.permission.READ_CONTACTS".execute()
|
|
|
|
"${adb} shell pm grant ${applicationId} android.permission.WRITE_CONTACTS".execute()
|
|
|
|
}
|
|
|
|
})
|
2017-04-04 12:17:01 +00:00
|
|
|
}
|
|
|
|
|
2017-08-25 14:10:04 +00:00
|
|
|
task runApplication {
|
2018-02-02 15:04:30 +00:00
|
|
|
doLast {
|
|
|
|
def result = exec {
|
|
|
|
executable = android.getAdbExecutable().toString()
|
|
|
|
ignoreExitValue true
|
|
|
|
args = ['shell', 'monkey', '-p', getPackageName(), '-c', 'android.intent.category.LAUNCHER', '1']
|
|
|
|
}
|
2017-08-25 14:10:04 +00:00
|
|
|
}
|
2017-05-26 19:37:21 +00:00
|
|
|
}
|
2018-02-02 15:04:30 +00:00
|
|
|
|