Repository: thunderbird/thunderbird-android (language: kotlin)

Issue:
Move com.fsck.k9.logging  to core module
The `com.fsck.k9.logging` functionality in the `:legacy:core` module should be moved to `:core:android:logging` and the `net.thunderbird.core.android.logging` package.

Alternatively it could be moved to `:core:android:common` and the `net.thunderbird.core.android.logging` package.

Part of #7852


Discussion hints:
nan

Pull request: Move logging functionality to core.android.logging module
- Fixes #8975


Test command: ./gradlew :legacy:ui:legacy:testDebugUnitTest --tests "com.fsck.k9.ui.settings.general.GeneralSettingsViewModelTest" :core:android:logging:testDebugUnitTest --tests "net.thunderbird.core.android.logging.LogcatLogFileWriterTest"

Fix patch:
diff --git a/core/android/logging/build.gradle.kts b/core/android/logging/build.gradle.kts
new file mode 100644
index 00000000000..86a28e09ff0
--- /dev/null
+++ b/core/android/logging/build.gradle.kts
@@ -0,0 +1,12 @@
+plugins {
+    id(ThunderbirdPlugins.Library.android)
+}
+
+android {
+    namespace = "net.thunderbird.core.android.logging"
+}
+
+dependencies {
+    implementation(libs.timber)
+    implementation(libs.commons.io)
+}
diff --git a/legacy/core/src/main/java/com/fsck/k9/logging/KoinModule.kt b/core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/KoinModule.kt
similarity index 82%
rename from legacy/core/src/main/java/com/fsck/k9/logging/KoinModule.kt
rename to core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/KoinModule.kt
index 4f0cf604802..0892cddd6d1 100644
--- a/legacy/core/src/main/java/com/fsck/k9/logging/KoinModule.kt
+++ b/core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/KoinModule.kt
@@ -1,4 +1,4 @@
-package com.fsck.k9.logging
+package net.thunderbird.core.android.logging
 
 import org.koin.dsl.module
 
diff --git a/legacy/core/src/main/java/com/fsck/k9/logging/LogFileWriter.kt b/core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/LogFileWriter.kt
similarity index 96%
rename from legacy/core/src/main/java/com/fsck/k9/logging/LogFileWriter.kt
rename to core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/LogFileWriter.kt
index 0797c006b71..e541bac9c1d 100644
--- a/legacy/core/src/main/java/com/fsck/k9/logging/LogFileWriter.kt
+++ b/core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/LogFileWriter.kt
@@ -1,4 +1,4 @@
-package com.fsck.k9.logging
+package net.thunderbird.core.android.logging
 
 import android.content.ContentResolver
 import android.net.Uri
diff --git a/legacy/core/src/main/java/com/fsck/k9/logging/ProcessExecutor.kt b/core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/ProcessExecutor.kt
similarity index 87%
rename from legacy/core/src/main/java/com/fsck/k9/logging/ProcessExecutor.kt
rename to core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/ProcessExecutor.kt
index cfa2ff653fc..dc437dd61df 100644
--- a/legacy/core/src/main/java/com/fsck/k9/logging/ProcessExecutor.kt
+++ b/core/android/logging/src/main/kotlin/net/thunderbird/core/android/logging/ProcessExecutor.kt
@@ -1,4 +1,4 @@
-package com.fsck.k9.logging
+package net.thunderbird.core.android.logging
 
 import java.io.InputStream
 
