build.gradle 9.22 KB
Newer Older
1 2 3 4
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: "kotlin-kapt"
5
apply plugin: "androidx.navigation.safeargs.kotlin"
Christophe Henry's avatar
Christophe Henry committed
6
apply plugin: "com.diffplug.gradle.spotless"
7 8

android {
9 10
    def schema_location = "$projectDir/src/main/java/fr/chenry/android/freshrss/store/database/migrations".toString()

Christophe Henry's avatar
Christophe Henry committed
11
    compileSdkVersion 30
12 13
    defaultConfig {
        applicationId "fr.chenry.android.freshrss"
14
        minSdkVersion 21
Christophe Henry's avatar
Christophe Henry committed
15
        targetSdkVersion 30
FreshRSS Jenkins's avatar
FreshRSS Jenkins committed
16 17
        versionCode 16
        versionName "1.3.3"
18
        testInstrumentationRunner "fr.chenry.android.freshrss.utils.FreshRSSTestRunner"
19
        testInstrumentationRunnerArguments clearPackageData: "true"
20 21
        javaCompileOptions {
            annotationProcessorOptions {
22
                arguments = ["room.schemaLocation": schema_location]
23 24
            }
        }
25
    }
Christophe Henry's avatar
Christophe Henry committed
26

augier's avatar
augier committed
27
    compileOptions {
Christophe Henry's avatar
Christophe Henry committed
28 29
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
augier's avatar
augier committed
30 31 32 33
    }

    kotlinOptions {
        jvmTarget = "1.8"
Christophe Henry's avatar
Christophe Henry committed
34
        freeCompilerArgs = ["-Xallow-result-return-type"]
augier's avatar
augier committed
35 36
    }

37 38 39 40
    sourceSets {
        androidTest.assets.srcDirs += files(schema_location)
    }

41 42 43 44 45
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
        }
Christophe Henry's avatar
~  
Christophe Henry committed
46 47 48
        jenkins {
            initWith release
        }
49 50
    }

Christophe Henry's avatar
Christophe Henry committed
51
    applicationVariants.all { variant ->
Christophe Henry's avatar
Christophe Henry committed
52
        if (variant.name != "debug") {
Christophe Henry's avatar
Christophe Henry committed
53 54 55 56
            variant.mergeAssetsProvider.get().doLast {
                delete new FileNameFinder().getFileNames(buildDir.absolutePath, "**/config.properties")
            }
        }
Christophe Henry's avatar
~  
Christophe Henry committed
57

58
        variant.outputs.all { output ->
Christophe Henry's avatar
~  
Christophe Henry committed
59 60
            if (variant.name == "jenkins") outputFileName = new File("FreshRSS-develop-jenkins.apk")
            else outputFileName = new File("FreshRSS-${variant.versionName}-${variant.name}.apk")
61
        }
Christophe Henry's avatar
Christophe Henry committed
62
    }
63 64 65 66

    androidExtensions {
        experimental = true
    }
Christophe Henry's avatar
~  
Christophe Henry committed
67

Christophe Henry's avatar
Christophe Henry committed
68 69
    buildFeatures {
        dataBinding = true
Christophe Henry's avatar
~  
Christophe Henry committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
    }

    testOptions {
        unitTests.all {
            testLogging {
                events "passed", "skipped", "failed", "standardOut", "standardError"
                outputs.upToDateWhen { false }
                showStandardStreams = true
            }
        }
    }

    lintOptions {
        disable "AllowBackup", "VectorPath", "GradleDependency", "MissingTranslation", "InvalidPackage"
    }
85 86
}

Christophe Henry's avatar
Christophe Henry committed
87 88 89 90 91 92 93 94 95 96 97 98 99
configurations {
    ktlint
}

spotless {
    format "misc", {
        target "**/*.gradle", "**/*.md", "**/.gitignore", "**/*.kt"
        trimTrailingWhitespace()
        endWithNewline()
    }
    kotlin {
        ktlint().userData([
            "trim_trailing_whitespace": true,
augier's avatar
augier committed
100 101
            "insert_final_newline"    : true,
            "max_line_length"         : 120,
Christophe Henry's avatar
Christophe Henry committed
102 103 104 105
        ])
    }
}

