11plugins {
22 id ' com.github.triplet.play' version ' 2.2.1' apply false
33}
4+
45apply from : ' ../gitutils.gradle'
56apply plugin : ' com.android.application'
67apply plugin : ' kotlin-android'
78apply plugin : ' kotlin-kapt'
89apply plugin : ' jacoco-android'
910apply from : ' quality.gradle'
11+
1012def isRunningOnTravisAndIsNotPRBuild = System . getenv(" CI" ) == " true" && file(' ../play.p12' ). exists()
13+
1114if (isRunningOnTravisAndIsNotPRBuild) {
1215 apply plugin : ' com.github.triplet.play'
1316}
17+
1418dependencies {
19+
1520 // Utils
1621 implementation ' com.github.nicolas-raoul:Quadtree:ac16ea8035bf07'
17- implementation ' com.google.code.gson:gson:2.8.5'
1822 implementation ' in.yuvi:http.fluent:1.3'
1923 implementation ' com.squareup.okhttp3:okhttp:3.12.1'
2024 implementation ' com.squareup.okio:okio:1.15.0'
21- implementation ' io.reactivex.rxjava2:rxandroid:2.1.0'
22- implementation ' io.reactivex.rxjava2:rxjava:2.2.3'
2325 implementation ' com.jakewharton.rxbinding2:rxbinding:2.1.1'
2426 implementation ' com.jakewharton.rxbinding2:rxbinding-support-v4:2.1.1'
2527 implementation ' com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
2628 implementation ' com.jakewharton.rxbinding2:rxbinding-design:2.1.1'
2729 implementation ' com.facebook.fresco:fresco:1.13.0'
28- implementation ' com.drewnoakes:metadata-extractor:2.11.0'
2930 implementation ' com.dmitrybrant:wikimedia-android-data-client:0.0.18'
3031 implementation ' org.apache.commons:commons-lang3:3.8.1'
32+
3133 // UI
3234 implementation ' fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
3335 implementation ' com.github.chrisbanes:PhotoView:2.0.0'
@@ -39,19 +41,20 @@ dependencies {
3941 implementation ' com.karumi:dexter:5.0.0'
4042 implementation " com.jakewharton:butterknife:$BUTTERKNIFE_VERSION "
4143 kapt " com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION "
44+
4245 // Logging
4346 implementation ' ch.acra:acra-dialog:5.3.0'
4447 implementation ' ch.acra:acra-mail:5.3.0'
45- implementation ' com.jakewharton.timber:timber:4.7.1'
4648 implementation ' org.slf4j:slf4j-api:1.7.25'
4749 api(' com.github.tony19:logback-android-classic:1.1.1-6' ) {
4850 exclude group : ' com.google.android' , module : ' android'
4951 }
52+
5053 // Dependency injector
51- implementation " com.google.dagger:dagger:$DAGGER_VERSION "
5254 implementation " com.google.dagger:dagger-android-support:$DAGGER_VERSION "
5355 kapt " com.google.dagger:dagger-android-processor:$DAGGER_VERSION "
5456 kapt " com.google.dagger:dagger-compiler:$DAGGER_VERSION "
57+
5558 // Unit testing
5659 testImplementation " org.jetbrains.kotlin:kotlin-stdlib-jdk7:$KOTLIN_VERSION "
5760 testImplementation " org.jetbrains.kotlin:kotlin-reflect:$KOTLIN_VERSION "
@@ -62,6 +65,7 @@ dependencies {
6265 testImplementation ' com.squareup.okhttp3:mockwebserver:3.10.0'
6366 testImplementation " org.powermock:powermock-module-junit4:2.0.0-beta.5"
6467 testImplementation " org.powermock:powermock-api-mockito2:2.0.0-beta.5"
68+
6569 // Android testing
6670 androidTestImplementation " org.jetbrains.kotlin:kotlin-stdlib-jdk7:$KOTLIN_VERSION "
6771 androidTestImplementation ' androidx.test.espresso:espresso-core:3.1.1'
@@ -73,59 +77,73 @@ dependencies {
7377 androidTestImplementation ' com.squareup.okhttp3:mockwebserver:3.10.0'
7478 androidTestImplementation ' org.mockito:mockito-core:2.10.0'
7579 androidTestUtil ' androidx.test:orchestrator:1.1.1'
80+
7681 // Debugging
7782 debugImplementation " com.squareup.leakcanary:leakcanary-android:$LEAK_CANARY_VERSION "
7883 releaseImplementation " com.squareup.leakcanary:leakcanary-android-no-op:$LEAK_CANARY_VERSION "
7984 testImplementation " com.squareup.leakcanary:leakcanary-android-no-op:$LEAK_CANARY_VERSION "
85+
8086 // Support libraries
8187 implementation " com.google.android.material:material:1.1.0-alpha04"
8288 implementation " androidx.browser:browser:1.0.0"
8389 implementation " androidx.cardview:cardview:1.0.0"
8490 implementation ' androidx.constraintlayout:constraintlayout:1.1.3'
8591 implementation " androidx.exifinterface:exifinterface:1.0.0"
92+
8693 // swipe_layout
8794 implementation ' com.daimajia.swipelayout:library:1.2.0@aar'
95+
8896 // metadata extractor
8997 implementation ' com.drewnoakes:metadata-extractor:2.11.0'
9098}
99+
91100android {
92101 compileSdkVersion 28
93102 buildToolsVersion " 28.0.3"
103+
94104 defaultConfig {
95105 applicationId ' fr.free.nrw.commons'
96106 versionCode 475
97107 versionName ' 2.11.0'
98108 setProperty(" archivesBaseName" , " app-commons-v$versionName -" + getBranchName())
109+
99110 minSdkVersion 19
100111 targetSdkVersion 28
101112 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
102113 testInstrumentationRunnerArguments clearPackageData : ' true'
114+
103115 testOptions {
104116 execution ' ANDROIDX_TEST_ORCHESTRATOR'
105117 }
118+
106119 vectorDrawables. useSupportLibrary = true
107120 }
108121 packagingOptions {
109122 exclude ' META-INF/androidx.*'
110123 exclude ' META-INF/proguard/androidx-annotations.pro'
111124 }
125+
112126 testOptions {
113127 unitTests. returnDefaultValues = true
114128 unitTests. includeAndroidResources = true
129+
115130 unitTests. all {
116131 jvmArgs ' -noverify'
117132 }
118133 }
134+
119135 sourceSets {
120136 // use kotlin only in tests (for now)
121137 test. java. srcDirs + = ' src/test/kotlin'
122138 // use main assets and resources in test
123139 test. assets. srcDirs + = ' src/main/assets'
124140 test. resources. srcDirs + = ' src/main/resoures'
125141 }
142+
126143 signingConfigs {
127144 release
128145 }
146+
129147 buildTypes {
130148 release {
131149 minifyEnabled true
@@ -151,13 +169,17 @@ android {
151169 signingConfigs. release. keyAlias = System . getenv(" key_alias" )
152170 signingConfigs. release. keyPassword = System . getenv(" key_password" )
153171 }
172+
154173 configurations. all {
155174 resolutionStrategy. force ' androidx.annotation:annotation:1.0.2'
156175 }
176+
157177 flavorDimensions ' tier'
158178 productFlavors {
159179 prod {
180+
160181 applicationId ' fr.free.nrw.commons'
182+
161183 buildConfigField " String" , " WIKIMEDIA_API_POTD" , " \" https://commons.wikimedia.org/w/api.php?action=featuredfeed&feed=potd&feedformat=rss&language=en\" "
162184 buildConfigField " String" , " WIKIMEDIA_API_HOST" , " \" https://commons.wikimedia.org/w/api.php\" "
163185 buildConfigField " String" , " WIKIDATA_API_HOST" , " \" https://www.wikidata.org/w/api.php\" "
@@ -181,10 +203,12 @@ android {
181203 buildConfigField " String" , " COMMIT_SHA" , " \" " + getBuildVersion(). toString() + " \" "
182204 buildConfigField " String" , " TEST_USERNAME" , " \" " + System . getenv(" test_user_name" ) + " \" "
183205 buildConfigField " String" , " TEST_PASSWORD" , " \" " + System . getenv(" test_user_password" ) + " \" "
206+
184207 dimension ' tier'
185208 }
186209 beta {
187210 applicationId ' fr.free.nrw.commons.beta'
211+
188212 // What values do we need to hit the BETA versions of the site / api ?
189213 buildConfigField " String" , " WIKIMEDIA_API_POTD" , " \" https://commons.wikimedia.org/w/api.php?action=featuredfeed&feed=potd&feedformat=rss&language=en\" "
190214 buildConfigField " String" , " WIKIMEDIA_API_HOST" , " \" https://commons.wikimedia.beta.wmflabs.org/w/api.php\" "
@@ -209,18 +233,22 @@ android {
209233 buildConfigField " String" , " COMMIT_SHA" , " \" " + getBuildVersion(). toString() + " \" "
210234 buildConfigField " String" , " TEST_USERNAME" , " \" " + System . getenv(" test_user_name" ) + " \" "
211235 buildConfigField " String" , " TEST_PASSWORD" , " \" " + System . getenv(" test_user_password" ) + " \" "
236+
212237 dimension ' tier'
213238 }
214239 }
240+
215241 lintOptions {
216242 disable ' MissingTranslation'
217243 disable ' ExtraTranslation'
218244 abortOnError false
219245 }
246+
220247 compileOptions {
221248 sourceCompatibility JavaVersion . VERSION_1_8
222249 targetCompatibility JavaVersion . VERSION_1_8
223250 }
251+
224252 buildToolsVersion buildToolsVersion
225253}
226254if (isRunningOnTravisAndIsNotPRBuild) {
@@ -229,6 +257,7 @@ if(isRunningOnTravisAndIsNotPRBuild) {
229257 userFraction = 1
230258 serviceAccountEmail = System . getenv(" SERVICE_ACCOUNT_NAME" )
231259 serviceAccountCredentials = file(" ../play.p12" )
260+
232261 resolutionStrategy = " auto"
233262 outputProcessor { // this: ApkVariantOutput
234263 versionNameOverride = " $versionNameOverride . $versionCode "
0 commit comments