Merge pull request #6305 from thundernest/backend_modules_jvm

Convert :backend:* to JVM modules
This commit is contained in:
cketti 2022-09-20 12:38:35 +02:00 committed by GitHub
commit fbe8eca814
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 78 additions and 271 deletions

View file

@ -36,7 +36,6 @@ import com.fsck.k9.K9;
import com.fsck.k9.Preferences;
import com.fsck.k9.backend.BackendManager;
import com.fsck.k9.backend.api.Backend;
import com.fsck.k9.backend.api.BuildConfig;
import com.fsck.k9.backend.api.SyncConfig;
import com.fsck.k9.backend.api.SyncListener;
import com.fsck.k9.controller.ControllerExtension.ControllerInternals;
@ -51,6 +50,7 @@ import com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy;
import com.fsck.k9.controller.MessagingControllerCommands.PendingReplace;
import com.fsck.k9.controller.MessagingControllerCommands.PendingSetFlag;
import com.fsck.k9.controller.ProgressBodyFactory.ProgressListener;
import com.fsck.k9.core.BuildConfig;
import com.fsck.k9.helper.MutableBoolean;
import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.AuthenticationFailedException;

View file

@ -1,29 +1,12 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
dependencies {
api project(":mail:common")
}
android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.fsck.k9.backend.api" />

View file

