Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sweeping update of gradle and dependency versions. #1858

Merged
merged 13 commits into from
Sep 11, 2018
Merged
6 changes: 0 additions & 6 deletions .gitreview

This file was deleted.

7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@ env:
- ADB_INSTALL_TIMEOUT=12 # in minutes

jdk:
# - openjdk8 # not yet available
- oraclejdk8

android:
components:
- tools
- platform-tools
- build-tools-27.0.0
- build-tools-27.0.3
- extra-google-m2repository
- extra-android-m2repository
- ${ANDROID_TARGET}
- android-25
- android-26
- android-22
- android-27
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
licenses:
Expand Down
51 changes: 23 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco-android'
apply from: 'quality.gradle'
apply plugin: 'com.getkeepsafe.dexcount'

dependencies {
implementation 'com.prof.rssparser:rssparser:1.1'
Expand All @@ -16,12 +15,12 @@ dependencies {
implementation 'org.mediawiki:api:1.3'
implementation 'commons-codec:commons-codec:1.10'
implementation 'com.github.pedrovgs:renderers:3.3.3'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.jakewharton.timber:timber:4.5.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.jakewharton.timber:timber:4.6.0'
implementation 'info.debatty:java-string-similarity:0.24'
implementation 'com.borjabravo:readmoretextview:2.1.0'

implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.0@aar') {
transitive = true
}
Expand All @@ -34,35 +33,35 @@ dependencies {
implementation "com.android.support:cardview-v7:$SUPPORT_LIB_VERSION"
implementation "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
kapt "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION"
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okio:okio:1.13.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okio:okio:1.14.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
implementation 'io.reactivex.rxjava2:rxjava:2.1.2'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.1.1'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.facebook.fresco:fresco:1.5.0'
implementation 'com.facebook.fresco:fresco:1.10.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation "com.google.dagger:dagger:$DAGGER_VERSION"
implementation "com.google.dagger:dagger-android-support:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:3.7.1'
testImplementation 'com.nhaarman:mockito-kotlin:1.5.0'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.10.0'
implementation 'com.dinuscxj:circleprogressbar:1.1.1'

implementation 'com.tspoon.traceur:traceur:1.0.1'

androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.10.0'
androidTestImplementation "com.android.support:support-annotations:$SUPPORT_LIB_VERSION"
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
Expand All @@ -81,16 +80,14 @@ android {
compileSdkVersion project.compileSdkVersion
buildToolsVersion project.buildToolsVersion

useLibrary 'org.apache.http.legacy'

defaultConfig {
applicationId 'fr.free.nrw.commons'
versionCode 90
versionName '2.8.3'
setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName())

minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
minSdkVersion 15
targetSdkVersion 27
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand All @@ -112,11 +109,15 @@ android {

buildTypes {
release {
minifyEnabled false // See https://stackoverflow.com/questions/40232404/google-play-apk-and-android-studio-apk-usb-debug-behaving-differently - proguard.cfg modification alone insufficient.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
testProguardFile 'test-proguard-rules.txt'
}
debug {
minifyEnabled true
testCoverageEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
testProguardFile 'test-proguard-rules.txt'
versionNameSuffix "-debug-" + getBranchName() + "~" + getBuildVersion()
}
}
Expand Down Expand Up @@ -189,11 +190,5 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

//FIXME: Temporary fix for https://github.com/commons-app/apps-android-commons/issues/709
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.2.0'
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
buildToolsVersion buildToolsVersion
}
Binary file removed app/libs/java-json.jar
Binary file not shown.
56 changes: 55 additions & 1 deletion app/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
-dontobfuscate
-ignorewarnings

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-keep class android.support.v7.widget.ShareActionProvider { *; }
-keep class android.support.v7.widget.ShareActionProvider { *; }

# --- Butter Knife ---
# Finder.castParam() is stripped when not needed and ProGuard notes it
# unnecessarily. When castParam() is needed, it's not stripped. e.g.:
#
# @OnItemSelected(value = R.id.history_entry_list)
# void foo(ListView bar) {
# L.d("baz");
# }

-dontnote butterknife.internal.**
# --- /Butter Knife ---

# --- Retrofit2 ---
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
# --- /Retrofit ---

# --- OkHttp + Okio ---
-dontwarn okhttp3.**
-dontwarn okio.**
# --- /OkHttp + Okio ---

# --- Gson ---
# https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg

# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# --- /Gson ---
12 changes: 9 additions & 3 deletions app/src/main/java/fr/free/nrw/commons/CommonsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,25 @@ public void onCreate() {
.getInstance(this)
.getCommonsApplicationComponent()
.inject(this);

Timber.plant(new Timber.DebugTree());

// Set DownsampleEnabled to True to downsample the image in case it's heavy
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setDownsampleEnabled(true)
.build();
Fresco.initialize(this,config);
try {
Fresco.initialize(this, config);
} catch (Exception e) {
Timber.e(e);
// TODO: Remove when we're able to initialize Fresco in test builds.
}
if (setupLeakCanary() == RefWatcher.DISABLED) {
return;
}
// Empty temp directory in case some temp files are created and never removed.
ContributionUtils.emptyTemporaryDirectory();

Timber.plant(new Timber.DebugTree());

if (!BuildConfig.DEBUG) {
ACRA.init(this);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.support.graphics.drawable.VectorDrawableCompat;

Expand Down Expand Up @@ -135,9 +136,14 @@ public static List<NearbyBaseMarker> loadAttractionsFromLocationToBaseMarkerOpti

placeList = placeList.subList(0, Math.min(placeList.size(), MAX_RESULTS));

VectorDrawableCompat vectorDrawable = VectorDrawableCompat.create(
context.getResources(), R.drawable.ic_custom_map_marker, context.getTheme()
);
VectorDrawableCompat vectorDrawable = null;
try {
vectorDrawable = VectorDrawableCompat.create(
context.getResources(), R.drawable.ic_custom_map_marker, context.getTheme()
);
} catch (Resources.NotFoundException e) {
// ignore when running tests.
}
if (vectorDrawable != null) {
Bitmap icon = UiUtils.getBitmap(vectorDrawable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config

@RunWith(RobolectricTestRunner::class)
@Config(constants = BuildConfig::class, sdk = intArrayOf(21), application = TestCommonsApplication::class)
@Config(constants = BuildConfig::class, sdk = [21], application = TestCommonsApplication::class)
class NearbyControllerTest {

@Test
Expand Down
4 changes: 4 additions & 0 deletions app/test-proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-dontobfuscate
-dontoptimize
-dontshrink
-ignorewarnings
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.31'
ext.kotlin_version = '1.2.60'
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.1'
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
13 changes: 3 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@
#Thu Mar 01 15:28:48 IST 2018
systemProp.http.proxyPort=0
compileSdkVersion=android-27
android.useDeprecatedNdk=true
BUTTERKNIFE_VERSION=8.6.0
BUTTERKNIFE_VERSION=8.8.1
org.gradle.jvmargs=-Xmx1536M
buildToolsVersion=27.0.0
targetSdkVersion=27
buildToolsVersion=27.0.3

#TODO: Temporary disabled. https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#aapt2
#Refer to PR: https://github.com/commons-app/apps-android-commons/pull/932
android.enableAapt2=false
SUPPORT_LIB_VERSION=27.1.1
minSdkVersion=15
systemProp.http.proxyHost=
LEAK_CANARY=1.5.4
DAGGER_VERSION=2.13
gradleVersion=3.0.0
DAGGER_VERSION=2.15
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Mar 03 13:58:47 IST 2018
#Sat Aug 25 23:38:03 EDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip