Skip to content

Commit

Permalink
# fixed test setup
Browse files Browse the repository at this point in the history
# restructured api relevant files
  • Loading branch information
sbra0902 committed Jun 8, 2021
1 parent d4c4217 commit 8a218d9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.schwarz.kokain.api.internal

interface ActivityRefered {

var activityRef : String?

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.schwarz.kokain.api.internal

import com.schwarz.kokain.api.EBean

interface BeanScope {

var scope : EBean.Scope
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ package com.schwarz.kokain.di
import android.app.Activity
import android.app.Application
import android.content.Context
import android.util.Log
import android.view.View
import androidx.activity.ComponentActivity
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import com.schwarz.kokain.api.EBean
import com.schwarz.kokain.di.observer.ActivityRefered
import com.schwarz.kokain.di.scope.BeanScope
import com.schwarz.kokain.api.internal.ActivityRefered
import com.schwarz.kokain.api.internal.BeanScope
import java.lang.ref.WeakReference
import kotlin.reflect.KProperty

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import com.schwarz.kokain.api.EBean
import com.schwarz.kokain.api.KDiFactory
import com.schwarz.kokain.api.internal.BeanScope
import com.schwarz.kokain.di.scope.*
import kotlin.reflect.KClass

Expand Down
5 changes: 4 additions & 1 deletion kokain-processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.4'
testImplementation 'junit:junit:4.12'
testImplementation project(path: ':kokain-core-api', configuration: 'default')
testImplementation project(path: ':kokain-di', configuration: 'default')
testImplementation 'com.github.tschuchortdev:kotlin-compile-testing:1.4.2'
testImplementation 'org.mockito:mockito-core:1.10.19'
kapt "com.google.auto.service:auto-service:1.0-rc6"
Expand All @@ -34,6 +33,10 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}

jacoco {
toolVersion = "0.8.7"
}

jacocoTestReport {
group 'verification'
dependsOn 'test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy

object TypeUtil {

const val KOKAIN_DI_BASE_PACKAGE = "com.schwarz.kokain.di"

const val KOKAIN_API_BASE_PACKAGE = "com.schwarz.kokain.api"

fun string(): TypeName {
Expand Down Expand Up @@ -61,11 +59,11 @@ object TypeUtil {
}

fun activityRefered(): TypeName {
return ClassName("$KOKAIN_DI_BASE_PACKAGE.observer", "ActivityRefered")
return ClassName("$KOKAIN_API_BASE_PACKAGE.internal", "ActivityRefered")
}

fun beanScope(): TypeName {
return ClassName("$KOKAIN_DI_BASE_PACKAGE.scope", "BeanScope")
return ClassName("$KOKAIN_API_BASE_PACKAGE.internal", "BeanScope")
}

fun scope(): TypeName {
Expand Down Expand Up @@ -94,28 +92,6 @@ object TypeUtil {
return if (lastIndexOf >= 0) type.toString().substring(0, lastIndexOf) else type.toString()
}

// fun parseMetaType(type: TypeMirror, list: Boolean, subEntity: String?): TypeName {
//
// val simpleName = if (subEntity != null && subEntity.contains(getSimpleName(type))) subEntity else getSimpleName(type)
//
// var baseType: TypeName? = null
//
// if (type.toString().split(".").size == 1) {
// baseType = type.asTypeName()
// } else {
// try {
// baseType = ClassName(getPackage(type), simpleName)
// } catch (e: IllegalArgumentException) {
// baseType = type.asTypeName()
// }
// }
//
// return if (list) {
// list(baseType!!.javaToKotlinType())
// } else baseType!!.javaToKotlinType()
// }


fun classStar(): ParameterizedTypeName {
return ClassName("kotlin.reflect", "KClass").parameterizedBy(star())
}
Expand Down

0 comments on commit 8a218d9

Please sign in to comment.