106
dependencies {
Christophe Henry's avatar
Christophe Henry committed
107
    def appcompat_version = "1.2.0"
Christophe Henry's avatar
Christophe Henry committed
108
    def activity_version = "1.1.0"
Christophe Henry's avatar
Christophe Henry committed
109
    def fragment_version = "1.2.5"
Christophe Henry's avatar
Christophe Henry committed
110
    def lifecycle_version = "2.2.0"
Christophe Henry's avatar
Christophe Henry committed
111
    def room_version = "2.2.5"
Christophe Henry's avatar
Christophe Henry committed
112 113 114 115
    def roomigrant_version = "0.2.6"
    def jackson_version = "2.11.2"
    def espresso_version = "3.3.0"
    def espresso_idling_version = "3.3.0"
116
    def jsoup_version = "1.13.1"
Christophe Henry's avatar
Christophe Henry committed
117
    def acraVersion = "5.7.0"
Christophe Henry's avatar
Christophe Henry committed
118
    def autoservice_version = "1.0-rc7"
Christophe Henry's avatar
Christophe Henry committed
119
    def android_test = "1.3.0"
Christophe Henry's avatar
Christophe Henry committed
120
    def retrofit_version = "2.9.0"
Christophe Henry's avatar
Christophe Henry committed
121 122
    def okhttp_version = "4.9.0"
    def work_version = "2.4.0"
Christophe Henry's avatar
Christophe Henry committed
123
    def mockk_version = "1.10.0"
124
    def hamcrest_version = "2.2"
125

Christophe Henry's avatar
Christophe Henry committed
126 127 128
    // Linter
    ktlint "com.github.shyiko:ktlint:0.31.0"

129
    implementation fileTree(include: ["*.jar"], dir: "libs")
Christophe Henry's avatar
Christophe Henry committed
130 131

    // Kotlin stuff
132 133
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Christophe Henry's avatar
Christophe Henry committed
134

Christophe Henry's avatar
Christophe Henry committed
135
    // AndroidX
Christophe Henry's avatar
Christophe Henry committed
136
    implementation "androidx.core:core-ktx:1.3.1"
Christophe Henry's avatar
Christophe Henry committed
137 138
    implementation "androidx.appcompat:appcompat:$appcompat_version"
    implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
Christophe Henry's avatar
Christophe Henry committed
139
    implementation "androidx.activity:activity-ktx:$activity_version"
Christophe Henry's avatar
Christophe Henry committed
140 141
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
    implementation "androidx.constraintlayout:constraintlayout:2.0.1"
Christophe Henry's avatar
Christophe Henry committed
142
    implementation "androidx.recyclerview:recyclerview:1.1.0"
Christophe Henry's avatar
Christophe Henry committed
143
    implementation "androidx.preference:preference-ktx:1.1.1"
Christophe Henry's avatar
Christophe Henry committed
144
    implementation "com.google.android.material:material:1.3.0-alpha02"
145 146

    // ViewModel and LiveData
Christophe Henry's avatar
Christophe Henry committed
147
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
148
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
augier's avatar
augier committed
149
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
Christophe Henry's avatar
Christophe Henry committed
150
    implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
augier's avatar
augier committed
151
    kapt "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
152

Christophe Henry's avatar
Christophe Henry committed
153
    // Navigation
154 155
    implementation "androidx.navigation:navigation-fragment-ktx:$android_navigation"
    implementation "androidx.navigation:navigation-ui-ktx:$android_navigation"
Christophe Henry's avatar
Christophe Henry committed
156 157

    // Room & roomigrant
158
    kapt "androidx.room:room-compiler:$room_version"
Christophe Henry's avatar
Christophe Henry committed
159
    implementation "androidx.room:room-ktx:$room_version"
160
    implementation "androidx.room:room-runtime:$room_version"
161
    implementation "androidx.room:room-rxjava2:$room_version"
162
    implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
Christophe Henry's avatar
Christophe Henry committed
163 164
    implementation "com.github.RBusarow.Roomigrant:RoomigrantLib:$roomigrant_version"
    kapt "com.github.RBusarow.Roomigrant:RoomigrantCompiler:$roomigrant_version"
165

166
    // HTTP and promises
167
    implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version"
168
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
Christophe Henry's avatar
Christophe Henry committed
169 170 171
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-jackson:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version"
172 173 174 175
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"

    // WorkManager
    implementation "androidx.work:work-runtime-ktx:$work_version"
Christophe Henry's avatar
Christophe Henry committed
176
    implementation "com.google.guava:guava:29.0-jre"
177

178

Christophe Henry's avatar
Christophe Henry committed
179
    // Utils
Christophe Henry's avatar
Christophe Henry committed
180
    implementation "org.apache.commons:commons-text:1.9"
Christophe Henry's avatar
Christophe Henry committed
181
    implementation "joda-time:joda-time:2.10.6"
182
    implementation "com.squareup.picasso:picasso:2.71828"
augier's avatar
augier committed
183
    implementation "com.x5dev:chunk-templates:3.5.0"
184 185
    implementation "eu.davidea:flexible-adapter:5.1.0"
    implementation "eu.davidea:flexible-adapter-ui:1.0.0"
186
    implementation "org.jsoup:jsoup:$jsoup_version"
187 188
    compileOnly "com.google.auto.service:auto-service-annotations:$autoservice_version"
    kapt "com.google.auto.service:auto-service:$autoservice_version"
189

Christophe Henry's avatar
Christophe Henry committed
190 191 192 193
    // Bug report
    implementation "ch.acra:acra-http:$acraVersion"
    implementation "ch.acra:acra-notification:$acraVersion"

Christophe Henry's avatar
Christophe Henry committed
194
    // Tests
Christophe Henry's avatar
Christophe Henry committed
195
    testImplementation "junit:junit:4.13"
196 197 198
    debugImplementation "org.hamcrest:hamcrest-library:$hamcrest_version"
    debugImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version"
    debugImplementation "com.github.javafaker:javafaker:1.0.2"
Christophe Henry's avatar
Christophe Henry committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
    /*
     * org.json:json is used with explicit permission of its copyright holders :
     *
     * Copyright (c) 2002 JSON.org
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in all
     * copies or substantial portions of the Software.
     *
     * The Software shall be used for Good, not Evil.
     */
Christophe Henry's avatar
Christophe Henry committed
216 217
    testImplementation "org.json:json:20200518"
    testImplementation "io.mockk:mockk:$mockk_version"
218 219 220 221 222

    debugImplementation "androidx.test:core:$android_test"
    debugImplementation "androidx.test:rules:$android_test"
    debugImplementation "androidx.test:runner:$android_test"

Christophe Henry's avatar
Christophe Henry committed
223
    androidTestImplementation "androidx.test.ext:junit:1.1.2"
Christophe Henry's avatar
Christophe Henry committed
224 225

    androidTestImplementation "io.mockk:mockk-android:$mockk_version"
226 227

    // Espresso
228
    androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
229
    androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
230 231 232 233
    androidTestImplementation "androidx.test.espresso:espresso-web:$espresso_version"
    androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version"
    androidTestImplementation "androidx.test.espresso.idling:idling-concurrent:$espresso_idling_version"
    androidTestImplementation "androidx.test.espresso:espresso-idling-resource:$espresso_idling_version"
Christophe Henry's avatar
Christophe Henry committed
234

235 236 237 238 239 240 241
    debugImplementation("androidx.fragment:fragment-testing:$fragment_version") {
        exclude group: "androidx.test", module: "core"
    }

    androidTestImplementation "androidx.work:work-testing:$work_version"
    androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
    androidTestImplementation "androidx.room:room-testing:$room_version"
242

Christophe Henry's avatar
Christophe Henry committed
243
    // Debug
augier's avatar
augier committed
244
    debugImplementation "com.facebook.stetho:stetho:1.5.1"
245
}