Merge pull request #294 from InsanusMokrassar/0.20.0

0.20.0
This commit is contained in:
InsanusMokrassar 2023-08-09 00:32:03 +06:00 committed by GitHub
commit e13a1162a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 35 additions and 72 deletions

View File

@ -1,5 +1,7 @@
# Changelog
## 0.20.0
## 0.19.9
* `Versions`:

View File

@ -1,12 +1,10 @@
package dev.inmo.micro_utils.common
import kotlinx.cinterop.ByteVar
import kotlinx.cinterop.allocArray
import kotlinx.cinterop.memScoped
import kotlinx.cinterop.toKString
import kotlinx.cinterop.*
import platform.posix.snprintf
import platform.posix.sprintf
@OptIn(ExperimentalForeignApi::class)
actual fun Float.fixed(signs: Int): Float {
return memScoped {
val buff = allocArray<ByteVar>(Float.SIZE_BYTES * 2)
@ -16,6 +14,7 @@ actual fun Float.fixed(signs: Int): Float {
}
}
@OptIn(ExperimentalForeignApi::class)
actual fun Double.fixed(signs: Int): Double {
return memScoped {
val buff = allocArray<ByteVar>(Double.SIZE_BYTES * 2)

View File

@ -1,12 +1,10 @@
package dev.inmo.micro_utils.common
import kotlinx.cinterop.ByteVar
import kotlinx.cinterop.allocArray
import kotlinx.cinterop.memScoped
import kotlinx.cinterop.toKString
import kotlinx.cinterop.*
import platform.posix.snprintf
import platform.posix.sprintf
@OptIn(ExperimentalForeignApi::class)
actual fun Float.fixed(signs: Int): Float {
return memScoped {
val buff = allocArray<ByteVar>(Float.SIZE_BYTES * 2)
@ -16,6 +14,7 @@ actual fun Float.fixed(signs: Int): Float {
}
}
@OptIn(ExperimentalForeignApi::class)
actual fun Double.fixed(signs: Int): Double {
return memScoped {
val buff = allocArray<ByteVar>(Double.SIZE_BYTES * 2)

View File

@ -29,8 +29,4 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

View File

@ -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
@ -14,5 +15,5 @@ crypto_js_version=4.1.1
# Project data
group=dev.inmo
version=0.19.9
android_code_version=205
version=0.20.0
android_code_version=206

View File

@ -1,27 +1,27 @@
[versions]
kt = "1.8.22"
kt = "1.9.0"
kt-serialization = "1.5.1"
kt-coroutines = "1.7.3"
kslog = "1.1.1"
kslog = "1.2.0"
jb-compose = "1.4.3"
jb-exposed = "0.41.1"
jb-exposed = "0.42.0"
jb-dokka = "1.8.20"
korlibs = "4.0.3"
uuid = "0.7.1"
korlibs = "4.0.9"
uuid = "0.8.0"
ktor = "2.3.2"
ktor = "2.3.3"
gh-release = "2.4.1"
koin = "3.4.3"
okio = "3.4.0"
okio = "3.5.0"
ksp = "1.8.22-1.0.11"
ksp = "1.9.0-1.0.13"
kotlin-poet = "1.14.2"
versions = "0.47.0"

View File

@ -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()
)

12
local.migrate.folder.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
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"

View File

@ -45,7 +45,7 @@ kotlin {
implementation kotlin('test-junit')
}
}
androidTest {
androidUnitTest {
dependencies {
implementation kotlin('test-junit')
implementation libs.android.test.junit

View File

@ -54,7 +54,7 @@ kotlin {
implementation kotlin('test-junit')
}
}
androidTest {
androidUnitTest {
dependencies {
implementation kotlin('test-junit')
implementation libs.android.test.junit