mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-23 09:07:14 +00:00
commit
e13a1162a9
@ -1,5 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## 0.20.0
|
||||
|
||||
## 0.19.9
|
||||
|
||||
* `Versions`:
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -29,8 +29,4 @@ android {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
12
local.migrate.folder.sh
Executable 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"
|
@ -45,7 +45,7 @@ kotlin {
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
androidTest {
|
||||
androidUnitTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit')
|
||||
implementation libs.android.test.junit
|
||||
|
@ -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