2022-09-09 17:24:18 +02:00
|
|
|
plugins {
|
|
|
|
id 'com.android.application'
|
2023-08-07 13:49:18 +02:00
|
|
|
id 'org.jetbrains.kotlin.android'
|
2022-09-09 17:24:18 +02:00
|
|
|
}
|
2023-08-13 15:57:32 +02:00
|
|
|
def getCommitVersionCode = { ->
|
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine 'git', 'rev-list', 'HEAD', '--count'
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
|
|
|
return Integer.valueOf(stdout.toString().trim())
|
|
|
|
} catch (ignored) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
2018-07-26 17:04:44 +02:00
|
|
|
|
|
|
|
android {
|
2023-08-21 10:09:07 +02:00
|
|
|
compileSdk 33
|
2018-07-26 17:04:44 +02:00
|
|
|
defaultConfig {
|
2023-07-15 13:06:29 +02:00
|
|
|
applicationId "eu.toldi.infinityforlemmy"
|
2022-09-09 17:24:18 +02:00
|
|
|
minSdk 21
|
2023-08-21 10:09:07 +02:00
|
|
|
targetSdk 33
|
2023-08-25 17:34:14 +02:00
|
|
|
versionCode 130
|
|
|
|
versionName "0.1.1"
|
2019-02-21 10:24:23 +01:00
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
2020-06-18 11:57:47 +02:00
|
|
|
javaCompileOptions {
|
|
|
|
annotationProcessorOptions {
|
2023-07-15 13:06:29 +02:00
|
|
|
arguments = [eventBusIndex: 'eu.toldi.infinityforlemmy.EventBusIndex']
|
2020-06-18 11:57:47 +02:00
|
|
|
}
|
|
|
|
}
|
2018-07-26 17:04:44 +02:00
|
|
|
}
|
|
|
|
buildTypes {
|
2023-08-13 15:57:32 +02:00
|
|
|
|
2018-07-26 17:04:44 +02:00
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
2023-08-13 15:57:32 +02:00
|
|
|
|
2023-07-30 08:28:09 +02:00
|
|
|
minifiedRelease {
|
2020-07-09 17:44:49 +02:00
|
|
|
initWith buildTypes.release
|
|
|
|
zipAlignEnabled true
|
|
|
|
minifyEnabled true
|
|
|
|
shrinkResources true
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
2022-09-21 06:57:42 +02:00
|
|
|
debug {
|
|
|
|
applicationIdSuffix '.debug'
|
|
|
|
versionNameSuffix ' (DEBUG)'
|
|
|
|
}
|
2023-08-13 15:57:32 +02:00
|
|
|
|
|
|
|
nightly {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
applicationIdSuffix '.nightly'
|
|
|
|
versionNameSuffix ' (NIGHTLY)'
|
|
|
|
}
|
|
|
|
applicationVariants.all { variant ->
|
|
|
|
variant.resValue "string", "applicationId", variant.applicationId
|
|
|
|
|
|
|
|
|
2023-08-13 21:39:19 +02:00
|
|
|
if (variant.buildType.name == 'nightly') {
|
2023-08-13 15:57:32 +02:00
|
|
|
variant.outputs.all {
|
|
|
|
setVersionCodeOverride(getCommitVersionCode())
|
|
|
|
|
|
|
|
setVersionNameOverride(variant.versionName)
|
2023-08-13 21:39:19 +02:00
|
|
|
outputFileName = "${applicationId}.apk"
|
2023-08-13 15:57:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-26 17:04:44 +02:00
|
|
|
}
|
2023-08-07 13:49:18 +02:00
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main.java.srcDirs += 'src/main/kotlin'
|
|
|
|
}
|
|
|
|
|
2018-12-27 04:29:02 +01:00
|
|
|
compileOptions {
|
2021-09-25 03:28:42 +02:00
|
|
|
sourceCompatibility JavaVersion.VERSION_11
|
|
|
|
targetCompatibility JavaVersion.VERSION_11
|
2018-12-27 04:29:02 +01:00
|
|
|
}
|
2021-02-11 10:15:39 +01:00
|
|
|
|
2022-09-09 17:24:18 +02:00
|
|
|
lint {
|
2021-09-25 03:12:20 +02:00
|
|
|
disable 'MissingTranslation'
|
|
|
|
}
|
|
|
|
|
2021-02-11 10:15:39 +01:00
|
|
|
bundle {
|
|
|
|
language {
|
|
|
|
enableSplit = false
|
|
|
|
}
|
|
|
|
}
|
2022-09-21 06:46:13 +02:00
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
viewBinding true
|
|
|
|
}
|
2023-07-31 22:33:42 +02:00
|
|
|
|
|
|
|
packagingOptions {
|
|
|
|
doNotStrip '**/*.so'
|
|
|
|
}
|
2023-07-15 13:06:29 +02:00
|
|
|
namespace 'eu.toldi.infinityforlemmy'
|
2023-10-20 09:31:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
task rearrangeClass(type: Exec) {
|
|
|
|
commandLine 'python', '../scripts/fixEventBus.py'
|
|
|
|
}
|
|
|
|
|
|
|
|
applicationVariants.all { variant ->
|
|
|
|
if (variant.name == 'release') {
|
|
|
|
task("compileSingleFile${variant.name.capitalize()}", type: JavaCompile, dependsOn: rearrangeClass) {
|
|
|
|
def filePath = project.rootDir.absolutePath + '/app/build/generated/ap_generated_sources/release/out/eu/toldi/infinityforlemmy/'
|
|
|
|
source = files(filePath)
|
|
|
|
includes = ["**/EventBusIndex.java"]
|
|
|
|
classpath = variant.getCompileClasspath() + files(project.rootDir.absolutePath + '/app/build/intermediates/javac/release/classes')
|
|
|
|
destinationDir = file("$buildDir/intermediates/javac/release/classes")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile).all { task ->
|
|
|
|
if (task.name == 'compileReleaseJavaWithJavac') {
|
|
|
|
task.finalizedBy "compileSingleFile${variant.name.capitalize()}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-26 17:04:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-12-23 23:35:41 +01:00
|
|
|
/** AndroidX **/
|
2022-11-08 13:17:26 +01:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.7.0-alpha01'
|
|
|
|
implementation 'androidx.biometric:biometric:1.2.0-alpha05'
|
2021-12-16 12:50:12 +01:00
|
|
|
implementation 'androidx.browser:browser:1.4.0'
|
2019-02-21 10:24:23 +01:00
|
|
|
implementation 'androidx.cardview:cardview:1.0.0'
|
2022-07-13 16:05:19 +02:00
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
2021-10-13 15:00:24 +02:00
|
|
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
2023-08-24 23:10:46 +02:00
|
|
|
|
2022-11-08 13:17:26 +01:00
|
|
|
def lifecycleVersion = "2.5.1"
|
2021-09-25 03:12:20 +02:00
|
|
|
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
|
2020-12-23 23:35:41 +01:00
|
|
|
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycleVersion"
|
2021-09-25 03:12:20 +02:00
|
|
|
implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion"
|
2021-09-05 05:11:01 +02:00
|
|
|
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycleVersion"
|
2021-09-25 03:07:26 +02:00
|
|
|
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion"
|
2022-11-08 13:17:26 +01:00
|
|
|
|
|
|
|
def pagingVersion = '3.2.0-alpha03'
|
2021-09-25 03:07:26 +02:00
|
|
|
implementation "androidx.paging:paging-runtime:$pagingVersion"
|
|
|
|
implementation "androidx.paging:paging-guava:$pagingVersion"
|
2022-07-13 16:05:19 +02:00
|
|
|
implementation 'androidx.preference:preference:1.2.0'
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
2022-09-09 17:25:07 +02:00
|
|
|
def roomVersion = "2.4.3"
|
2020-04-22 18:09:10 +02:00
|
|
|
implementation "androidx.room:room-runtime:$roomVersion"
|
|
|
|
annotationProcessor "androidx.room:room-compiler:$roomVersion"
|
2022-07-13 16:05:19 +02:00
|
|
|
implementation "androidx.room:room-guava:$roomVersion"
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
|
2021-12-15 15:52:31 +01:00
|
|
|
implementation 'androidx.work:work-runtime:2.7.1'
|
2023-02-06 17:46:40 +01:00
|
|
|
implementation 'com.google.android.material:material:1.8.0'
|
2020-04-22 18:09:10 +02:00
|
|
|
|
2020-12-23 23:35:41 +01:00
|
|
|
/** ExoPlayer **/
|
2022-12-10 09:51:43 +01:00
|
|
|
def exoplayerVersion = "2.18.2"
|
2020-12-23 23:35:41 +01:00
|
|
|
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayerVersion"
|
|
|
|
implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayerVersion"
|
|
|
|
implementation "com.google.android.exoplayer:exoplayer-hls:$exoplayerVersion"
|
|
|
|
implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayerVersion"
|
2022-09-06 17:01:45 +02:00
|
|
|
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoplayerVersion"
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
/** Third-party **/
|
|
|
|
|
|
|
|
/**** Backend logic ****/
|
|
|
|
|
2020-12-23 23:36:22 +01:00
|
|
|
// HTTP clients
|
2020-12-23 23:35:41 +01:00
|
|
|
def retrofitVersion = "2.9.0"
|
|
|
|
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
|
|
|
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
2021-09-04 17:41:44 +02:00
|
|
|
implementation "com.squareup.retrofit2:adapter-guava:$retrofitVersion"
|
2023-07-20 15:58:52 +02:00
|
|
|
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
|
2021-05-15 02:52:23 +02:00
|
|
|
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Dependency injection
|
2021-12-16 12:50:12 +01:00
|
|
|
def daggerVersion = '2.40.5'
|
2020-12-23 23:35:41 +01:00
|
|
|
implementation "com.google.dagger:dagger:$daggerVersion"
|
|
|
|
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
|
|
|
|
|
2023-08-22 21:49:12 +02:00
|
|
|
|
2020-12-23 23:35:41 +01:00
|
|
|
// Binding
|
|
|
|
// NOTE: Deprecated in favor of viewbinding
|
|
|
|
def butterknifeVersion = "10.2.3"
|
|
|
|
implementation "com.jakewharton:butterknife:$butterknifeVersion"
|
|
|
|
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"
|
2022-11-08 13:17:26 +01:00
|
|
|
compileOnly 'com.android.databinding:viewbinding:7.3.1'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Events
|
2021-12-13 13:46:22 +01:00
|
|
|
def eventbusVersion = "3.3.1"
|
2020-12-23 23:35:41 +01:00
|
|
|
implementation "org.greenrobot:eventbus:$eventbusVersion"
|
|
|
|
annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion"
|
|
|
|
|
|
|
|
// TransactionTooLargeException avoidance
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation 'com.github.livefront:bridge:v2.0.2'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Bundle-saving without boilerplate
|
|
|
|
// NOTE: Deprecated
|
|
|
|
def stateVersion = "1.4.1"
|
|
|
|
implementation "com.evernote:android-state:$stateVersion"
|
|
|
|
annotationProcessor "com.evernote:android-state-processor:$stateVersion"
|
|
|
|
|
|
|
|
// Object to JSON
|
|
|
|
// NOTE: Replace with Squareup's Moshi?
|
2021-12-16 12:50:12 +01:00
|
|
|
implementation 'com.google.code.gson:gson:2.8.9'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
2021-09-25 03:07:26 +02:00
|
|
|
// Java library for zip files and streams
|
2022-12-10 09:51:43 +01:00
|
|
|
implementation 'net.lingala.zip4j:zip4j:2.11.2'
|
2021-09-25 03:07:26 +02:00
|
|
|
|
|
|
|
// IO functionality
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation 'commons-io:commons-io:2.5'
|
2021-09-25 03:07:26 +02:00
|
|
|
|
|
|
|
// Crash reporting
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation 'com.github.FunkyMuse:Crashy:1.2.0'
|
2021-09-25 03:07:26 +02:00
|
|
|
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
/**** User Interface (frontend) ****/
|
|
|
|
|
|
|
|
//Image loading
|
2021-05-15 02:52:23 +02:00
|
|
|
def glideVersion = "4.12.0"
|
2020-12-23 23:35:41 +01:00
|
|
|
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
|
|
|
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
2023-09-07 13:01:28 +02:00
|
|
|
implementation "com.github.bumptech.glide:okhttp-integration:$glideVersion"
|
2020-12-23 23:36:22 +01:00
|
|
|
implementation 'jp.wasabeef:glide-transformations:4.3.0'
|
2020-04-22 18:09:10 +02:00
|
|
|
implementation 'com.github.santalu:aspect-ratio-imageview:1.0.9'
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.23'
|
|
|
|
def bivVersion = "1.8.1"
|
2023-07-15 13:06:29 +02:00
|
|
|
implementation "com.github.piasy:BigImageViewer:bivVersion"
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation "com.github.piasy:GlideImageLoader:$bivVersion"
|
|
|
|
implementation "com.github.piasy:GlideImageViewFactory:$bivVersion"
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Markdown
|
2021-02-23 17:15:37 +01:00
|
|
|
def markwonVersion = "4.6.2"
|
2020-12-23 23:35:41 +01:00
|
|
|
implementation "io.noties.markwon:core:$markwonVersion"
|
|
|
|
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
|
|
|
|
implementation "io.noties.markwon:linkify:$markwonVersion"
|
|
|
|
implementation "io.noties.markwon:recycler-table:$markwonVersion"
|
|
|
|
implementation "io.noties.markwon:simple-ext:$markwonVersion"
|
2021-11-11 16:41:24 +01:00
|
|
|
implementation "io.noties.markwon:inline-parser:$markwonVersion"
|
2023-08-03 13:50:51 +02:00
|
|
|
implementation "io.noties.markwon:image-glide:$markwonVersion"
|
2020-12-23 23:35:41 +01:00
|
|
|
implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
|
2020-12-31 07:46:19 +01:00
|
|
|
implementation 'me.saket:better-link-movement-method:2.2.0'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Animations
|
2021-12-16 12:50:12 +01:00
|
|
|
implementation 'com.airbnb.android:lottie:4.2.2'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Loading ProgressBar
|
|
|
|
implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
|
|
|
|
|
|
|
|
// Customizable TextView
|
2023-07-26 20:55:20 +02:00
|
|
|
implementation 'com.libRG:customtextview:2.4'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Dismiss gesturing
|
2021-09-25 03:10:15 +02:00
|
|
|
implementation 'app.futured.hauler:hauler:5.0.0'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// Bottom sheet with rounded corners
|
2019-07-26 17:31:48 +02:00
|
|
|
implementation 'com.github.Deishelon:RoundedBottomSheet:1.0.1'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// FlowLayout (auto-spacing)
|
2020-12-23 23:36:22 +01:00
|
|
|
implementation 'com.nex3z:flow-layout:1.3.3'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
|
|
|
// RecyclerView fast scrolling
|
2022-06-01 08:53:30 +02:00
|
|
|
implementation 'me.zhanghai.android.fastscroll:library:1.1.8'
|
2020-12-23 23:35:41 +01:00
|
|
|
|
2021-12-16 12:50:12 +01:00
|
|
|
implementation 'com.otaliastudios:zoomlayout:1.9.0'
|
2021-10-14 13:46:28 +02:00
|
|
|
|
2020-05-05 21:04:19 +02:00
|
|
|
|
2020-12-23 23:35:41 +01:00
|
|
|
/**** Builds and flavors ****/
|
|
|
|
// debugImplementation because LeakCanary should only run in debug builds.
|
2021-09-25 03:07:26 +02:00
|
|
|
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:x.y'
|
2018-07-26 17:04:44 +02:00
|
|
|
}
|
2023-08-13 15:57:32 +02:00
|
|
|
|
2023-10-20 09:31:53 +02:00
|
|
|
// NB: Android Studio can't find the imports; this does not affect the
|
|
|
|
// actual build since Gradle can find them just fine.
|
|
|
|
|
|
|
|
import com.android.tools.profgen.ArtProfileKt
|
|
|
|
import com.android.tools.profgen.ArtProfileSerializer
|
|
|
|
import com.android.tools.profgen.DexFile
|
|
|
|
|
|
|
|
project.afterEvaluate {
|
|
|
|
tasks.each { task ->
|
|
|
|
if (task.name.startsWith("compile") && task.name.endsWith("ReleaseArtProfile")) {
|
|
|
|
task.doLast {
|
|
|
|
outputs.files.each { file ->
|
|
|
|
if (file.name.endsWith(".profm")) {
|
|
|
|
println("Sorting ${file} ...")
|
|
|
|
def version = ArtProfileSerializer.valueOf("METADATA_0_0_2")
|
|
|
|
def profile = ArtProfileKt.ArtProfile(file)
|
|
|
|
def keys = new ArrayList(profile.profileData.keySet())
|
|
|
|
def sortedData = new LinkedHashMap()
|
|
|
|
Collections.sort keys, new DexFile.Companion()
|
|
|
|
keys.each { key -> sortedData[key] = profile.profileData[key] }
|
|
|
|
new FileOutputStream(file).with {
|
|
|
|
write(version.magicBytes$profgen)
|
|
|
|
write(version.versionBytes$profgen)
|
|
|
|
version.write$profgen(it, sortedData, "")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|