build.gradle 5.83 KB
Newer Older
1 2 3
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
def isPlay = !(taskRequests.contains("Foss") || taskRequests.contains("foss"))

4
apply plugin: 'com.android.application'
5
if (isPlay) { apply plugin: 'io.fabric' }
6
apply plugin: 'kotlin-android'
7
apply plugin: 'kotlin-android-extensions'
8
apply plugin: 'kotlin-kapt'
9
apply plugin: "com.github.ben-manes.versions"
10 11 12 13 14 15 16

android {
    compileSdkVersion versions.compileSdk
    buildToolsVersion versions.buildTools

    defaultConfig {
        applicationId "chat.rocket.android"
divyanshu's avatar
divyanshu committed
17
        minSdkVersion versions.minSdk
18
        targetSdkVersion versions.targetSdk
19
        versionCode 2048
Lucio Maciel's avatar
Lucio Maciel committed
20
        versionName "3.0.0"
divyanshu's avatar
divyanshu committed
21
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Lucio Maciel's avatar
Lucio Maciel committed
22
        multiDexEnabled true
23

24 25 26 27
        def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
        def buildTime = new GregorianCalendar().format("MM-dd-yyyy' 'h:mm:ss a z")
        buildConfigField "String", "GIT_SHA", "\"${gitSha}\""

28 29 30 31 32
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
33
    }
34

Lucio Maciel's avatar
Lucio Maciel committed
35 36 37 38 39 40 41
    signingConfigs {
        release {
            storeFile project.rootProject.file('Rocket.jks').getCanonicalFile()
            storePassword System.getenv("KEYSTORE_PASSWORD")
            keyAlias System.getenv("KEY_ALIAS")
            keyPassword System.getenv("KEY_PASSWORD")
        }
divyanshu's avatar
divyanshu committed
42 43 44 45 46 47 48

        debug {
            storeFile project.rootProject.file('debug.keystore').getCanonicalFile()
            storePassword "android"
            keyAlias "androiddebugkey"
            keyPassword "android"
        }
Lucio Maciel's avatar
Lucio Maciel committed
49 50
    }

51 52
    buildTypes {
        release {
53
            buildConfigField "String", "REQUIRED_SERVER_VERSION", '"0.62.0"'
divyanshu's avatar
divyanshu committed
54
            buildConfigField "String", "RECOMMENDED_SERVER_VERSION", '"0.64.2"'
Lucio Maciel's avatar
Lucio Maciel committed
55
            signingConfig signingConfigs.release
56 57 58
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
59 60

        debug {
61
            buildConfigField "String", "REQUIRED_SERVER_VERSION", '"0.62.0"'
divyanshu's avatar
divyanshu committed
62 63
            buildConfigField "String", "RECOMMENDED_SERVER_VERSION", '"0.64.2"'
            signingConfig signingConfigs.debug
64 65
            applicationIdSuffix ".dev"
        }
66
    }
67

68 69 70 71 72 73 74 75 76 77 78 79 80 81
    flavorDimensions "type"

    productFlavors {
        // includes proprietary libs
        play {
            dimension "type"
        }

        // only foss
        foss {
            dimension "type"
        }
    }

82 83
    packagingOptions {
        exclude 'META-INF/core.kotlin_module'
divyanshu's avatar
divyanshu committed
84
        exclude 'META-INF/main.kotlin_module'
85
    }
86 87 88
}

dependencies {
89
    implementation fileTree(include: ['*.jar'], dir: 'libs')
90

91
    implementation project(':player')
divyanshu's avatar
divyanshu committed
92 93
    implementation project(':emoji')
    implementation project(':draw')
94 95
    implementation project(':util')
    implementation project(':core')
96
    implementation project(':suggestions')
97

98
    implementation libraries.kotlin
99 100
    implementation libraries.coroutines
    implementation libraries.coroutinesAndroid
101

102 103
    implementation libraries.appCompat
    implementation libraries.recyclerview
divyanshu's avatar
divyanshu committed
104 105 106
    implementation libraries.constraintlayout
    implementation libraries.cardview
    implementation libraries.browser
107

108
    implementation libraries.androidKtx
109
    implementation libraries.fragmentsKtx
110

111 112 113 114
    implementation libraries.dagger
    implementation libraries.daggerSupport
    kapt libraries.daggerProcessor
    kapt libraries.daggerAndroidApt
115

116 117
    implementation libraries.flexbox
    implementation libraries.material
118

119 120
    implementation libraries.room
    kapt libraries.roomProcessor
121 122
    implementation libraries.lifecycleExtensions
    kapt libraries.lifecycleCompiler
123 124
    implementation libraries.viewmodelKtx
    implementation libraries.workmanager
125

126 127
    implementation libraries.rxKotlin
    implementation libraries.rxAndroid
128

129
    implementation libraries.moshi
130 131
    implementation libraries.okhttp
    implementation libraries.okhttpLogger
132

133 134 135
    implementation libraries.timber
    implementation libraries.threeTenABP

136
    implementation libraries.fresco
137
    api libraries.frescoOkHttp
138 139 140
    implementation libraries.frescoAnimatedGif
    implementation libraries.frescoWebP
    implementation libraries.frescoAnimatedWebP
141

142 143
    implementation libraries.glide

144 145
    kapt libraries.kotshiCompiler
    implementation libraries.kotshiApi
146

147
    implementation libraries.frescoImageViewer
148

149 150
    implementation libraries.markwon

151
    implementation libraries.aVLoadingIndicatorView
152

153
    implementation libraries.livedataKtx
divyanshu's avatar
divyanshu committed
154

155 156
    implementation 'com.google.code.findbugs:jsr305:3.0.2'

157
    // Proprietary libraries
158
    playImplementation libraries.fcm
159
    playImplementation libraries.firebaseAnalytics
160
    playImplementation libraries.playServicesAuth
161 162
    playImplementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { transitive = true }
    playImplementation('com.crashlytics.sdk.android:answers:1.4.3@aar') { transitive = true }
163

164
    testImplementation libraries.junit
165 166 167
    testImplementation libraries.truth
    androidTestImplementation libraries.espressoCore
    androidTestImplementation libraries.espressoIntents
168
}
169

170 171 172 173
kotlin {
    experimental {
        coroutines "enable"
    }
174 175
}

176 177 178 179
androidExtensions {
    experimental = true
}

180 181
// FIXME - build and install the sdk into the app/libs directory
// We were having some issues with the kapt generated files from the sdk when importing as a module
182 183

def sdk_location=project.properties['sdk_location'] ?: ""
184
task compileSdk(type:Exec) {
185
    if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
186
        commandLine 'cmd', '/c', 'build-sdk.sh', sdk_location
187
    } else {
188
        commandLine './build-sdk.sh', sdk_location
189
    }
190
}
Lucio Maciel's avatar
Lucio Maciel committed
191
preBuild.dependsOn compileSdk
192 193 194
if (isPlay) {
    apply plugin: 'com.google.gms.google-services'
}