mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-19 14:53:50 +00:00
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.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
#kotlin.experimental.tryK2=true
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
org.gradle.jvmargs=-Xmx2g
|
||||
|
@ -159,9 +159,7 @@ class Processor(
|
||||
}
|
||||
|
||||
if (generateSingle) {
|
||||
fun FunSpec.Builder.configure(
|
||||
useInstead: String? = null
|
||||
) {
|
||||
fun FunSpec.Builder.configure() {
|
||||
addKdoc(
|
||||
"""
|
||||
Will register [definition] with [org.koin.core.module.Module.single] and key "${name}"
|
||||
@ -185,30 +183,9 @@ class Processor(
|
||||
addTypeVariable(it)
|
||||
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() }}"
|
||||
if (targetTypeAsGenericType == null) { // classic type
|
||||
addFunction(
|
||||
FunSpec.builder("${name}Single").apply { configure(actualSingleName) }.build()
|
||||
)
|
||||
}
|
||||
|
||||
addFunction(
|
||||
FunSpec.builder(actualSingleName).apply { configure() }.build()
|
||||
@ -216,9 +193,7 @@ class Processor(
|
||||
}
|
||||
|
||||
if (generateFactory) {
|
||||
fun FunSpec.Builder.configure(
|
||||
useInstead: String? = null
|
||||
) {
|
||||
fun FunSpec.Builder.configure() {
|
||||
addKdoc(
|
||||
"""
|
||||
Will register [definition] with [org.koin.core.module.Module.factory] and key "${name}"
|
||||
@ -234,29 +209,8 @@ class Processor(
|
||||
addTypeVariable(it)
|
||||
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() }}"
|
||||
if (targetTypeAsGenericType == null) { // classic type
|
||||
addFunction(
|
||||
FunSpec.builder("${name}Factory").apply { configure(useInstead = actualFactoryName) }.build()
|
||||
)
|
||||
}
|
||||
addFunction(
|
||||
FunSpec.builder(actualFactoryName).apply { configure() }.build()
|
||||
)
|
@ -1,7 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
for folder in $(find . -depth -type d -name "main");
|
||||
do
|
||||
newFolder="`echo $folder | sed 's/main/androidMain/g'`"
|
||||
mv $folder "$newFolder"
|
||||
done
|
||||
function renameFolders() {
|
||||
for folder in $(find . -depth -type d -name "$1");
|
||||
do
|
||||
sedString="s/$1/$2/g"
|
||||
newFolder="$(echo $folder | sed $sedString)"
|
||||
echo $folder "$newFolder"
|
||||
done
|
||||
}
|
||||
|
||||
renameFolders "androidTest" "androidUnitTest"
|
||||
|
@ -4,7 +4,7 @@ project.group = "$group"
|
||||
apply from: "$publishGradlePath"
|
||||
|
||||
kotlin {
|
||||
androidTarget {
|
||||
android {
|
||||
publishAllLibraryVariants()
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ kotlin {
|
||||
browser()
|
||||
nodejs()
|
||||
}
|
||||
androidTarget {
|
||||
android {
|
||||
publishAllLibraryVariants()
|
||||
}
|
||||
linuxX64()
|
||||
@ -45,7 +45,7 @@ kotlin {
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
androidTest {
|
||||
androidUnitTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit')
|
||||
implementation libs.android.test.junit
|
||||
|
@ -15,7 +15,7 @@ kotlin {
|
||||
browser()
|
||||
nodejs()
|
||||
}
|
||||
androidTarget {
|
||||
android {
|
||||
publishAllLibraryVariants()
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ kotlin {
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
androidTest {
|
||||
androidUnitTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit')
|
||||
implementation libs.android.test.junit
|
||||
|
Loading…
Reference in New Issue
Block a user