diff --git a/legacy/core/build.gradle.kts b/legacy/core/build.gradle.kts
index ae7a0dde3ff..0fa7c8e82c9 100644
--- a/legacy/core/build.gradle.kts
+++ b/legacy/core/build.gradle.kts
@@ -8,6 +8,7 @@ dependencies {
     api(projects.backend.api)
     api(projects.library.htmlCleaner)
     api(projects.core.android.common)
+    api(projects.core.android.logging)
     api(projects.core.android.network)
     api(projects.core.mail.folder.api)
 
diff --git a/legacy/core/src/main/java/com/fsck/k9/CoreKoinModules.kt b/legacy/core/src/main/java/com/fsck/k9/CoreKoinModules.kt
index 84c58690971..f70ab1cd44b 100644
--- a/legacy/core/src/main/java/com/fsck/k9/CoreKoinModules.kt
+++ b/legacy/core/src/main/java/com/fsck/k9/CoreKoinModules.kt
@@ -6,7 +6,6 @@ import com.fsck.k9.controller.push.controllerPushModule
 import com.fsck.k9.crypto.openPgpModule
 import com.fsck.k9.helper.helperModule
 import com.fsck.k9.job.jobModule
-import com.fsck.k9.logging.loggingModule
 import com.fsck.k9.mailstore.mailStoreModule
 import com.fsck.k9.message.extractors.extractorModule
 import com.fsck.k9.message.html.htmlModule
@@ -14,6 +13,7 @@ import com.fsck.k9.message.quote.quoteModule
 import com.fsck.k9.notification.coreNotificationModule
 import com.fsck.k9.power.powerModule
 import com.fsck.k9.preferences.preferencesModule
+import net.thunderbird.core.android.logging.loggingModule
 import net.thunderbird.core.android.network.coreAndroidNetworkModule
 
 val coreModules = listOf(
diff --git a/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModel.kt b/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModel.kt
index 893d5de601f..20ea2d1756a 100644
--- a/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModel.kt
+++ b/legacy/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModel.kt
@@ -3,12 +3,12 @@ package com.fsck.k9.ui.settings.general
 import android.net.Uri
 import androidx.lifecycle.ViewModel
 import androidx.lifecycle.viewModelScope
-import com.fsck.k9.logging.LogFileWriter
 import kotlinx.coroutines.Job
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.flow.Flow
 import kotlinx.coroutines.flow.MutableStateFlow
 import kotlinx.coroutines.launch
+import net.thunderbird.core.android.logging.LogFileWriter
 import timber.log.Timber
 
 class GeneralSettingsViewModel(private val logFileWriter: LogFileWriter) : ViewModel() {
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 0d10145af31..0b39e2ed3e6 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -219,3 +219,4 @@ check(JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
         https://developer.android.com/build/jdks#jdk-config-in-studio
     """.trimIndent()
 }
+include(":core:android:logging")


Test patch:
diff --git a/legacy/core/src/test/java/com/fsck/k9/logging/LogcatLogFileWriterTest.kt b/core/android/logging/src/test/kotlin/net/thunderbird/core/android/logging/LogcatLogFileWriterTest.kt
similarity index 98%
rename from legacy/core/src/test/java/com/fsck/k9/logging/LogcatLogFileWriterTest.kt
rename to core/android/logging/src/test/kotlin/net/thunderbird/core/android/logging/LogcatLogFileWriterTest.kt
index 9783531f010..7cc43bf5c7f 100644
--- a/legacy/core/src/test/java/com/fsck/k9/logging/LogcatLogFileWriterTest.kt
+++ b/core/android/logging/src/test/kotlin/net/thunderbird/core/android/logging/LogcatLogFileWriterTest.kt
@@ -1,4 +1,4 @@
-package com.fsck.k9.logging
+package net.thunderbird.core.android.logging
 
 import android.content.ContentResolver
 import android.net.Uri
diff --git a/legacy/ui/legacy/src/test/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModelTest.kt b/legacy/ui/legacy/src/test/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModelTest.kt
index ef1875cbe18..3a27a1b2366 100644
--- a/legacy/ui/legacy/src/test/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModelTest.kt
+++ b/legacy/ui/legacy/src/test/java/com/fsck/k9/ui/settings/general/GeneralSettingsViewModelTest.kt
@@ -5,7 +5,6 @@ import app.cash.turbine.test
 import assertk.assertThat
 import assertk.assertions.isEmpty
 import assertk.assertions.isEqualTo
-import com.fsck.k9.logging.LogFileWriter
 import java.io.IOException
 import kotlinx.coroutines.CoroutineName
 import kotlinx.coroutines.Dispatchers
@@ -19,6 +18,7 @@ import kotlinx.coroutines.test.StandardTestDispatcher
 import kotlinx.coroutines.test.resetMain
 import kotlinx.coroutines.test.runTest
 import kotlinx.coroutines.test.setMain
+import net.thunderbird.core.android.logging.LogFileWriter
 import org.junit.After
 import org.junit.Before
 import org.junit.Test