Skip to content

Commit c21cc83

Browse files
dbrantmaskaravivek
authored andcommitted
Update to API 28, and fix CI issues. (commons-app#2595)
* Update gradle version. Also update jacoco plugin to work with latest gradle. * Update target sdk to 28. * Update other dependencies to latest versions. * Remove totally unused(?) local jar file. * Remove dependency on nineoldandroids. The functions it provides are no longer necessary. This also removes a homemade "evaluate" function, which is readily available in the Support library. * Remove dependency on Traceur. This library has not been updated in two years (may no longer be maintained?), and no longer works with the latest RxJava. * Enable test coverage only when performing CI. Running test coverage on every single build while developing in the IDE is quite a waste of time. * Suppress gradle Notes and Warnings from reflection-using packages. The build output was getting extremely long, and was actually causing the build to fail because of the sheer size of the log. * Suppress gradle Note messages during tests and CI. Stop CI messages from exploding to 10k+ lines. * Temporarily remove instrumented test(s). The project's instrumented tests consist of a single test which sets a SharedPreference, then verified that the SharedPreference was set. I humbly submit that this is not worth the trouble of having the CI server download the system image, spin up an emulator, load the APK, and run it just for this purpose. Once the instrumented tests are ready for prime time, we can reinstate instrumented tests in CI.
1 parent 8dbeb6e commit c21cc83

File tree

10 files changed

+26
-53
lines changed

10 files changed

+26
-53
lines changed

.travis.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,10 @@ android:
2020
- extra-android-m2repository
2121
- android-22
2222
- android-28
23-
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
2423
licenses:
2524
- android-sdk-license-.+
26-
before_script:
27-
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
28-
- emulator -avd test -no-audio -no-window -no-boot-anim &
29-
- android-wait-for-emulator
3025
script:
31-
- "./gradlew clean check connectedCheck jacocoTestReport"
26+
- "./gradlew -Pcoverage clean check jacocoTestReport"
3227
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
3328
mkdir -p app/src/prodRelease/play/release-notes/en-US;
3429
fi

app/build.gradle

+7-10
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ dependencies {
1919
implementation 'com.google.code.gson:gson:2.8.5'
2020
implementation 'info.debatty:java-string-similarity:0.24'
2121
implementation 'in.yuvi:http.fluent:1.3'
22-
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
23-
implementation 'com.squareup.okio:okio:1.14.0'
22+
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
23+
implementation 'com.squareup.okio:okio:1.15.0'
2424
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
25-
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
25+
implementation 'io.reactivex.rxjava2:rxjava:2.2.3'
2626
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
2727
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.1.1'
2828
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
2929
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.1.1'
30-
implementation 'com.facebook.fresco:fresco:1.10.0'
30+
implementation 'com.facebook.fresco:fresco:1.13.0'
3131
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
3232

3333
// UI
@@ -38,12 +38,11 @@ dependencies {
3838
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
3939
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
4040
implementation 'com.karumi:dexter:5.0.0'
41-
implementation files('libs/simplemagic-1.9.jar')
4241
implementation "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
4342
kapt "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION"
4443
// Logging
4544
implementation 'ch.acra:acra:4.9.2'
46-
implementation 'com.jakewharton.timber:timber:4.4.0'
45+
implementation 'com.jakewharton.timber:timber:4.7.1'
4746
implementation 'org.slf4j:slf4j-api:1.7.25'
4847
api('com.github.tony19:logback-android-classic:1.1.1-6') {
4948
exclude group: 'com.google.android', module: 'android'
@@ -73,7 +72,6 @@ dependencies {
7372
androidTestImplementation 'org.mockito:mockito-core:2.10.0'
7473

7574
// Debugging
76-
implementation 'com.tspoon.traceur:traceur:1.0.1'
7775
implementation 'com.facebook.stetho:stetho:1.5.0'
7876
debugImplementation "com.squareup.leakcanary:leakcanary-android:$LEAK_CANARY_VERSION"
7977
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$LEAK_CANARY_VERSION"
@@ -89,7 +87,6 @@ dependencies {
8987

9088
//swipe_layout
9189
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
92-
implementation 'com.nineoldandroids:library:2.4.0'
9390
//metadata extractor
9491
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
9592
}
@@ -105,7 +102,7 @@ android {
105102
setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName())
106103

107104
minSdkVersion 15
108-
targetSdkVersion 27
105+
targetSdkVersion 28
109106
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
110107
vectorDrawables.useSupportLibrary = true
111108
}
@@ -142,7 +139,7 @@ android {
142139
}
143140
debug {
144141
minifyEnabled true
145-
testCoverageEnabled true
142+
testCoverageEnabled project.hasProperty('coverage')
146143
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
147144
testProguardFile 'test-proguard-rules.txt'
148145
versionNameSuffix "-debug-" + getBranchName()

app/libs/simplemagic-1.9.jar

-217 KB
Binary file not shown.

app/proguard-rules.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
-dontobfuscate
22
-ignorewarnings
33

4+
-dontnote **
5+
-dontwarn net.bytebuddy.**
6+
-dontwarn org.mockito.**
7+
48
-keep class org.apache.http.** { *; }
59
-dontwarn org.apache.http.**
610
-keep class android.support.v7.widget.ShareActionProvider { *; }

app/src/main/java/fr/free/nrw/commons/CommonsApplication.java

-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import com.facebook.stetho.Stetho;
1717
import com.squareup.leakcanary.LeakCanary;
1818
import com.squareup.leakcanary.RefWatcher;
19-
import com.tspoon.traceur.Traceur;
2019

2120
import org.acra.ACRA;
2221
import org.acra.ReportingInteractionMode;
@@ -90,11 +89,6 @@ public class CommonsApplication extends Application {
9089
public void onCreate() {
9190
super.onCreate();
9291
ACRA.init(this);
93-
if (BuildConfig.DEBUG) {
94-
//FIXME: Traceur should be disabled for release builds until error fixed
95-
//See https://github.com/commons-app/apps-android-commons/issues/1877
96-
Traceur.enableLogging();
97-
}
9892

9993
ApplicationlessInjection
10094
.getInstance(this)

app/src/main/java/fr/free/nrw/commons/notification/NotificationRenderer.java

+5-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fr.free.nrw.commons.notification;
22

33
import android.graphics.Color;
4+
import android.support.design.animation.ArgbEvaluatorCompat;
45
import android.text.Html;
56
import android.view.LayoutInflater;
67
import android.view.View;
@@ -11,7 +12,6 @@
1112
import android.widget.TextView;
1213

1314
import com.daimajia.swipe.SwipeLayout;
14-
import com.nineoldandroids.view.ViewHelper;
1515
import com.pedrogomez.renderers.Renderer;
1616

1717
import butterknife.BindView;
@@ -82,34 +82,15 @@ protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) {
8282
swipeLayout.addRevealListener(R.id.bottom_wrapper_child1, (child, edge, fraction, distance) -> {
8383
View star = child.findViewById(R.id.star);
8484
float d = child.getHeight() / 2 - star.getHeight() / 2;
85-
ViewHelper.setTranslationY(star, d * fraction);
86-
ViewHelper.setScaleX(star, fraction + 0.6f);
87-
ViewHelper.setScaleY(star, fraction + 0.6f);
88-
int c = (Integer) evaluate(fraction, Color.parseColor("#dddddd"), Color.parseColor("#90960a0a"));
85+
star.setTranslationY(d * fraction);
86+
star.setScaleX(fraction + 0.6f);
87+
star.setScaleY(fraction + 0.6f);
88+
int c = ArgbEvaluatorCompat.getInstance().evaluate(fraction, Color.parseColor("#dddddd"), Color.parseColor("#90960a0a"));
8989
child.setBackgroundColor(c);
9090
});
9191
return inflatedView;
9292
}
9393

94-
public Object evaluate(float fraction, Object startValue, Object endValue) {
95-
int startInt = (Integer) startValue;
96-
int startA = (startInt >> 24) & 0xff;
97-
int startR = (startInt >> 16) & 0xff;
98-
int startG = (startInt >> 8) & 0xff;
99-
int startB = startInt & 0xff;
100-
101-
int endInt = (Integer) endValue;
102-
int endA = (endInt >> 24) & 0xff;
103-
int endR = (endInt >> 16) & 0xff;
104-
int endG = (endInt >> 8) & 0xff;
105-
int endB = endInt & 0xff;
106-
107-
return (int) ((startA + (int) (fraction * (endA - startA))) << 24) |
108-
(int) ((startR + (int) (fraction * (endR - startR))) << 16) |
109-
(int) ((startG + (int) (fraction * (endG - startG))) << 8) |
110-
(int) ((startB + (int) (fraction * (endB - startB))));
111-
}
112-
11394
@Override
11495
public void render() {
11596
Notification notification = getContent();

app/test-proguard-rules.txt

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
-dontoptimize
33
-dontshrink
44
-ignorewarnings
5+
6+
-dontnote **

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ buildscript {
66
mavenCentral()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.4'
10-
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3'
9+
classpath 'com.android.tools.build:gradle:3.3.2'
10+
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
1111
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
1313

gradle.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ android.enableBuildCache=true
1818
compileSdkVersion=android-28
1919
buildToolsVersion=28.0.3
2020

21-
SUPPORT_LIB_VERSION=27.1.1
22-
KOTLIN_VERSION=1.2.60
21+
SUPPORT_LIB_VERSION=28.0.0
22+
KOTLIN_VERSION=1.3.21
2323
BUTTERKNIFE_VERSION=8.8.1
24-
LEAK_CANARY_VERSION=1.5.4
24+
LEAK_CANARY_VERSION=1.6.2
2525
DAGGER_VERSION=2.15
2626

2727
systemProp.http.proxyPort=0
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sat Nov 03 11:02:51 CET 2018
1+
#Thu Mar 14 14:54:52 EDT 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

0 commit comments

Comments
 (0)