Skip to content

Commit

Permalink
Update to API 28, and fix CI issues. (commons-app#2595)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
dbrant authored and maskaravivek committed Mar 15, 2019
1 parent 8dbeb6e commit c21cc83
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 53 deletions.
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,10 @@ android:
- extra-android-m2repository
- android-22
- android-28
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
licenses:
- android-sdk-license-.+
before_script:
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-audio -no-window -no-boot-anim &
- android-wait-for-emulator
script:
- "./gradlew clean check connectedCheck jacocoTestReport"
- "./gradlew -Pcoverage clean check jacocoTestReport"
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
mkdir -p app/src/prodRelease/play/release-notes/en-US;
fi
Expand Down
17 changes: 7 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'info.debatty:java-string-similarity:0.24'
implementation 'in.yuvi:http.fluent:1.3'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okio:okio:1.14.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.okio:okio:1.15.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.3'
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 'com.facebook.fresco:fresco:1.10.0'
implementation 'com.facebook.fresco:fresco:1.13.0'
implementation 'com.drewnoakes:metadata-extractor:2.11.0'

// UI
Expand All @@ -38,12 +38,11 @@ dependencies {
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
implementation 'com.karumi:dexter:5.0.0'
implementation files('libs/simplemagic-1.9.jar')
implementation "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
kapt "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION"
// Logging
implementation 'ch.acra:acra:4.9.2'
implementation 'com.jakewharton.timber:timber:4.4.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'org.slf4j:slf4j-api:1.7.25'
api('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
Expand Down Expand Up @@ -73,7 +72,6 @@ dependencies {
androidTestImplementation 'org.mockito:mockito-core:2.10.0'

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

//swipe_layout
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
implementation 'com.nineoldandroids:library:2.4.0'
//metadata extractor
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
}
Expand All @@ -105,7 +102,7 @@ android {
setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName())

minSdkVersion 15
targetSdkVersion 27
targetSdkVersion 28
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand Down Expand Up @@ -142,7 +139,7 @@ android {
}
debug {
minifyEnabled true
testCoverageEnabled true
testCoverageEnabled project.hasProperty('coverage')
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
testProguardFile 'test-proguard-rules.txt'
versionNameSuffix "-debug-" + getBranchName()
Expand Down
Binary file removed app/libs/simplemagic-1.9.jar
Binary file not shown.
4 changes: 4 additions & 0 deletions app/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
-dontobfuscate
-ignorewarnings

-dontnote **
-dontwarn net.bytebuddy.**
-dontwarn org.mockito.**

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-keep class android.support.v7.widget.ShareActionProvider { *; }
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/fr/free/nrw/commons/CommonsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.facebook.stetho.Stetho;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import com.tspoon.traceur.Traceur;

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

ApplicationlessInjection
.getInstance(this)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.free.nrw.commons.notification;

import android.graphics.Color;
import android.support.design.animation.ArgbEvaluatorCompat;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -11,7 +12,6 @@
import android.widget.TextView;

import com.daimajia.swipe.SwipeLayout;
import com.nineoldandroids.view.ViewHelper;
import com.pedrogomez.renderers.Renderer;

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

public Object evaluate(float fraction, Object startValue, Object endValue) {
int startInt = (Integer) startValue;
int startA = (startInt >> 24) & 0xff;
int startR = (startInt >> 16) & 0xff;
int startG = (startInt >> 8) & 0xff;
int startB = startInt & 0xff;

int endInt = (Integer) endValue;
int endA = (endInt >> 24) & 0xff;
int endR = (endInt >> 16) & 0xff;
int endG = (endInt >> 8) & 0xff;
int endB = endInt & 0xff;

return (int) ((startA + (int) (fraction * (endA - startA))) << 24) |
(int) ((startR + (int) (fraction * (endR - startR))) << 16) |
(int) ((startG + (int) (fraction * (endG - startG))) << 8) |
(int) ((startB + (int) (fraction * (endB - startB))));
}

@Override
public void render() {
Notification notification = getContent();
Expand Down
2 changes: 2 additions & 0 deletions app/test-proguard-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
-dontoptimize
-dontshrink
-ignorewarnings

-dontnote **
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ android.enableBuildCache=true
compileSdkVersion=android-28
buildToolsVersion=28.0.3

SUPPORT_LIB_VERSION=27.1.1
KOTLIN_VERSION=1.2.60
SUPPORT_LIB_VERSION=28.0.0
KOTLIN_VERSION=1.3.21
BUTTERKNIFE_VERSION=8.8.1
LEAK_CANARY_VERSION=1.5.4
LEAK_CANARY_VERSION=1.6.2
DAGGER_VERSION=2.15

systemProp.http.proxyPort=0
Expand Down
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 Nov 03 11:02:51 CET 2018
#Thu Mar 14 14:54:52 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

0 comments on commit c21cc83

Please sign in to comment.