build.gradle 8.61 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()

11 12 13
    compileSdkVersion 28
    defaultConfig {
        applicationId "fr.chenry.android.freshrss"
14
        minSdkVersion 21
15
        targetSdkVersion 28
augier's avatar
augier committed
16 17
        versionCode 12
        versionName "1.2.2"
18
        testInstrumentationRunner "fr.chenry.android.freshrss.utils.FreshRSSTestRunner"
Christophe Henry's avatar
Christophe Henry committed
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 52 53 54 55 56
    applicationVariants.all { variant ->
        if (variant.name.contains("elease")) {
            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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

    dataBinding {
        enabled = true
    }

    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.1.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.2'
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.4'
112
    def roomigrant_version = "0.1.7"
113
    def jackson_version = '2.10.2'
augier's avatar
augier committed
114
    def espresso_version = "3.2.0"
Christophe Henry's avatar
Christophe Henry committed
115
    def android_navigation = "1.0.0"
Christophe Henry's avatar
Christophe Henry committed
116 117
    def jsoup_version = '1.12.2'
    def acraVersion = '5.5.0'
118
    def autoservice_version = "1.0-rc6"
119
    def android_test = "1.2.0"
Christophe Henry's avatar
Christophe Henry committed
120
    def retrofit_version = "2.7.2"
121 122
    def okhttp_version = "4.4.0"
    def work_version = "2.3.2"
123

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

127 128
    implementation "androidx.legacy:legacy-support-v4:1.0.0"
    implementation fileTree(include: ["*.jar"], dir: "libs")
Christophe Henry's avatar
Christophe Henry committed
129 130

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

Christophe Henry's avatar
Christophe Henry committed
134 135 136
    // AndroidX
    implementation "androidx.appcompat:appcompat:$appcompat_version"
    implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
Christophe Henry's avatar
Christophe Henry committed
137 138
    implementation "androidx.activity:activity-ktx:$activity_version"
    implementation "androidx.fragment:fragment-ktx:$fragment_version"
Christophe Henry's avatar
Christophe Henry committed
139

Christophe Henry's avatar
Christophe Henry committed
140
    implementation 'androidx.core:core-ktx:1.2.0'
141
    implementation "androidx.constraintlayout:constraintlayout:1.1.3"
Christophe Henry's avatar
Christophe Henry committed
142 143
    implementation "androidx.recyclerview:recyclerview:1.1.0"
    implementation "androidx.preference:preference-ktx:1.1.0"
Christophe Henry's avatar
Christophe Henry committed
144
    implementation 'com.google.android.material:material:1.2.0-alpha05'
145

Christophe Henry's avatar
Christophe Henry committed
146
    // AndroidX testing
Christophe Henry's avatar
Christophe Henry committed
147
    debugImplementation "androidx.fragment:fragment-testing:$fragment_version"
Christophe Henry's avatar
Christophe Henry committed
148

149
    // ViewModel and LiveData
Christophe Henry's avatar
Christophe Henry committed
150
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
151
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
augier's avatar
augier committed
152
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
Christophe Henry's avatar
Christophe Henry committed
153
    implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
augier's avatar
augier committed
154 155
    kapt "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
156

Christophe Henry's avatar
Christophe Henry committed
157 158 159 160 161
    // Navigation
    implementation "android.arch.navigation:navigation-fragment-ktx:$android_navigation"
    implementation "android.arch.navigation:navigation-ui-ktx:$android_navigation"

    // Room & roomigrant
162
    kapt "androidx.room:room-compiler:$room_version"
Christophe Henry's avatar
Christophe Henry committed
163
    implementation "androidx.room:room-ktx:$room_version"
164
    implementation "androidx.room:room-runtime:$room_version"
165
    implementation "androidx.room:room-rxjava2:$room_version"
166 167 168
    androidTestImplementation "androidx.room:room-testing:$room_version"
    implementation "com.github.MatrixDev.Roomigrant:RoomigrantLib:$roomigrant_version"
    kapt "com.github.MatrixDev.Roomigrant:RoomigrantCompiler:$roomigrant_version"
169

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

    // WorkManager
    implementation "androidx.work:work-runtime-ktx:$work_version"
    implementation "com.google.guava:guava:28.2-android"

182

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

Christophe Henry's avatar
Christophe Henry committed
194 195 196 197
    // Bug report
    implementation "ch.acra:acra-http:$acraVersion"
    implementation "ch.acra:acra-notification:$acraVersion"

Christophe Henry's avatar
Christophe Henry committed
198
    // Tests
Christophe Henry's avatar
Christophe Henry committed
199
    testImplementation "junit:junit:4.13"
Christophe Henry's avatar
Christophe Henry committed
200
    testImplementation "org.hamcrest:hamcrest-library:2.2"
201
    testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version"
Christophe Henry's avatar
Christophe Henry committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
    testImplementation "com.github.javafaker:javafaker:1.0.2"
    /*
     * 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.
     */
    testImplementation "org.json:json:20190722"
    androidTestImplementation "com.github.javafaker:javafaker:1.0.2"
222 223
    androidTestImplementation "androidx.test:rules:$android_test"
    androidTestImplementation "androidx.test:runner:$android_test"
Christophe Henry's avatar
Christophe Henry committed
224
    androidTestImplementation "androidx.test.ext:junit:1.1.1"
225
    androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
226
    androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
227
    androidTestImplementation "androidx.work:work-testing:$work_version"
Christophe Henry's avatar
Christophe Henry committed
228 229

    // Debug
augier's avatar
augier committed
230
    debugImplementation "com.facebook.stetho:stetho:1.5.1"
231
}