done migration
This commit is contained in:
parent
4478193d8a
commit
57ebed903f
|
@ -3,6 +3,7 @@ org.gradle.parallel=true
|
||||||
kotlin.js.generate.externals=true
|
kotlin.js.generate.externals=true
|
||||||
kotlin.incremental=true
|
kotlin.incremental=true
|
||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
#kotlin.experimental.tryK2=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
org.gradle.jvmargs=-Xmx2g
|
org.gradle.jvmargs=-Xmx2g
|
||||||
|
|
|
@ -159,9 +159,7 @@ class Processor(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generateSingle) {
|
if (generateSingle) {
|
||||||
fun FunSpec.Builder.configure(
|
fun FunSpec.Builder.configure() {
|
||||||
useInstead: String? = null
|
|
||||||
) {
|
|
||||||
addKdoc(
|
addKdoc(
|
||||||
"""
|
"""
|
||||||
Will register [definition] with [org.koin.core.module.Module.single] and key "${name}"
|
Will register [definition] with [org.koin.core.module.Module.single] and key "${name}"
|
||||||
|
@ -185,30 +183,9 @@ class Processor(
|
||||||
addTypeVariable(it)
|
addTypeVariable(it)
|
||||||
addModifiers(KModifier.INLINE)
|
addModifiers(KModifier.INLINE)
|
||||||
}
|
}
|
||||||
if (useInstead != null) {
|
|
||||||
addAnnotation(
|
|
||||||
AnnotationSpec.builder(
|
|
||||||
Deprecated::class
|
|
||||||
).apply {
|
|
||||||
addMember(
|
|
||||||
CodeBlock.of(
|
|
||||||
"""
|
|
||||||
"This definition is old style and should not be used anymore. Use $useInstead instead"
|
|
||||||
""".trimIndent()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
addMember(CodeBlock.of("ReplaceWith(\"$useInstead\")"))
|
|
||||||
}.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val actualSingleName = "single${name.replaceFirstChar { it.uppercase() }}"
|
val actualSingleName = "single${name.replaceFirstChar { it.uppercase() }}"
|
||||||
if (targetTypeAsGenericType == null) { // classic type
|
|
||||||
addFunction(
|
|
||||||
FunSpec.builder("${name}Single").apply { configure(actualSingleName) }.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
addFunction(
|
addFunction(
|
||||||
FunSpec.builder(actualSingleName).apply { configure() }.build()
|
FunSpec.builder(actualSingleName).apply { configure() }.build()
|
||||||
|
@ -216,9 +193,7 @@ class Processor(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generateFactory) {
|
if (generateFactory) {
|
||||||
fun FunSpec.Builder.configure(
|
fun FunSpec.Builder.configure() {
|
||||||
useInstead: String? = null
|
|
||||||
) {
|
|
||||||
addKdoc(
|
addKdoc(
|
||||||
"""
|
"""
|
||||||
Will register [definition] with [org.koin.core.module.Module.factory] and key "${name}"
|
Will register [definition] with [org.koin.core.module.Module.factory] and key "${name}"
|
||||||
|
@ -234,29 +209,8 @@ class Processor(
|
||||||
addTypeVariable(it)
|
addTypeVariable(it)
|
||||||
addModifiers(KModifier.INLINE)
|
addModifiers(KModifier.INLINE)
|
||||||
}
|
}
|
||||||
if (useInstead != null) {
|
|
||||||
addAnnotation(
|
|
||||||
AnnotationSpec.builder(
|
|
||||||
Deprecated::class
|
|
||||||
).apply {
|
|
||||||
addMember(
|
|
||||||
CodeBlock.of(
|
|
||||||
"""
|
|
||||||
"This definition is old style and should not be used anymore. Use $useInstead instead"
|
|
||||||
""".trimIndent()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
addMember(CodeBlock.of("ReplaceWith(\"$useInstead\")"))
|
|
||||||
}.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
val actualFactoryName = "factory${name.replaceFirstChar { it.uppercase() }}"
|
val actualFactoryName = "factory${name.replaceFirstChar { it.uppercase() }}"
|
||||||
if (targetTypeAsGenericType == null) { // classic type
|
|
||||||
addFunction(
|
|
||||||
FunSpec.builder("${name}Factory").apply { configure(useInstead = actualFactoryName) }.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
addFunction(
|
addFunction(
|
||||||
FunSpec.builder(actualFactoryName).apply { configure() }.build()
|
FunSpec.builder(actualFactoryName).apply { configure() }.build()
|
||||||
)
|
)
|
|
@ -1,7 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
for folder in $(find . -depth -type d -name "main");
|
function renameFolders() {
|
||||||
do
|
for folder in $(find . -depth -type d -name "$1");
|
||||||
newFolder="`echo $folder | sed 's/main/androidMain/g'`"
|
do
|
||||||
mv $folder "$newFolder"
|
sedString="s/$1/$2/g"
|
||||||
done
|
newFolder="$(echo $folder | sed $sedString)"
|
||||||
|
echo $folder "$newFolder"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
renameFolders "androidTest" "androidUnitTest"
|
||||||
|
|
|
@ -4,7 +4,7 @@ project.group = "$group"
|
||||||
apply from: "$publishGradlePath"
|
apply from: "$publishGradlePath"
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
androidTarget {
|
android {
|
||||||
publishAllLibraryVariants()
|
publishAllLibraryVariants()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ kotlin {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
androidTarget {
|
android {
|
||||||
publishAllLibraryVariants()
|
publishAllLibraryVariants()
|
||||||
}
|
}
|
||||||
linuxX64()
|
linuxX64()
|
||||||
|
@ -45,7 +45,7 @@ kotlin {
|
||||||
implementation kotlin('test-junit')
|
implementation kotlin('test-junit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
androidTest {
|
androidUnitTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation kotlin('test-junit')
|
implementation kotlin('test-junit')
|
||||||
implementation libs.android.test.junit
|
implementation libs.android.test.junit
|
||||||
|
|
|
@ -15,7 +15,7 @@ kotlin {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
androidTarget {
|
android {
|
||||||
publishAllLibraryVariants()
|
publishAllLibraryVariants()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ kotlin {
|
||||||
implementation kotlin('test-junit')
|
implementation kotlin('test-junit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
androidTest {
|
androidUnitTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation kotlin('test-junit')
|
implementation kotlin('test-junit')
|
||||||
implementation libs.android.test.junit
|
implementation libs.android.test.junit
|
||||||
|
|
Loading…
Reference in New Issue