Move Glide annotation processing out of the main module.
This commit is contained in:
parent
c98fd1a452
commit
158505c8a8
11 changed files with 202 additions and 35 deletions
|
@ -1,6 +1,5 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'com.google.protobuf'
|
||||
apply plugin: 'androidx.navigation.safeargs'
|
||||
apply plugin: 'witness'
|
||||
|
@ -449,6 +448,7 @@ dependencies {
|
|||
implementation project(':libsignal-service')
|
||||
implementation project(':paging')
|
||||
implementation project(':core-util')
|
||||
implementation project(':glide-config')
|
||||
implementation project(':video')
|
||||
implementation project(':device-transfer')
|
||||
implementation project(':image-editor')
|
||||
|
@ -475,8 +475,6 @@ dependencies {
|
|||
implementation libs.apache.httpclient.android
|
||||
implementation libs.photoview
|
||||
implementation libs.glide.glide
|
||||
kapt libs.glide.compiler
|
||||
kapt libs.androidx.annotation
|
||||
implementation libs.roundedimageview
|
||||
implementation libs.materialish.progress
|
||||
implementation libs.greenrobot.eventbus
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.signal.core.util.logging.AndroidLogger;
|
|||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.core.util.tracing.Tracer;
|
||||
import org.signal.glide.SignalGlideCodecs;
|
||||
import org.thoughtcrime.securesms.mms.SignalGlideModule;
|
||||
import org.signal.ringrtc.CallManager;
|
||||
import org.thoughtcrime.securesms.avatar.AvatarPickerStorage;
|
||||
import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider;
|
||||
|
@ -62,6 +63,7 @@ import org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger;
|
|||
import org.thoughtcrime.securesms.logging.PersistentLogger;
|
||||
import org.thoughtcrime.securesms.messageprocessingalarm.MessageProcessReceiver;
|
||||
import org.thoughtcrime.securesms.migrations.ApplicationMigrations;
|
||||
import org.thoughtcrime.securesms.mms.SignalGlideComponents;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
import org.thoughtcrime.securesms.ratelimit.RateLimitUtil;
|
||||
|
@ -79,7 +81,6 @@ import org.thoughtcrime.securesms.util.AppForegroundObserver;
|
|||
import org.thoughtcrime.securesms.util.AppStartup;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.ProfileUtil;
|
||||
import org.thoughtcrime.securesms.util.SignalLocalMetrics;
|
||||
import org.thoughtcrime.securesms.util.SignalUncaughtExceptionHandler;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
|
@ -168,6 +169,7 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
|
|||
})
|
||||
.addBlocking("blob-provider", this::initializeBlobProvider)
|
||||
.addBlocking("feature-flags", FeatureFlags::init)
|
||||
.addBlocking("glide", () -> SignalGlideModule.setRegisterGlideComponents(new SignalGlideComponents()))
|
||||
.addNonBlocking(this::cleanAvatarStorage)
|
||||
.addNonBlocking(this::initializeRevealableMessageManager)
|
||||
.addNonBlocking(this::initializePendingRetryReceiptManager)
|
||||
|
|
|
@ -3,16 +3,11 @@ package org.thoughtcrime.securesms.mms;
|
|||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.GlideBuilder;
|
||||
import com.bumptech.glide.Registry;
|
||||
import com.bumptech.glide.annotation.GlideModule;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCacheAdapter;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.load.model.UnitModelLoader;
|
||||
import com.bumptech.glide.load.resource.bitmap.Downsampler;
|
||||
|
@ -20,7 +15,6 @@ import com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder;
|
|||
import com.bumptech.glide.load.resource.gif.ByteBufferGifDecoder;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.load.resource.gif.StreamGifDecoder;
|
||||
import com.bumptech.glide.module.AppGlideModule;
|
||||
|
||||
import org.signal.glide.apng.decode.APNGDecoder;
|
||||
import org.thoughtcrime.securesms.badges.models.Badge;
|
||||
|
@ -53,18 +47,11 @@ import java.io.File;
|
|||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@GlideModule
|
||||
public class SignalGlideModule extends AppGlideModule {
|
||||
|
||||
@Override
|
||||
public boolean isManifestParsingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyOptions(Context context, GlideBuilder builder) {
|
||||
builder.setLogLevel(Log.ERROR);
|
||||
}
|
||||
/**
|
||||
* The core logic for {@link SignalGlideModule}. This is a separate class because it uses
|
||||
* dependencies defined in the main Gradle module.
|
||||
*/
|
||||
public class SignalGlideComponents implements RegisterGlideComponents {
|
||||
|
||||
@Override
|
||||
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
|
||||
|
@ -102,11 +89,4 @@ public class SignalGlideModule extends AppGlideModule {
|
|||
registry.append(Badge.class, InputStream.class, BadgeLoader.createFactory());
|
||||
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
|
||||
}
|
||||
|
||||
public static class NoopDiskCacheFactory implements DiskCache.Factory {
|
||||
@Override
|
||||
public DiskCache build() {
|
||||
return new DiskCacheAdapter();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ plugins {
|
|||
id 'com.android.library'
|
||||
id 'witness'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-kapt'
|
||||
}
|
||||
|
||||
apply from: 'witness-verifications.gradle'
|
||||
|
@ -50,6 +49,4 @@ dependencies {
|
|||
api libs.google.play.services.wallet
|
||||
api libs.square.okhttp3
|
||||
api libs.rxjava3.rxjava
|
||||
|
||||
kapt libs.androidx.annotation
|
||||
}
|
||||
|
|
1
glide-config/.gitignore
vendored
Normal file
1
glide-config/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
44
glide-config/build.gradle
Normal file
44
glide-config/build.gradle
Normal file
|
@ -0,0 +1,44 @@
|
|||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'witness'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-kapt'
|
||||
}
|
||||
apply from: 'witness-verifications.gradle'
|
||||
|
||||
android {
|
||||
buildToolsVersion BUILD_TOOL_VERSION
|
||||
compileSdkVersion COMPILE_SDK
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion MINIMUM_SDK
|
||||
targetSdkVersion TARGET_SDK
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled true
|
||||
sourceCompatibility JAVA_VERSION
|
||||
targetCompatibility JAVA_VERSION
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencyVerification {
|
||||
configuration = '(debug|release)RuntimeClasspath'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
lintChecks project(':lintchecks')
|
||||
|
||||
coreLibraryDesugaring libs.android.tools.desugar
|
||||
|
||||
implementation libs.androidx.core.ktx
|
||||
implementation libs.androidx.annotation
|
||||
implementation libs.androidx.appcompat
|
||||
|
||||
implementation libs.glide.glide
|
||||
kapt libs.glide.compiler
|
||||
}
|
2
glide-config/src/main/AndroidManifest.xml
Normal file
2
glide-config/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="org.signal.glide" />
|
|
@ -0,0 +1,40 @@
|
|||
package org.thoughtcrime.securesms.mms
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.GlideBuilder
|
||||
import com.bumptech.glide.Registry
|
||||
import com.bumptech.glide.annotation.GlideModule
|
||||
import com.bumptech.glide.module.AppGlideModule
|
||||
|
||||
/**
|
||||
* A [GlideModule] to configure Glide for the app. This class is discovered by Glide's annotation
|
||||
* processor, and delegates its logic to a [RegisterGlideComponents]. It exists outside of the main
|
||||
* Gradle module to reduce the scope of classes that KAPT needs to look at.
|
||||
*/
|
||||
@GlideModule
|
||||
class SignalGlideModule : AppGlideModule() {
|
||||
|
||||
override fun isManifestParsingEnabled(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
|
||||
registerGlideComponents.registerComponents(context, glide, registry)
|
||||
}
|
||||
|
||||
override fun applyOptions(context: Context, builder: GlideBuilder) {
|
||||
builder.setLogLevel(Log.ERROR)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
lateinit var registerGlideComponents: RegisterGlideComponents
|
||||
}
|
||||
}
|
||||
|
||||
interface RegisterGlideComponents {
|
||||
|
||||
fun registerComponents(context: Context, glide: Glide, registry: Registry)
|
||||
}
|
105
glide-config/witness-verifications.gradle
Normal file
105
glide-config/witness-verifications.gradle
Normal file
|
@ -0,0 +1,105 @@
|
|||
// Auto-generated, use ./gradlew calculateChecksums to regenerate
|
||||
|
||||
dependencyVerification {
|
||||
verify = [
|
||||
|
||||
['androidx.activity:activity:1.0.0',
|
||||
'd1bc9842455c2e534415d88c44df4d52413b478db9093a1ba36324f705f44c3d'],
|
||||
|
||||
['androidx.annotation:annotation:1.2.0',
|
||||
'9029262bddce116e6d02be499e4afdba21f24c239087b76b3b57d7e98b490a36'],
|
||||
|
||||
['androidx.appcompat:appcompat-resources:1.2.0',
|
||||
'c470297c03ff3de1c3d15dacf0be0cae63abc10b52f021dd07ae28daa3100fe5'],
|
||||
|
||||
['androidx.appcompat:appcompat:1.2.0',
|
||||
'3d2131a55a61a777322e2126e0018011efa6339e53b44153eb651b16020cca70'],
|
||||
|
||||
['androidx.arch.core:core-common:2.1.0',
|
||||
'fe1237bf029d063e7f29fe39aeaf73ef74c8b0a3658486fc29d3c54326653889'],
|
||||
|
||||
['androidx.arch.core:core-runtime:2.0.0',
|
||||
'87e65fc767c712b437649c7cee2431ebb4bed6daef82e501d4125b3ed3f65f8e'],
|
||||
|
||||
['androidx.collection:collection:1.1.0',
|
||||
'632a0e5407461de774409352940e292a291037724207a787820c77daf7d33b72'],
|
||||
|
||||
['androidx.core:core-ktx:1.5.0',
|
||||
'5964cfe7a4882da2a00fb6ca3d3a072d04139208186f7bc4b3cb66022764fc42'],
|
||||
|
||||
['androidx.core:core:1.5.0',
|
||||
'2b279712795689069cfb63e48b3ab63c32a5649bdda44c482eb8f81ca1a72161'],
|
||||
|
||||
['androidx.cursoradapter:cursoradapter:1.0.0',
|
||||
'a81c8fe78815fa47df5b749deb52727ad11f9397da58b16017f4eb2c11e28564'],
|
||||
|
||||
['androidx.customview:customview:1.0.0',
|
||||
'20e5b8f6526a34595a604f56718da81167c0b40a7a94a57daa355663f2594df2'],
|
||||
|
||||
['androidx.drawerlayout:drawerlayout:1.0.0',
|
||||
'9402442cdc5a43cf62fb14f8cf98c63342d4d9d9b805c8033c6cf7e802749ac1'],
|
||||
|
||||
['androidx.exifinterface:exifinterface:1.0.0',
|
||||
'ee48be10aab8f54efff4c14b77d11e10b9eeee4379d5ef6bf297a2923c55cc11'],
|
||||
|
||||
['androidx.fragment:fragment:1.1.0',
|
||||
'a14c8b8f2153f128e800fbd266a6beab1c283982a29ec570d2cc05d307d81496'],
|
||||
|
||||
['androidx.interpolator:interpolator:1.0.0',
|
||||
'33193135a64fe21fa2c35eec6688f1a76e512606c0fc83dc1b689e37add7732a'],
|
||||
|
||||
['androidx.lifecycle:lifecycle-common:2.1.0',
|
||||
'76db6be533bd730fb361c2feb12a2c26d9952824746847da82601ef81f082643'],
|
||||
|
||||
['androidx.lifecycle:lifecycle-livedata-core:2.0.0',
|
||||
'fde334ec7e22744c0f5bfe7caf1a84c9d717327044400577bdf9bd921ec4f7bc'],
|
||||
|
||||
['androidx.lifecycle:lifecycle-livedata:2.0.0',
|
||||
'c82609ced8c498f0a701a30fb6771bb7480860daee84d82e0a81ee86edf7ba39'],
|
||||
|
||||
['androidx.lifecycle:lifecycle-runtime:2.1.0',
|
||||
'e5173897b965e870651e83d9d5af1742d3f532d58863223a390ce3a194c8312b'],
|
||||
|
||||
['androidx.lifecycle:lifecycle-viewmodel:2.1.0',
|
||||
'ba55fb7ac1b2828d5327cda8acf7085d990b2b4c43ef336caa67686249b8523d'],
|
||||
|
||||
['androidx.loader:loader:1.0.0',
|
||||
'11f735cb3b55c458d470bed9e25254375b518b4b1bad6926783a7026db0f5025'],
|
||||
|
||||
['androidx.savedstate:savedstate:1.0.0',
|
||||
'2510a5619c37579c9ce1a04574faaf323cd0ffe2fc4e20fa8f8f01e5bb402e83'],
|
||||
|
||||
['androidx.vectordrawable:vectordrawable-animated:1.1.0',
|
||||
'76da2c502371d9c38054df5e2b248d00da87809ed058f3363eae87ce5e2403f8'],
|
||||
|
||||
['androidx.vectordrawable:vectordrawable:1.1.0',
|
||||
'46fd633ac01b49b7fcabc263bf098c5a8b9e9a69774d234edcca04fb02df8e26'],
|
||||
|
||||
['androidx.versionedparcelable:versionedparcelable:1.1.1',
|
||||
'57e8d93260d18d5b9007c9eed3c64ad159de90c8609ebfc74a347cbd514535a4'],
|
||||
|
||||
['androidx.viewpager:viewpager:1.0.0',
|
||||
'147af4e14a1984010d8f155e5e19d781f03c1d70dfed02a8e0d18428b8fc8682'],
|
||||
|
||||
['com.github.bumptech.glide:annotations:4.11.0',
|
||||
'd219d238006d824962176229d4708abcdddcfe342c6a18a5d0fa48d6f0479b3e'],
|
||||
|
||||
['com.github.bumptech.glide:disklrucache:4.11.0',
|
||||
'd06775a5171b777aa3db031eb0dd4a1dbe3f00dda35b5574dfd953f6b0d5ef18'],
|
||||
|
||||
['com.github.bumptech.glide:gifdecoder:4.11.0',
|
||||
'197a1cd5b76855aa02b230c13974e293229b901dc2b96fab4315201e78baa804'],
|
||||
|
||||
['com.github.bumptech.glide:glide:4.11.0',
|
||||
'5c294e6a5f0f812cef876b8412954c1822da184af38e082a5b766e3c4f4fcd95'],
|
||||
|
||||
['org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32',
|
||||
'e1ff6f55ee9e7591dcc633f7757bac25a7edb1cc7f738b37ec652f10f66a4145'],
|
||||
|
||||
['org.jetbrains.kotlin:kotlin-stdlib:1.4.32',
|
||||
'13e9fd3e69dc7230ce0fc873a92a4e5d521d179bcf1bef75a6705baac3bfecba'],
|
||||
|
||||
['org.jetbrains:annotations:13.0',
|
||||
'ace2a10dc8e2d5fd34925ecac03e4988b2c0f851650c94b8cef49ba1bd111478'],
|
||||
]
|
||||
}
|
|
@ -2,7 +2,6 @@ plugins {
|
|||
id 'com.android.library'
|
||||
id 'witness'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-kapt'
|
||||
}
|
||||
|
||||
apply from: 'witness-verifications.gradle'
|
||||
|
@ -42,6 +41,4 @@ dependencies {
|
|||
implementation libs.androidx.core.ktx
|
||||
implementation libs.androidx.annotation
|
||||
implementation libs.androidx.appcompat
|
||||
|
||||
kapt libs.androidx.annotation
|
||||
}
|
|
@ -6,6 +6,7 @@ include ':lintchecks'
|
|||
include ':paging'
|
||||
include ':paging-app'
|
||||
include ':core-util'
|
||||
include ':glide-config'
|
||||
include ':video'
|
||||
include ':device-transfer'
|
||||
include ':device-transfer-app'
|
||||
|
|
Loading…
Add table
Reference in a new issue