Skip to content

Commit

Permalink
Build.gradle improvements
Browse files Browse the repository at this point in the history
- Use ksp for faster processing of source code
- Migrate code from using generated Glide classes to recommended ones
- Bump AndroidX annotation, Room and Glide versions
- Bump Kotlin to 1.9.10
- Migrate version and lib names to libs.versions.toml
  • Loading branch information
TranceLove committed Mar 24, 2024
1 parent b2e5dea commit c401ccc
Show file tree
Hide file tree
Showing 14 changed files with 348 additions and 234 deletions.
207 changes: 100 additions & 107 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.hiya.jacoco-android'
apply plugin: "com.starter.easylauncher"
apply plugin: 'com.google.devtools.ksp'

android {
namespace "com.amaze.filemanager"
compileSdk 33
compileSdk libs.versions.compileSdk.get().toInteger()
packagingOptions {
resources {
excludes += ['proguard-project.txt', 'project.properties', 'META-INF/LICENSE.txt', 'META-INF/LICENSE', 'META-INF/NOTICE.txt', 'META-INF/NOTICE', 'META-INF/DEPENDENCIES.txt', 'META-INF/DEPENDENCIES']
Expand All @@ -17,8 +18,8 @@ android {

defaultConfig {
applicationId "com.amaze.filemanager"
minSdkVersion 19
targetSdkVersion 33
minSdkVersion libs.versions.minSdk.get().toInteger()
targetSdkVersion libs.versions.targetSdk.get().toInteger()
versionCode 121
versionName "3.10"
multiDexEnabled true
Expand Down Expand Up @@ -49,6 +50,7 @@ android {
buildConfigField "String", "CRYPTO_IV", "\"LxbHiJhhUXcj\""
buildConfigField "String", "FTP_SERVER_KEYSTORE_PASSWORD", "\"vishal007\""
debuggable true //For "debug" banner on icon
enableUnitTestCoverage true
}

release {
Expand All @@ -63,6 +65,7 @@ android {

buildFeatures {
viewBinding true
buildConfig true
}

flavorDimensions = ['static']
Expand Down Expand Up @@ -119,148 +122,135 @@ dependencies {
module("org.bouncycastle:bcpkix-jdk15to18") {
replacedBy("org.bouncycastle:bcpkix-jdk18on")
}

}

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'

implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation "com.google.android.material:material:$androidMaterialVersion"
implementation "androidx.fragment:fragment-ktx:$androidXFragmentVersion"
implementation "androidx.appcompat:appcompat:$androidXAppCompatVersion"
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.room:room-runtime:$roomVersion"
playImplementation "com.android.billingclient:billing:$androidBillingVersion"
kapt "androidx.room:room-compiler:$roomVersion"
// RxJava support for Room
implementation "androidx.room:room-rxjava2:$roomVersion"
kapt "androidx.annotation:annotation:$androidXAnnotationVersion"

implementation "androidx.preference:preference-ktx:$androidXPrefVersion"
implementation libs.systembarTint

implementation libs.androidX.vectordrawable.animated
implementation libs.androidX.legacySupportV13
implementation libs.androidX.material
implementation libs.androidX.fragment
implementation libs.androidX.appcompat
implementation libs.androidX.preference
implementation libs.androidX.core
implementation libs.androidX.palette
implementation libs.androidX.cardview
implementation libs.androidX.constraintLayout
implementation libs.androidx.multidex //Multiple dex files
implementation libs.room.runtime
implementation libs.room.rxjava2

ksp libs.room.compiler
ksp libs.androidX.annotation

//For tests
testImplementation "junit:junit:$junitVersion"//tests the app logic
testImplementation "org.robolectric:robolectric:$robolectricVersion"//tests android interaction
testImplementation "org.robolectric:shadows-httpclient:$robolectricVersion"//tests android interaction
testImplementation "androidx.test:core:$androidXTestVersion"
testImplementation "androidx.test:runner:$androidXTestRunnerVersion"
testImplementation "androidx.test:rules:$androidXTestVersion"
testImplementation "androidx.test.ext:junit:$androidXTestExtVersion"
testImplementation "androidx.fragment:fragment-testing:$androidXFragmentVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-inline:$mockitoInlineVersion"
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
testImplementation "org.apache.sshd:sshd-core:1.7.0"
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
testImplementation "org.jsoup:jsoup:$jsoupVersion"
testImplementation "androidx.room:room-migration:$roomVersion"
testImplementation "io.mockk:mockk:$mockkVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutineTestVersion"
testImplementation "androidx.arch.core:core-testing:$androidXArchCoreTestVersion"
kaptTest "com.google.auto.service:auto-service:1.0-rc4"

androidTestImplementation "junit:junit:$junitVersion"//tests the app logic
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
androidTestImplementation "androidx.test:core:$androidXTestVersion"
androidTestImplementation "androidx.test:runner:$androidXTestVersion"
androidTestImplementation "androidx.test:rules:$androidXTestVersion"
androidTestImplementation "androidx.test.ext:junit:$androidXTestExtVersion"
androidTestImplementation "androidx.test.uiautomator:uiautomator:$uiAutomatorVersion"
androidTestImplementation "androidx.fragment:fragment-testing:$androidXFragmentVersion"
androidTestImplementation "commons-net:commons-net:$commonsNetVersion"
androidTestImplementation "org.awaitility:awaitility:$awaitilityVersion"
testImplementation libs.junit//tests the app logic
testImplementation libs.robolectric//tests android interaction
testImplementation libs.robolectric.shadows.httpclient//tests android interaction
testImplementation libs.androidX.test.core
testImplementation libs.androidX.test.runner
testImplementation libs.androidX.test.rules
testImplementation libs.androidX.test.ext.junit
testImplementation libs.androidX.fragment.testing
testImplementation libs.mockito.core
testImplementation libs.mockito.inline
testImplementation libs.mockito.kotlin
testImplementation libs.apache.sshd
testImplementation libs.awaitility
testImplementation libs.jsoup
testImplementation libs.room.migration
testImplementation libs.mockk
testImplementation libs.kotlin.coroutine.test
testImplementation libs.androidX.core.testing
kspTest libs.auto.service

androidTestImplementation libs.junit //tests the app logic
androidTestImplementation libs.androidX.test.expresso
androidTestImplementation libs.androidX.test.core
androidTestImplementation libs.androidX.test.runner
androidTestImplementation libs.androidX.test.rules
androidTestImplementation libs.androidX.test.ext.junit
androidTestImplementation libs.androidX.test.uiautomator
androidTestImplementation libs.androidX.fragment.testing
androidTestImplementation libs.commons.net
androidTestImplementation libs.awaitility

//Detect memory leaks
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'

implementation "org.apache.commons:commons-compress:$commonsCompressVersion"

playImplementation "com.github.junrar:junrar:$junrarVersion"
debugImplementation libs.leakcanary.android

implementation "com.afollestad.material-dialogs:core:$materialDialogsVersion"
implementation "com.afollestad.material-dialogs:commons:$materialDialogsVersion"
implementation libs.commons.compress

// https://mvnrepository.com/artifact/org.apache.mina/mina-core
implementation group: 'org.apache.mina', name: 'mina-core', version: '2.0.16'
implementation libs.materialdialogs.core
implementation libs.materialdialogs.commons

//implementation files('libs/ftplet-api-1.1.0-SNAPSHOT.jar')
// https://mvnrepository.com/artifact/org.apache.ftpserver/ftplet-api
implementation "org.apache.ftpserver:ftplet-api:$ftpserverVersion"
implementation libs.apache.mina.core
implementation libs.apache.ftpserver.ftplet.api
implementation libs.apache.ftpserver.core

//implementation files('libs/ftpserver-core-1.1.0-SNAPSHOT.jar')
// https://mvnrepository.com/artifact/org.apache.ftpserver/ftpserver-core
implementation "org.apache.ftpserver:ftpserver-core:$ftpserverVersion"
implementation libs.eventbus

implementation 'org.greenrobot:eventbus:3.3.1'
implementation libs.libsu.core
implementation libs.libsu.io

implementation "com.github.topjohnwu.libsu:core:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:io:${libsuVersion}"
playImplementation libs.cloudrail.si.android
playImplementation libs.junrar
playImplementation libs.google.play.billing

playImplementation 'com.cloudrail:cloudrail-si-android:2.22.4'
implementation libs.mpAndroidChart//Nice charts and graphs

implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'//Nice charts and graphs

implementation 'com.github.npgall:concurrent-trees:2.6.1'//Concurrent tries
implementation libs.concurrent.trees//Concurrent tries

//SFTP
implementation "com.hierynomus:sshj:$sshjVersion"

implementation libs.sshj
//smb
implementation "eu.agno3.jcifs:jcifs-ng:$jcifsVersion"

implementation libs.jcifs.ng
//FTP
implementation "commons-net:commons-net:$commonsNetVersion"

implementation libs.commons.net
//OkHttp
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation libs.okhttp

implementation "org.bouncycastle:bcpkix-jdk18on:$bouncyCastleVersion"
implementation "org.bouncycastle:bcprov-jdk18on:$bouncyCastleVersion"
implementation libs.bcpkix.jdk18on
implementation libs.bcprov.jdk18on

//Glide: loads icons seemlessly
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation ("com.github.bumptech.glide:recyclerview-integration:$glideVersion") {
implementation libs.glide
implementation (libs.glide.recyclerView) {
// Excludes the support library because it's already included by Glide.
transitive = false
}
kapt "com.github.bumptech.glide:compiler:$glideVersion"
ksp libs.glide.ksp

implementation "com.leinardi.android:speed-dial:$fabSpeedDialVersion"
implementation libs.speedDial

//Simple library show
implementation('com.mikepenz:aboutlibraries:6.1.1@aar') {
implementation(libs.aboutLibraries) {
transitive = true
}

implementation 'androidx.multidex:multidex:2.0.1'//Multiple dex files
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

//zip4j: support password-protected zips
implementation "net.lingala.zip4j:zip4j:$zip4jVersion"
implementation libs.zip4j

implementation 'org.tukaani:xz:1.9'
implementation libs.xz

implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation libs.rxandroid
// 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.
// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version)
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation libs.rxjava

implementation project(':commons_compress_7z')
implementation project(':file_operations')
implementation project(':portscanner')
implementation "androidx.core:core-ktx:$androidXCoreVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "ch.acra:acra-core:5.7.0"
implementation 'org.slf4j:slf4j-api:2.0.7'
implementation "com.github.tony19:logback-android:$logbackAndroidVersion"
testImplementation 'ch.qos.logback:logback-classic:1.2.11'

implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.github.TeamAmaze:AmazeTrashBin:1.0.10'

implementation libs.kotlin.stdlib.jdk8
implementation libs.acra.core
implementation libs.slf4j.api
implementation libs.logback.android
testImplementation libs.logback.classic

implementation libs.gson
implementation libs.amaze.trashBin
}

kotlin {
Expand Down Expand Up @@ -303,12 +293,15 @@ clean.dependsOn supportOldLangCodes
clean.mustRunAfter supportOldLangCodes

jacoco {
toolVersion = "${jacocoVersion}"
toolVersion = libs.versions.jacoco.get()
}

jacocoAndroidUnitTestReport {
html.enabled true
xml.enabled true
tasks.withType(JacocoReport).configureEach {
reports {
csv.required.set(false)
html.required.set(true)
xml.required.set(true)
}
}

tasks.withType(Test).configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class CryptUtilEspressoTest {
CryptUtil(
AppConfig.getInstance(),
HybridFileParcelable(targetFile.absolutePath).also {
it.size = targetFile.length()
it.setSize(targetFile.length())
},
Environment.getExternalStorageDirectory().absolutePath,
ProgressHandler(),
Expand Down Expand Up @@ -134,7 +134,7 @@ class CryptUtilEspressoTest {
CryptUtil(
AppConfig.getInstance(),
HybridFileParcelable(targetFile.absolutePath).also {
it.size = targetFile.length()
it.setSize(targetFile.length())
},
Environment.getExternalStorageDirectory().absolutePath,
ProgressHandler(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.ArrayList;
import java.util.List;

import com.amaze.filemanager.GlideApp;
import com.amaze.filemanager.R;
import com.amaze.filemanager.adapters.data.CompressedObjectParcelable;
import com.amaze.filemanager.adapters.holders.CompressedItemViewHolder;
Expand All @@ -39,6 +38,7 @@
import com.amaze.filemanager.ui.views.CircleGradientDrawable;
import com.amaze.filemanager.utils.AnimUtils;
import com.amaze.filemanager.utils.Utils;
import com.bumptech.glide.Glide;

import android.app.Activity;
import android.content.Context;
Expand Down Expand Up @@ -240,17 +240,15 @@ public void onBindViewHolder(final CompressedItemViewHolder holder, int position
compressedExplorerFragment.getResources().getDisplayMetrics()));

if (rowItem.type == CompressedObjectParcelable.TYPE_GOBACK) {
GlideApp.with(compressedExplorerFragment)
Glide.with(compressedExplorerFragment)
.load(R.drawable.ic_arrow_left_white_24dp)
.into(holder.genericIcon);
gradientDrawable.setColor(Utils.getColor(context, R.color.goback_item));
holder.txtTitle.setText("..");
holder.txtDesc.setText("");
holder.date.setText(R.string.goback);
} else {
GlideApp.with(compressedExplorerFragment)
.load(rowItem.iconData.image)
.into(holder.genericIcon);
Glide.with(compressedExplorerFragment).load(rowItem.iconData.image).into(holder.genericIcon);

if (compressedExplorerFragment.showLastModified)
holder.date.setText(Utils.getDate(context, rowItem.date));
Expand Down
Loading

0 comments on commit c401ccc

Please sign in to comment.