Extracted Logger to new module common
This commit is contained in:
parent
d3a9d3ac2a
commit
d50f458ef4
|
@ -0,0 +1,152 @@
|
|||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
id "com.android.library"
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
|
||||
ext.artifactName = "multiplatform-utils"
|
||||
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
compilations.main.kotlinOptions {
|
||||
jvmTarget = "1.6"
|
||||
}
|
||||
}
|
||||
|
||||
targets {
|
||||
// Select iOS target for real device or emulator.
|
||||
final def iOSIsRealDevice = System.getenv('SDK_NAME')?.startsWith("iphoneos")
|
||||
final def iOSTarget = iOSIsRealDevice ? presets.iosArm64 : presets.iosX64
|
||||
|
||||
// iOS target.
|
||||
fromPreset(iOSTarget, 'ios') {
|
||||
binaries {
|
||||
framework {
|
||||
baseName = "fints4k"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation kotlin("stdlib-common")
|
||||
}
|
||||
}
|
||||
|
||||
commonTest {
|
||||
dependencies {
|
||||
implementation kotlin("test-common")
|
||||
implementation kotlin("test-annotations-common")
|
||||
|
||||
implementation "ch.tutteli.atrium:atrium-fluent-en_GB:$atriumVersion"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jvmMain {
|
||||
dependencies {
|
||||
api kotlin("stdlib-jdk7")
|
||||
|
||||
compileOnly "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
}
|
||||
}
|
||||
|
||||
jvmTest {
|
||||
dependencies {
|
||||
implementation kotlin("test-junit")
|
||||
|
||||
implementation "org.junit.jupiter:junit-jupiter:$junit5Version"
|
||||
runtimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5Version"
|
||||
|
||||
implementation "org.assertj:assertj-core:$assertJVersion"
|
||||
implementation "org.mockito:mockito-core:$mockitoVersion"
|
||||
|
||||
implementation "ch.tutteli.atrium:atrium-api-fluent-en_GB-jdk8:$atriumVersion"
|
||||
|
||||
implementation "org.slf4j:slf4j-simple:$slf4jVersion"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
iosMain {
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Task to generate iOS framework for xcode projects.
|
||||
task packForXCode(type: Sync) {
|
||||
|
||||
final File frameworkDir = new File(buildDir, "xcode-frameworks")
|
||||
final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
|
||||
|
||||
final def framework = kotlin.targets.ios.binaries.getFramework("", mode)
|
||||
|
||||
inputs.property "mode", mode
|
||||
dependsOn framework.linkTask
|
||||
|
||||
from { framework.outputFile.parentFile }
|
||||
into frameworkDir
|
||||
|
||||
doLast {
|
||||
new File(frameworkDir, 'gradlew').with {
|
||||
text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
|
||||
setExecutable(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run packForXCode when building.
|
||||
tasks.build.dependsOn packForXCode
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdkVersion
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion androidMinSdkVersion
|
||||
targetSdkVersion androidTargetSdkVersion
|
||||
|
||||
versionName version
|
||||
versionCode appVersionCode
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
pickFirst 'META-INF/ktor-http.kotlin_module'
|
||||
pickFirst 'META-INF/kotlinx-io.kotlin_module'
|
||||
pickFirst 'META-INF/atomicfu.kotlin_module'
|
||||
pickFirst 'META-INF/ktor-utils.kotlin_module'
|
||||
pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
|
||||
pickFirst 'META-INF/ktor-client-core.kotlin_module'
|
||||
pickFirst 'META-INF/DEPENDENCIES'
|
||||
pickFirst 'META-INF/NOTICE'
|
||||
pickFirst 'META-INF/LICENSE'
|
||||
pickFirst 'META-INF/LICENSE.txt'
|
||||
pickFirst 'META-INF/NOTICE.txt'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
|
||||
abstract class CachedLoggerFactory : ILoggerFactory {
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
|
||||
interface ILoggerFactory {
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
|
||||
enum class LogLevel(val priority: Int) {
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
|
||||
open class LogToConsoleLoggerFactory : CachedLoggerFactory() {
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
|
||||
interface Logger {
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
|
||||
abstract class LoggerBase(
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
|
||||
open class Slf4jLogger(protected val slf4jLogger: org.slf4j.Logger) : Logger {
|
|
@ -1,4 +1,4 @@
|
|||
package net.dankito.banking.fints.util.log
|
||||
package net.dankito.utils.multiplatform.log
|
||||
|
||||
import org.slf4j.LoggerFactory
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.dankito.utils.multiplatform">
|
||||
|
||||
</manifest>
|
|
@ -59,6 +59,8 @@ kotlin {
|
|||
implementation kotlin("stdlib-common")
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlinCoroutinesVersion"
|
||||
|
||||
api project(":common")
|
||||
|
||||
implementation "io.ktor:ktor-client-core:$ktorVersion"
|
||||
|
||||
api "com.soywiz.korlibs.klock:klock:$klockVersion"
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.dankito.banking.fints.transactions.IAccountTransactionsParser
|
|||
import net.dankito.banking.fints.transactions.Mt940AccountTransactionsParser
|
||||
import net.dankito.banking.fints.util.IBase64Service
|
||||
import net.dankito.banking.fints.util.PureKotlinBase64Service
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
import net.dankito.banking.fints.webclient.IWebClient
|
||||
import net.dankito.banking.fints.webclient.KtorWebClient
|
||||
import net.dankito.banking.fints.webclient.WebClientResponse
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.dankito.banking.fints.messages.segmente.implementierte.sepa
|
|||
|
||||
import com.soywiz.klock.DateFormat
|
||||
import com.soywiz.klock.DateTime
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.dankito.banking.fints.messages.segmente.id.MessageSegmentId
|
|||
import net.dankito.banking.fints.model.Amount
|
||||
import net.dankito.banking.fints.response.segments.*
|
||||
import net.dankito.banking.fints.util.MessageUtils
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
|
||||
|
||||
open class ResponseParser(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package net.dankito.banking.fints.tan
|
||||
|
||||
import net.dankito.banking.fints.model.HHDVersion
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
|
||||
|
||||
open class FlickerCodeDecoder {
|
||||
|
|
|
@ -2,7 +2,7 @@ package net.dankito.banking.fints.tan
|
|||
|
||||
import io.ktor.utils.io.core.toByteArray
|
||||
import net.dankito.banking.fints.messages.HbciCharset
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
|
||||
|
||||
open class TanImageDecoder {
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.dankito.banking.fints.transactions.mt940.model.AccountStatement
|
|||
import net.dankito.banking.fints.transactions.mt940.model.Balance
|
||||
import net.dankito.banking.fints.transactions.mt940.model.Transaction
|
||||
import net.dankito.banking.fints.transactions.mt940.model.StatementLine
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
|
||||
|
||||
open class Mt940AccountTransactionsParser(
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.dankito.banking.fints.transactions.mt940
|
|||
import com.soywiz.klock.*
|
||||
import net.dankito.banking.fints.model.Amount
|
||||
import net.dankito.banking.fints.transactions.mt940.model.*
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package net.dankito.banking.fints.util
|
||||
|
||||
import net.dankito.banking.fints.messages.Separators
|
||||
import net.dankito.banking.fints.response.ResponseParser
|
||||
import net.dankito.banking.fints.messages.segmente.id.MessageSegmentId
|
||||
|
||||
|
||||
open class MessageUtils {
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.ktor.http.ContentType
|
|||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.cancel
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.utils.multiplatform.log.LoggerFactory
|
||||
|
||||
|
||||
open class KtorWebClient : IWebClient {
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.dankito.banking.fints.model.CustomerData
|
|||
import net.dankito.banking.fints.response.client.AddAccountResponse
|
||||
import net.dankito.banking.fints.response.client.FinTsClientResponse
|
||||
import net.dankito.banking.fints.response.client.GetTransactionsResponse
|
||||
import net.dankito.banking.fints.util.log.LoggerFactory
|
||||
import net.dankito.banking.fints.webclient.IWebClient
|
||||
import kotlin.native.concurrent.TransferMode
|
||||
import kotlin.native.concurrent.Worker
|
||||
|
|
|
@ -6,6 +6,8 @@ enableFeaturePreview('GRADLE_METADATA') // for klock
|
|||
include ':fints4k'
|
||||
include ':fints4k-jvm'
|
||||
|
||||
include ':common'
|
||||
|
||||
|
||||
/* UI */
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ import net.dankito.banking.fints.webclient.KtorWebClient
|
|||
import net.dankito.banking.bankfinder.BankInfo
|
||||
import net.dankito.banking.extensions.toAmount
|
||||
import net.dankito.banking.extensions.toMoney
|
||||
import net.dankito.utils.multiplatform.log.Slf4jLoggerFactory
|
||||
import net.dankito.utils.multiplatform.toDate
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.io.File
|
||||
import java.math.BigDecimal
|
||||
|
|
Loading…
Reference in New Issue