2018-11-15 12:06:12 +00:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
2018-12-05 12:35:05 +00:00
|
|
|
static def getPackageName() {
|
2018-11-15 12:06:12 +00:00
|
|
|
return "org.linphone"
|
|
|
|
}
|
|
|
|
|
2018-12-05 12:35:05 +00:00
|
|
|
static def firebaseEnabled() {
|
2018-11-24 08:46:31 +00:00
|
|
|
File googleFile = new File('app/google-services.json')
|
2018-11-15 12:06:12 +00:00
|
|
|
return googleFile.exists()
|
|
|
|
}
|
|
|
|
|
2018-12-05 12:35:05 +00:00
|
|
|
static def isLocalAarAvailable() {
|
2018-11-15 12:53:23 +00:00
|
|
|
File debugAar = new File('linphone-sdk-android/linphone-sdk-android-debug.aar')
|
|
|
|
File releaseAar = new File('linphone-sdk-android/linphone-sdk-android-release.aar')
|
2018-11-15 12:06:12 +00:00
|
|
|
return debugAar.exists() || releaseAar.exists()
|
|
|
|
}
|
|
|
|
|
|
|
|
///// Exclude Files /////
|
|
|
|
|
|
|
|
def excludeFiles = []
|
|
|
|
if (!firebaseEnabled()) {
|
|
|
|
excludeFiles.add('**/Firebase*')
|
|
|
|
println '[Push Notification] Firebase disabled'
|
|
|
|
}
|
|
|
|
|
|
|
|
def excludePackage = []
|
|
|
|
|
|
|
|
excludePackage.add('**/gdb.*')
|
|
|
|
excludePackage.add('**/libopenh264**')
|
|
|
|
excludePackage.add('**/**tester**')
|
|
|
|
excludePackage.add('**/LICENSE.txt')
|
|
|
|
|
2019-01-30 11:35:12 +00:00
|
|
|
|
|
|
|
def gitVersion = new ByteArrayOutputStream()
|
|
|
|
|
|
|
|
task getGitVersion {
|
|
|
|
exec {
|
|
|
|
commandLine 'git', 'describe', '--always'
|
|
|
|
standardOutput = gitVersion
|
|
|
|
}
|
|
|
|
doLast {
|
|
|
|
gitVersion = gitVersion.toString().trim()
|
|
|
|
println("Git version: " + gitVersion)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
project.tasks['preBuild'].dependsOn 'getGitVersion'
|
|
|
|
|
2018-11-15 12:06:12 +00:00
|
|
|
/////////////////////////
|
|
|
|
|
|
|
|
repositories {
|
2018-11-16 09:33:03 +00:00
|
|
|
maven {
|
2018-11-29 15:23:29 +00:00
|
|
|
// Switch to release for releases !
|
2018-12-14 09:08:44 +00:00
|
|
|
url "https://gitlab.linphone.org/BC/public/maven_repository/raw/master"
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
2018-11-19 09:14:43 +00:00
|
|
|
lintOptions {
|
|
|
|
abortOnError false
|
|
|
|
}
|
|
|
|
|
2018-11-15 12:06:12 +00:00
|
|
|
compileSdkVersion 28
|
|
|
|
defaultConfig {
|
2018-11-19 09:14:43 +00:00
|
|
|
minSdkVersion 21
|
2018-11-15 12:06:12 +00:00
|
|
|
targetSdkVersion 28
|
2019-02-08 14:44:18 +00:00
|
|
|
versionCode 4111
|
2018-11-15 12:06:12 +00:00
|
|
|
versionName "4.1"
|
|
|
|
applicationId getPackageName()
|
|
|
|
multiDexEnabled true
|
2018-12-07 14:10:06 +00:00
|
|
|
manifestPlaceholders = [linphone_address_mime_type:"vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"]
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
2018-11-19 09:14:43 +00:00
|
|
|
|
2018-11-19 10:59:12 +00:00
|
|
|
applicationVariants.all { variant ->
|
|
|
|
variant.outputs.all {
|
2019-01-30 11:35:12 +00:00
|
|
|
outputFileName = "linphone-android-${variant.buildType.name}-${gitVersion.toString().trim()}.apk"
|
2018-11-19 10:59:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-19 09:42:14 +00:00
|
|
|
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
|
|
|
def keystoreProperties = new Properties()
|
|
|
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
|
|
|
2018-11-15 12:06:12 +00:00
|
|
|
signingConfigs {
|
|
|
|
release {
|
2018-11-19 09:42:14 +00:00
|
|
|
storeFile file(keystoreProperties['storeFile'])
|
|
|
|
storePassword keystoreProperties['storePassword']
|
|
|
|
keyAlias keystoreProperties['keyAlias']
|
|
|
|
keyPassword keystoreProperties['keyPassword']
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-19 09:14:43 +00:00
|
|
|
|
2018-11-15 12:06:12 +00:00
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled true
|
|
|
|
signingConfig signingConfigs.release
|
2018-11-19 09:27:25 +00:00
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
2018-12-06 16:49:08 +00:00
|
|
|
|
|
|
|
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
|
|
|
resValue "string", "file_provider", getPackageName() + ".provider"
|
2018-12-07 14:10:06 +00:00
|
|
|
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
|
|
|
debug {
|
|
|
|
applicationIdSuffix ".debug"
|
|
|
|
debuggable true
|
|
|
|
jniDebuggable true
|
2018-11-21 11:49:40 +00:00
|
|
|
versionNameSuffix '-debug'
|
2018-12-06 16:49:08 +00:00
|
|
|
|
|
|
|
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
|
|
|
resValue "string", "file_provider", getPackageName() + ".provider"
|
2018-12-07 14:10:06 +00:00
|
|
|
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
packagingOptions {
|
|
|
|
excludes = excludePackage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-19 10:59:12 +00:00
|
|
|
|
2018-11-15 12:06:12 +00:00
|
|
|
packagingOptions {
|
|
|
|
pickFirst 'META-INF/NOTICE'
|
|
|
|
pickFirst 'META-INF/LICENSE'
|
|
|
|
exclude 'META-INF/MANIFEST.MF'
|
|
|
|
}
|
2018-11-15 13:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2018-12-05 12:35:05 +00:00
|
|
|
implementation 'com.google.firebase:firebase-messaging:17.3.4'
|
2018-11-15 13:36:05 +00:00
|
|
|
implementation 'com.android.billingclient:billing:1.2'
|
2018-12-05 12:35:05 +00:00
|
|
|
implementation 'org.apache.commons:commons-compress:1.18'
|
2018-11-23 15:30:14 +00:00
|
|
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
|
|
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
2019-01-24 10:11:23 +00:00
|
|
|
implementation 'com.google.android.material:material:1.1.0-alpha02'
|
2018-11-23 16:04:08 +00:00
|
|
|
implementation 'com.google.android:flexbox:1.1.0'
|
|
|
|
|
2018-11-15 13:36:05 +00:00
|
|
|
if (isLocalAarAvailable()) {
|
|
|
|
implementation project(":linphone-sdk-android")
|
|
|
|
} else {
|
2018-11-30 09:21:47 +00:00
|
|
|
implementation "org.linphone:linphone-sdk-android:4.1+"
|
2018-11-15 13:36:05 +00:00
|
|
|
}
|
2018-11-24 08:46:31 +00:00
|
|
|
}
|
|
|
|
if (firebaseEnabled()) {
|
|
|
|
apply plugin: 'com.google.gms.google-services'
|
2018-11-26 10:18:15 +00:00
|
|
|
}
|
|
|
|
|
2018-12-07 15:28:24 +00:00
|
|
|
task generateContactsXml(type: Copy) {
|
|
|
|
from 'contacts.xml'
|
|
|
|
into "src/main/res/xml/"
|
|
|
|
filter {
|
|
|
|
line -> line
|
|
|
|
.replaceAll('%%AUTO_GENERATED%%', 'This file has been automatically generated, do not edit or commit !')
|
|
|
|
.replaceAll('%%PACKAGE_NAME%%', getPackageName())
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
project.tasks['preBuild'].dependsOn 'generateContactsXml'
|
|
|
|
|
2018-11-26 10:18:15 +00:00
|
|
|
apply plugin: "com.diffplug.gradle.spotless"
|
|
|
|
spotless {
|
|
|
|
java {
|
|
|
|
target '**/*.java'
|
|
|
|
googleJavaFormat('1.6').aosp()
|
|
|
|
removeUnusedImports()
|
|
|
|
}
|
2018-11-26 10:40:45 +00:00
|
|
|
}
|
|
|
|
project.tasks['preBuild'].dependsOn 'spotlessApply'
|