2018-11-15 12:06:12 +00:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
2020-03-29 12:14:04 +00:00
|
|
|
apply plugin: 'kotlin-android'
|
|
|
|
|
|
|
|
apply plugin: 'kotlin-android-extensions'
|
|
|
|
|
|
|
|
apply plugin: 'kotlin-kapt'
|
|
|
|
|
|
|
|
apply plugin: "org.jlleitschuh.gradle.ktlint"
|
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
|
2019-05-16 10:18:57 +00:00
|
|
|
task getGitVersion() {
|
2020-06-24 09:36:07 +00:00
|
|
|
def gitVersion = "5.0.0"
|
2019-05-16 10:18:57 +00:00
|
|
|
def gitVersionStream = new ByteArrayOutputStream()
|
2019-10-14 09:22:44 +00:00
|
|
|
def gitCommitsCount = new ByteArrayOutputStream()
|
|
|
|
def gitCommitHash = new ByteArrayOutputStream()
|
2019-05-16 10:18:57 +00:00
|
|
|
|
2019-05-17 11:53:04 +00:00
|
|
|
try {
|
|
|
|
exec {
|
2019-10-14 09:22:44 +00:00
|
|
|
executable "git" args "describe", "--abbrev=0"
|
2019-05-17 11:53:04 +00:00
|
|
|
standardOutput = gitVersionStream
|
|
|
|
}
|
2019-10-14 09:22:44 +00:00
|
|
|
exec {
|
|
|
|
executable "git" args "rev-list", gitVersionStream.toString().trim() + "..HEAD", "--count"
|
|
|
|
standardOutput = gitCommitsCount
|
|
|
|
}
|
|
|
|
exec {
|
|
|
|
executable "git" args "rev-parse", "--short", "HEAD"
|
|
|
|
standardOutput = gitCommitHash
|
|
|
|
}
|
|
|
|
|
2020-01-13 09:30:22 +00:00
|
|
|
if (gitCommitsCount.toString().toInteger() == 0) {
|
|
|
|
gitVersion = gitVersionStream.toString().trim()
|
|
|
|
} else {
|
|
|
|
gitVersion = gitVersionStream.toString().trim() + "." + gitCommitsCount.toString().trim() + "+" + gitCommitHash.toString().trim()
|
|
|
|
}
|
2019-05-16 10:18:57 +00:00
|
|
|
println("Git version: " + gitVersion)
|
2020-06-01 10:28:24 +00:00
|
|
|
} catch (ignored) {
|
2019-05-16 10:18:57 +00:00
|
|
|
println("Git not found")
|
|
|
|
}
|
|
|
|
project.version = gitVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
project.tasks['preBuild'].dependsOn 'getGitVersion'
|
2021-01-08 11:18:46 +00:00
|
|
|
project.tasks['preBuild'].dependsOn 'linphoneSdkSource'
|
2019-05-16 10:18:57 +00:00
|
|
|
|
2018-11-15 12:06:12 +00:00
|
|
|
android {
|
2019-09-11 14:17:53 +00:00
|
|
|
compileSdkVersion 29
|
2020-06-01 10:28:24 +00:00
|
|
|
buildToolsVersion "29.0.3"
|
2018-11-15 12:06:12 +00:00
|
|
|
defaultConfig {
|
2020-06-24 08:09:12 +00:00
|
|
|
minSdkVersion 23
|
2019-09-11 14:17:53 +00:00
|
|
|
targetSdkVersion 29
|
2020-06-24 09:36:07 +00:00
|
|
|
versionCode 4999
|
2019-05-16 10:18:57 +00:00
|
|
|
versionName "${project.version}"
|
2018-11-15 12:06:12 +00:00
|
|
|
applicationId getPackageName()
|
|
|
|
}
|
2018-11-19 09:14:43 +00:00
|
|
|
|
2018-11-19 10:59:12 +00:00
|
|
|
applicationVariants.all { variant ->
|
|
|
|
variant.outputs.all {
|
2019-05-16 10:18:57 +00:00
|
|
|
outputFileName = "linphone-android-${variant.buildType.name}-${project.version}.apk"
|
2018-11-19 10:59:12 +00:00
|
|
|
}
|
2019-10-17 08:22:41 +00:00
|
|
|
|
2020-09-09 08:48:06 +00:00
|
|
|
// https://developer.android.com/studio/releases/gradle-plugin#3-6-0-behavior for extractNativeLibs
|
2020-02-21 14:07:24 +00:00
|
|
|
if (variant.buildType.name == "release") {
|
2019-10-17 08:22:41 +00:00
|
|
|
variant.getMergedFlavor().manifestPlaceholders = [linphone_address_mime_type: "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address",
|
2020-06-03 08:27:05 +00:00
|
|
|
linphone_file_provider: getPackageName() + ".fileprovider",
|
|
|
|
appLabel: "@string/app_name"]
|
2019-10-17 08:22:41 +00:00
|
|
|
} else {
|
|
|
|
variant.getMergedFlavor().manifestPlaceholders = [linphone_address_mime_type: "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address",
|
2020-06-03 08:27:05 +00:00
|
|
|
linphone_file_provider: getPackageName() + ".debug.fileprovider",
|
|
|
|
appLabel: "@string/app_name_debug"]
|
2019-10-17 08:22:41 +00:00
|
|
|
}
|
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"
|
2020-03-29 12:14:04 +00:00
|
|
|
resValue "string", "file_provider", getPackageName() + ".fileprovider"
|
2018-12-07 14:10:06 +00:00
|
|
|
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
2019-02-19 09:49:25 +00:00
|
|
|
|
|
|
|
if (!firebaseEnabled()) {
|
|
|
|
resValue "string", "gcm_defaultSenderId", "none"
|
|
|
|
}
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
2020-03-29 12:14:04 +00:00
|
|
|
|
2018-11-15 12:06:12 +00:00
|
|
|
debug {
|
|
|
|
applicationIdSuffix ".debug"
|
|
|
|
debuggable true
|
|
|
|
jniDebuggable true
|
2018-12-06 16:49:08 +00:00
|
|
|
|
|
|
|
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
2020-03-29 12:14:04 +00:00
|
|
|
resValue "string", "file_provider", getPackageName() + ".debug.fileprovider"
|
2018-12-07 14:10:06 +00:00
|
|
|
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
2019-02-19 09:49:25 +00:00
|
|
|
|
|
|
|
if (!firebaseEnabled()) {
|
|
|
|
resValue "string", "gcm_defaultSenderId", "none"
|
|
|
|
}
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-29 07:58:37 +00:00
|
|
|
buildFeatures {
|
|
|
|
dataBinding = true
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
2020-06-11 08:46:15 +00:00
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
2020-03-29 12:14:04 +00:00
|
|
|
}
|
2018-11-19 10:59:12 +00:00
|
|
|
|
2020-03-29 12:14:04 +00:00
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url file(LinphoneSdkBuildDir + '/maven_repository/')
|
2018-11-15 12:06:12 +00:00
|
|
|
}
|
2020-03-29 12:14:04 +00:00
|
|
|
|
2020-06-17 08:49:33 +00:00
|
|
|
maven {
|
2020-03-29 12:14:04 +00:00
|
|
|
url "https://linphone.org/maven_repository"
|
2020-06-17 08:49:33 +00:00
|
|
|
}
|
2018-11-15 13:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-03-29 12:14:04 +00:00
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
2020-08-18 11:15:26 +00:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
2020-03-29 12:14:04 +00:00
|
|
|
implementation "androidx.media:media:1.1.0"
|
2020-06-16 08:53:16 +00:00
|
|
|
implementation 'androidx.fragment:fragment-ktx:1.2.5'
|
2020-08-18 11:15:26 +00:00
|
|
|
implementation 'androidx.core:core-ktx:1.3.1'
|
2020-06-25 09:13:07 +00:00
|
|
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
|
|
|
|
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
|
2020-03-29 12:14:04 +00:00
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
|
|
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
|
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
|
|
|
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
|
|
|
implementation 'com.google.android:flexbox:2.0.0'
|
|
|
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
2020-08-18 11:15:26 +00:00
|
|
|
implementation 'com.google.android.material:material:1.2.0'
|
2020-03-29 12:14:04 +00:00
|
|
|
|
2019-02-22 10:04:02 +00:00
|
|
|
if (firebaseEnabled()) {
|
2019-07-26 14:40:45 +00:00
|
|
|
implementation 'com.google.firebase:firebase-messaging:19.0.1'
|
2019-02-22 10:04:02 +00:00
|
|
|
}
|
2020-03-29 12:14:04 +00:00
|
|
|
|
2020-06-24 09:36:07 +00:00
|
|
|
implementation 'org.linphone:linphone-sdk-android:4.5+'
|
2018-11-24 08:46:31 +00:00
|
|
|
}
|
2020-03-29 12:14:04 +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/"
|
2020-06-17 14:31:49 +00:00
|
|
|
outputs.upToDateWhen { file('src/main/res/xml/contacts.xml').exists() }
|
2018-12-07 15:28:24 +00:00
|
|
|
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'
|
|
|
|
|
2020-03-29 12:14:04 +00:00
|
|
|
ktlint {
|
|
|
|
android = true
|
|
|
|
ignoreFailures = true
|
2018-11-26 10:40:45 +00:00
|
|
|
}
|
2020-03-29 12:14:04 +00:00
|
|
|
|
2020-06-24 09:36:07 +00:00
|
|
|
project.tasks['preBuild'].dependsOn 'ktlintFormat'
|