@ -1,16 +1,17 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.lint'
if (rootProject.testCoverage) {
apply plugin: 'jacoco'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
dependencies {
api project(":backend:api")
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}"
implementation "com.jakewharton.timber:timber:${versions.timber}"
implementation "com.squareup.moshi:moshi:${versions.moshi}"
kapt "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}"
@ -19,32 +20,3 @@ dependencies {
testImplementation "org.mockito:mockito-core:${versions.mockito}"
testImplementation "com.google.truth:truth:${versions.truth}"
}
android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
}
buildTypes {
debug {
testCoverageEnabled rootProject.testCoverage
}
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="app.k9mail.backend.demo" />

View file

@ -1,8 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
if (rootProject.testCoverage) {
apply plugin: 'jacoco'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
dependencies {
@ -11,7 +13,6 @@ dependencies {
api project(":mail:protocols:smtp")
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}"
implementation "com.jakewharton.timber:timber:${versions.timber}"
testImplementation project(":mail:testing")
testImplementation project(":backend:testing")
@ -21,32 +22,3 @@ dependencies {
testImplementation "com.google.truth:truth:${versions.truth}"
testImplementation "org.apache.james:apache-mime4j-dom:${versions.mime4j}"
}
android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
}
buildTypes {
debug {
testCoverageEnabled rootProject.testCoverage
}
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.fsck.k9.backend.imap" />

View file

@ -1,8 +1,8 @@
package com.fsck.k9.backend.imap
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.store.imap.ImapStore
import com.fsck.k9.mail.store.imap.OpenMode
import timber.log.Timber
internal class CommandExpunge(private val imapStore: ImapStore) {

View file

@ -1,10 +1,10 @@
package com.fsck.k9.backend.imap
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.MessagingException
import com.fsck.k9.mail.store.imap.ImapFolder
import com.fsck.k9.mail.store.imap.ImapStore
import com.fsck.k9.mail.store.imap.OpenMode
import timber.log.Timber
internal class CommandMoveOrCopyMessages(private val imapStore: ImapStore) {

View file

@ -2,6 +2,7 @@ package com.fsck.k9.backend.imap
import com.fsck.k9.backend.api.BackendPusher
import com.fsck.k9.backend.api.BackendPusherCallback
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.AuthenticationFailedException
import com.fsck.k9.mail.MessagingException
import com.fsck.k9.mail.power.PowerManager
@ -14,9 +15,7 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import timber.log.Timber
private const val IO_ERROR_TIMEOUT = 5 * 60 * 1000L
private const val UNEXPECTED_ERROR_TIMEOUT = 60 * 60 * 1000L

View file

@ -1,5 +1,6 @@
package com.fsck.k9.backend.imap
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.power.PowerManager
import com.fsck.k9.mail.store.imap.IdleRefreshManager
import com.fsck.k9.mail.store.imap.IdleRefreshTimeoutProvider
@ -7,7 +8,6 @@ import com.fsck.k9.mail.store.imap.IdleResult
import com.fsck.k9.mail.store.imap.ImapFolderIdler
import com.fsck.k9.mail.store.imap.ImapStore
import kotlin.concurrent.thread
import timber.log.Timber
/**
* Listens for changes to an IMAP folder in a dedicated thread.

View file

@ -7,6 +7,7 @@ import com.fsck.k9.backend.api.SyncConfig
import com.fsck.k9.backend.api.SyncConfig.ExpungePolicy
import com.fsck.k9.backend.api.SyncListener
import com.fsck.k9.helper.ExceptionHelper
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.AuthenticationFailedException
import com.fsck.k9.mail.BodyFactory
import com.fsck.k9.mail.DefaultBodyFactory
@ -23,7 +24,6 @@ import java.util.Collections
import java.util.Date
import java.util.concurrent.atomic.AtomicInteger
import kotlin.math.max
import timber.log.Timber
internal class ImapSync(
private val accountName: String,

View file

@ -1,9 +1,11 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.lint'
if (rootProject.testCoverage) {
apply plugin: 'jacoco'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
dependencies {
@ -11,7 +13,6 @@ dependencies {
api "com.squareup.okhttp3:okhttp:${versions.okhttp}"
implementation "rs.ltt.jmap:jmap-client:0.3.1"
implementation "com.jakewharton.timber:timber:${versions.timber}"
implementation "com.squareup.moshi:moshi:${versions.moshi}"
kapt "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}"
@ -20,32 +21,3 @@ dependencies {
testImplementation "org.mockito:mockito-core:${versions.mockito}"
testImplementation("com.squareup.okhttp3:mockwebserver:${versions.okhttp}")
}
android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
}
buildTypes {
debug {
testCoverageEnabled rootProject.testCoverage
}
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.fsck.k9.backend.jmap" />

View file

@ -1,5 +1,6 @@
package com.fsck.k9.backend.jmap
import com.fsck.k9.logging.Timber
import rs.ltt.jmap.client.JmapClient
import rs.ltt.jmap.common.Request.Invocation.ResultReference
import rs.ltt.jmap.common.entity.filter.EmailFilterCondition
@ -7,7 +8,6 @@ import rs.ltt.jmap.common.method.call.email.QueryEmailMethodCall
import rs.ltt.jmap.common.method.call.email.SetEmailMethodCall
import rs.ltt.jmap.common.method.response.email.QueryEmailMethodResponse
import rs.ltt.jmap.common.method.response.email.SetEmailMethodResponse
import timber.log.Timber
class CommandDelete(
private val jmapClient: JmapClient,

View file

@ -1,10 +1,10 @@
package com.fsck.k9.backend.jmap
import com.fsck.k9.logging.Timber
import rs.ltt.jmap.client.JmapClient
import rs.ltt.jmap.common.method.call.email.SetEmailMethodCall
import rs.ltt.jmap.common.method.response.email.SetEmailMethodResponse
import rs.ltt.jmap.common.util.Patches
import timber.log.Timber
class CommandMove(
private val jmapClient: JmapClient,

View file

@ -1,5 +1,6 @@
package com.fsck.k9.backend.jmap
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.Flag
import rs.ltt.jmap.client.JmapClient
import rs.ltt.jmap.common.entity.filter.EmailFilterCondition
@ -8,7 +9,6 @@ import rs.ltt.jmap.common.method.call.email.SetEmailMethodCall
import rs.ltt.jmap.common.method.response.email.QueryEmailMethodResponse
import rs.ltt.jmap.common.method.response.email.SetEmailMethodResponse
import rs.ltt.jmap.common.util.Patches
import timber.log.Timber
class CommandSetFlag(
private val jmapClient: JmapClient,

View file

@ -4,6 +4,7 @@ import com.fsck.k9.backend.api.BackendFolder
import com.fsck.k9.backend.api.BackendStorage
import com.fsck.k9.backend.api.SyncConfig
import com.fsck.k9.backend.api.SyncListener
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.AuthenticationFailedException
import com.fsck.k9.mail.Flag
import com.fsck.k9.mail.MessageDownloadState
@ -26,7 +27,6 @@ import rs.ltt.jmap.common.method.call.email.QueryEmailMethodCall
import rs.ltt.jmap.common.method.response.email.GetEmailMethodResponse
import rs.ltt.jmap.common.method.response.email.QueryChangesEmailMethodResponse
import rs.ltt.jmap.common.method.response.email.QueryEmailMethodResponse
import timber.log.Timber
class CommandSync(
private val backendStorage: BackendStorage,

View file

@ -1,5 +1,6 @@
package com.fsck.k9.backend.jmap
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.Message
import com.fsck.k9.mail.MessagingException
import com.squareup.moshi.Moshi
@ -14,7 +15,6 @@ import rs.ltt.jmap.client.http.HttpAuthentication
import rs.ltt.jmap.common.entity.EmailImport
import rs.ltt.jmap.common.method.call.email.ImportEmailMethodCall
import rs.ltt.jmap.common.method.response.email.ImportEmailMethodResponse
import timber.log.Timber
class CommandUpload(
private val jmapClient: JmapClient,

View file

@ -1,11 +1,11 @@
package com.fsck.k9.backend.jmap
import com.fsck.k9.logging.Timber
import java.net.UnknownHostException
import rs.ltt.jmap.client.JmapClient
import rs.ltt.jmap.client.api.EndpointNotFoundException
import rs.ltt.jmap.client.api.UnauthorizedException
import rs.ltt.jmap.common.entity.capability.MailAccountCapability
import timber.log.Timber
class JmapAccountDiscovery {
fun discover(emailAddress: String, password: String): JmapDiscoveryResult {

View file

@ -1,8 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
if (rootProject.testCoverage) {
apply plugin: 'jacoco'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
dependencies {
@ -10,38 +12,7 @@ dependencies {
api project(":mail:protocols:pop3")
api project(":mail:protocols:smtp")
implementation "com.jakewharton.timber:timber:${versions.timber}"
testImplementation project(":mail:testing")
testImplementation "junit:junit:${versions.junit}"
testImplementation "org.mockito:mockito-core:${versions.mockito}"
}
android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
}
buildTypes {
debug {
testCoverageEnabled rootProject.testCoverage
}
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.fsck.k9.backend.pop3" />

View file

@ -7,6 +7,7 @@ import com.fsck.k9.backend.api.BackendStorage;
import com.fsck.k9.backend.api.SyncConfig;
import com.fsck.k9.backend.api.SyncListener;
import com.fsck.k9.helper.ExceptionHelper;
import com.fsck.k9.logging.Timber;
import com.fsck.k9.mail.AuthenticationFailedException;
import com.fsck.k9.mail.FetchProfile;
import com.fsck.k9.mail.Flag;
@ -26,8 +27,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import timber.log.Timber;
class Pop3Sync {
private static final String EXTRA_LATEST_OLD_MESSAGE_SEEN_TIME = "latestOldMessageSeenTime";

View file

@ -1,31 +1,15 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
dependencies {
implementation project(":backend:api")
implementation "com.squareup.okio:okio:${versions.okio}"
implementation "junit:junit:${versions.junit}"
}
android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="app.k9mail.backend.testing" />

View file

@ -1,49 +1,17 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
if (rootProject.testCoverage) {
apply plugin: 'jacoco'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
dependencies {
api project(":backend:api")
api project(":mail:protocols:webdav")
implementation "com.jakewharton.timber:timber:${versions.timber}"
testImplementation project(":mail:testing")
testImplementation "junit:junit:${versions.junit}"
testImplementation "org.mockito:mockito-core:${versions.mockito}"
}
android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
}
// for using Apache HTTP Client
useLibrary 'org.apache.http.legacy'
buildTypes {
debug {
testCoverageEnabled rootProject.testCoverage
}
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -6,12 +6,12 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fsck.k9.logging.Timber;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.store.webdav.WebDavFolder;
import com.fsck.k9.mail.store.webdav.WebDavMessage;
import com.fsck.k9.mail.store.webdav.WebDavStore;
import org.jetbrains.annotations.NotNull;
import timber.log.Timber;
class CommandMoveOrCopyMessages {

View file

@ -6,6 +6,7 @@ import com.fsck.k9.backend.api.BackendPusherCallback
import com.fsck.k9.backend.api.BackendStorage
import com.fsck.k9.backend.api.SyncConfig
import com.fsck.k9.backend.api.SyncListener
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.BodyFactory
import com.fsck.k9.mail.Flag
import com.fsck.k9.mail.Message
@ -13,7 +14,6 @@ import com.fsck.k9.mail.MessagingException
import com.fsck.k9.mail.Part
import com.fsck.k9.mail.store.webdav.WebDavStore
import com.fsck.k9.mail.transport.WebDavTransport
import timber.log.Timber
class WebDavBackend(
accountName: String,

View file

@ -1,22 +1,6 @@
package com.fsck.k9.backend.webdav;
import com.fsck.k9.backend.api.BackendFolder;
import com.fsck.k9.backend.api.BackendFolder.MoreMessages;
import com.fsck.k9.backend.api.BackendStorage;
import com.fsck.k9.backend.api.SyncConfig;
import com.fsck.k9.backend.api.SyncListener;
import com.fsck.k9.helper.ExceptionHelper;
import com.fsck.k9.mail.AuthenticationFailedException;
import com.fsck.k9.mail.FetchProfile;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.MessageDownloadState;
import com.fsck.k9.mail.MessageRetrievalListener;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.store.webdav.WebDavFolder;
import com.fsck.k9.mail.store.webdav.WebDavMessage;
import com.fsck.k9.mail.store.webdav.WebDavStore;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@ -27,7 +11,22 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import timber.log.Timber;
import com.fsck.k9.backend.api.BackendFolder;
import com.fsck.k9.backend.api.BackendFolder.MoreMessages;
import com.fsck.k9.backend.api.BackendStorage;
import com.fsck.k9.backend.api.SyncConfig;
import com.fsck.k9.backend.api.SyncListener;
import com.fsck.k9.helper.ExceptionHelper;
import com.fsck.k9.logging.Timber;
import com.fsck.k9.mail.AuthenticationFailedException;
import com.fsck.k9.mail.FetchProfile;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.MessageDownloadState;
import com.fsck.k9.mail.MessageRetrievalListener;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.store.webdav.WebDavFolder;
import com.fsck.k9.mail.store.webdav.WebDavMessage;
import com.fsck.k9.mail.store.webdav.WebDavStore;
class WebDavSync {