From 16b03af8531bd9315fa4529c4d800c4b1a262fb9 Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Wed, 7 Nov 2018 17:56:53 -0500 Subject: [PATCH] feat: add lint configuration --- app/build.gradle | 70 +++++++++---------- .../java/org/dystopia/email/DaoMessage.java | 4 +- .../main/java/org/dystopia/email/Helper.java | 2 +- build.gradle | 5 +- 4 files changed, 39 insertions(+), 42 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d24f2d1c..c722b0f6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,6 +10,7 @@ android { versionName "1.0" archivesBaseName = "SimpleEmail-v$versionName" + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] @@ -17,25 +18,32 @@ android { } } - lintOptions { - disable 'MissingTranslation' - } - buildTypes { - release { - debuggable = false - minifyEnabled = true - useProguard = true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } debug { debuggable = true + minifyEnabled !rootProject.ext.ci + useProguard = true + } + release { + debuggable = false minifyEnabled = true useProguard = true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + shrinkResources true } } + + lintOptions { + xmlReport false + htmlReport true + textReport true + lintConfig file("${rootProject.getRootDir()}/lint.xml") + warningsAsErrors true + abortOnError false + explainIssues true + absolutePaths false + } + packagingOptions { pickFirst 'META-INF/LICENSE.txt' } @@ -52,63 +60,51 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - // https://mvnrepository.com/artifact/androidx.appcompat/appcompat - // https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview - // https://mvnrepository.com/artifact/com.google.android.material/material - // https://mvnrepository.com/artifact/androidx.browser/browser - // https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout - - // https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-runtime - // https://mvnrepository.com/artifact/androidx.room/room-runtime - // https://mvnrepository.com/artifact/androidx.paging/paging-runtime - - // https://developer.android.com/google/play/billing/billing_library_releases_notes - - // https://javaee.github.io/javamail/ - // https://jsoup.org/ - // http://www.freeutils.net/source/jcharset/ - - // https://developer.android.com/topic/libraries/support-library/androidx-rn - // https://developer.android.com/topic/libraries/support-library/refactor - - // https://developer.android.com/topic/libraries/architecture/adding-components.html - // https://developer.android.com/jetpack/docs/release-notes - def androidx_version = "1.0.0" def constraintlayout_version = "1.1.3" def lifecycle_version = "2.0.0" def room_version = "2.0.0" def paging_version = "2.0.0" - def billingclient_version = "1.1" def javamail_version = "1.6.2" def jsoup_version = "1.11.3" def jcharset_version = "2.0" def dnsjava_version = "2.1.8" def openpgp_version = "12.0" + // https://mvnrepository.com/artifact/androidx.appcompat/appcompat implementation "androidx.appcompat:appcompat:$androidx_version" + // https://mvnrepository.com/artifact/androidx.annotation/annotation + implementation "androidx.annotation:annotation:$androidx_version" + // https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview implementation "androidx.recyclerview:recyclerview:$androidx_version" implementation "androidx.recyclerview:recyclerview-selection:$androidx_version" + // https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout implementation "androidx.coordinatorlayout:coordinatorlayout:$androidx_version" implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" + // https://mvnrepository.com/artifact/com.google.android.material/material implementation "com.google.android.material:material:$androidx_version" + // https://mvnrepository.com/artifact/androidx.browser/browser implementation "androidx.browser:browser:$androidx_version" + // https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-runtime implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version" + // https://mvnrepository.com/artifact/androidx.room/room-runtime implementation "androidx.room:room-runtime:$room_version" annotationProcessor "androidx.room:room-compiler:$room_version" + // https://mvnrepository.com/artifact/androidx.paging/paging-runtime implementation "androidx.paging:paging-runtime:$paging_version" - implementation "com.android.billingclient:billing:$billingclient_version" - + // https://javaee.github.io/javamail/ implementation "com.sun.mail:android-mail:$javamail_version" implementation "com.sun.mail:android-activation:$javamail_version" + // https://jsoup.org/ implementation "org.jsoup:jsoup:$jsoup_version" + // http://www.freeutils.net/source/jcharset/ implementation "net.freeutils:jcharset:$jcharset_version" // http://www.xbill.org/dnsjava/ @@ -117,6 +113,6 @@ dependencies { // https://github.com/open-keychain/openpgp-api implementation "org.sufficientlysecure:openpgp-api:$openpgp_version" - // git clone https://android.googlesource.com/platform/frameworks/opt/colorpicker + // https://android.googlesource.com/platform/frameworks/opt/colorpicker implementation project(path: ':colorpicker') } diff --git a/app/src/main/java/org/dystopia/email/DaoMessage.java b/app/src/main/java/org/dystopia/email/DaoMessage.java index ba0b79bf..0eb2a95c 100644 --- a/app/src/main/java/org/dystopia/email/DaoMessage.java +++ b/app/src/main/java/org/dystopia/email/DaoMessage.java @@ -48,7 +48,6 @@ public interface DaoMessage { " AND NOT folder.type = '" + EntityFolder.OUTBOX + "'" + " AND NOT folder.type = '" + EntityFolder.DRAFTS + "' THEN 0 ELSE 1 END) AS unflagged" + ", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" + - ", MAX(CASE WHEN folder.unified THEN message.id ELSE 0 END) AS dummy" + " FROM message" + " JOIN account ON account.id = message.account" + " JOIN folder ON folder.id = message.folder" + @@ -77,7 +76,6 @@ public interface DaoMessage { " AND NOT (folder.id <> :folder AND folder.type = '" + EntityFolder.OUTBOX + "')" + " AND NOT (folder.id <> :folder AND folder.type = '" + EntityFolder.DRAFTS + "') THEN 0 ELSE 1 END) AS unflagged" + ", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" + - ", MAX(CASE WHEN folder.id = :folder THEN message.id ELSE 0 END) AS dummy" + " FROM message" + " JOIN account ON account.id = message.account" + " JOIN folder ON folder.id = message.folder" + @@ -250,4 +248,4 @@ public interface DaoMessage { @Query("DELETE FROM message WHERE ui_found") int deleteFoundMessages(); -} \ No newline at end of file +} diff --git a/app/src/main/java/org/dystopia/email/Helper.java b/app/src/main/java/org/dystopia/email/Helper.java index 18373f18..ff22005e 100644 --- a/app/src/main/java/org/dystopia/email/Helper.java +++ b/app/src/main/java/org/dystopia/email/Helper.java @@ -27,7 +27,6 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.TypedArray; import android.net.Uri; -import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; import android.view.Menu; @@ -60,6 +59,7 @@ import javax.mail.AuthenticationFailedException; import javax.mail.MessagingException; import javax.mail.internet.InternetAddress; +import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.browser.customtabs.CustomTabsIntent; diff --git a/build.gradle b/build.gradle index 74c36422..7e21a6d4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ buildscript { - repositories { google() jcenter() @@ -16,6 +15,10 @@ allprojects { } } +ext { + ci = project.hasProperty("ci") +} + task clean(type: Delete) { delete rootProject.buildDir }