build.gradle 6.21 KB
Newer Older
Christophe Deschamps's avatar
Christophe Deschamps committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'com.google.firebase.crashlytics'

repositories {
    maven {
        url file(LinphoneSdkBuildDir + '/maven_repository/')
    }
    maven {
        url "https://linphone.org/maven_repository"
    }
    maven {
        url file('../linphone-sdk/')
    }
    maven {
        url 'https://jitpack.io'
    }
}

task zipTheme(type: Zip){
    println "Zipping theme"
    from '../linhome-shared-themes/'
    include 'action_types.xml'
    include 'method_types.xml'
    include 'device_types.xml'
    include 'texts.xml'
    include 'theme.xml'
    include 'images/**/*'
    include 'fonts/**/*'
    archiveFileName = "linhome.zip"
    destinationDirectory = file('src/main/assets/')
}

afterEvaluate {
    for(def task in it.tasks)
        if(task != tasks.zipTheme)
            task.dependsOn tasks.zipTheme
}

task getGitVersion() {
    def gitVersion = "5.0.0"
    def gitVersionStream = new ByteArrayOutputStream()
    def gitCommitsCount = new ByteArrayOutputStream()
    def gitCommitHash = new ByteArrayOutputStream()

    try {
        exec {
            executable "git" args "describe", "--abbrev=0"
            standardOutput = gitVersionStream
        }
        exec {
            executable "git" args "rev-list", gitVersionStream.toString().trim() + "..HEAD", "--count"
            standardOutput = gitCommitsCount
        }
        exec {
            executable "git" args "rev-parse", "--short", "HEAD"
            standardOutput = gitCommitHash
        }

        if (gitCommitsCount.toString().toInteger() == 0) {
            gitVersion = gitVersionStream.toString().trim()
        } else {
            gitVersion = gitVersionStream.toString().trim() + "." + gitCommitsCount.toString().trim() + "+" + gitCommitHash.toString().trim()
        }
        println("Git version: " + gitVersion)
    } catch (ignored) {
        println("Git not found")
    }
    project.version = gitVersion
}
project.tasks['preBuild'].dependsOn 'getGitVersion'


android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "org.linhome"
        minSdkVersion 23
        targetSdkVersion 29
Christophe Deschamps's avatar
Christophe Deschamps committed
85
        versionCode 25
Christophe Deschamps's avatar
Christophe Deschamps committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
        versionName "${project.version}"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    applicationVariants.all { variant ->
        variant.getMergedFlavor().manifestPlaceholders = [linhome_file_provider: applicationId + ".fileprovider"]
        variant.outputs.all {
            outputFileName = "linhome-android-${variant.buildType.name}-${project.version}.apk"
        }
    }

    signingConfigs {
        release {
            def keystorePropertiesFile = rootProject.file("keystore.properties")
            def keystoreProperties = new Properties()
            keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
        }
    }

    buildFeatures{
        dataBinding = true
    }


    buildTypes {
        release {
            minifyEnabled true
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                strippedNativeLibsDir "build/intermediates/stripped_native_libs/release/out/lib"
                unstrippedNativeLibsDir "build/intermediates/merged_native_libs/release/out/lib"
            }
        }
        debug {
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                strippedNativeLibsDir "build/intermediates/stripped_native_libs/debug/out/lib"
                unstrippedNativeLibsDir "build/intermediates/merged_native_libs/debug/out/lib"
            }
        }

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10"
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.navigation:navigation-fragment:2.3.1'
    implementation 'androidx.navigation:navigation-ui:2.3.1'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
163
    implementation "org.linphone:linphone-sdk-android:4.5.0"
Christophe Deschamps's avatar
Christophe Deschamps committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
    implementation "org.permissionsdispatcher:permissionsdispatcher:4.7.0"
    kapt "org.permissionsdispatcher:permissionsdispatcher-processor:4.7.0"
    implementation "com.google.android.material:material:1.2.1"
    implementation 'commons-codec:commons-codec:1.10'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    kapt 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'com.caverock:androidsvg-aar:1.4'
    implementation 'com.google.firebase:firebase-messaging:21.0.0'
    implementation 'com.google.firebase:firebase-analytics:18.0.0'
    implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
    implementation 'com.github.ybq:Android-SpinKit:1.4.0'
    implementation "androidx.media:media:1.2.0"
    implementation 'com.google.firebase:firebase-crashlytics-ndk:17.3.0'


}