mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-05-23 16:27:29 +00:00
Compare commits
1 Commits
0.29.4
...
renovate/j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85d52eb26c |
2
.github/workflows/dokka_push.yml
vendored
2
.github/workflows/dokka_push.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 17
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew build && ./gradlew :micro_utils.dokka:dokkaGenerate
|
run: ./gradlew build && ./gradlew dokkaHtml
|
||||||
- name: Publish KDocs
|
- name: Publish KDocs
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.29.4
|
|
||||||
|
|
||||||
* `Meta`:
|
|
||||||
* Inited
|
|
||||||
|
|
||||||
## 0.29.3
|
## 0.29.3
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ kotlin {
|
|||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
androidTarget {}
|
android {}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
@@ -91,7 +91,7 @@ kotlin {
|
|||||||
|
|
||||||
private List<SourceDirectorySet> findSourcesWithName(String... approximateNames) {
|
private List<SourceDirectorySet> findSourcesWithName(String... approximateNames) {
|
||||||
return parent.subprojects
|
return parent.subprojects
|
||||||
.findAll { it != project && it.hasProperty("kotlin") && (it.name.contains("dokka") == false) }
|
.findAll { it != project && it.hasProperty("kotlin") }
|
||||||
.collectMany { it.kotlin.sourceSets }
|
.collectMany { it.kotlin.sourceSets }
|
||||||
.findAll { sourceSet ->
|
.findAll { sourceSet ->
|
||||||
approximateNames.any { nameToFilter ->
|
approximateNames.any { nameToFilter ->
|
||||||
@@ -100,14 +100,14 @@ private List<SourceDirectorySet> findSourcesWithName(String... approximateNames)
|
|||||||
}.collect { it.kotlin }
|
}.collect { it.kotlin }
|
||||||
}
|
}
|
||||||
|
|
||||||
dokka {
|
tasks.dokkaHtml {
|
||||||
dokkaSourceSets {
|
dokkaSourceSets {
|
||||||
configureEach {
|
configureEach {
|
||||||
skipDeprecated.set(true)
|
skipDeprecated.set(true)
|
||||||
|
|
||||||
sourceLink {
|
sourceLink {
|
||||||
localDirectory.set(file("../"))
|
localDirectory.set(file("../"))
|
||||||
remoteUrl.set(new URI("https://github.com/InsanusMokrassar/MicroUtils/blob/master/"))
|
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/MicroUtils/blob/master/"))
|
||||||
remoteLineSuffix.set("#L")
|
remoteLineSuffix.set("#L")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,12 +130,4 @@ dokka {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//dependencies {
|
|
||||||
// project.parent.subprojects.forEach {
|
|
||||||
// if (it != project) {
|
|
||||||
// dokka(it)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
apply from: "$defaultAndroidSettings"
|
apply from: "$defaultAndroidSettings"
|
||||||
|
|||||||
@@ -18,5 +18,5 @@ crypto_js_version=4.1.1
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.29.4
|
version=0.29.3
|
||||||
android_code_version=314
|
android_code_version=313
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ kotlinx-browser = "0.5.0"
|
|||||||
kslog = "1.6.1"
|
kslog = "1.6.1"
|
||||||
|
|
||||||
jb-compose = "1.11.0"
|
jb-compose = "1.11.0"
|
||||||
jb-compose-material3 = "1.11.0-alpha07"
|
jb-compose-material3 = "1.11.0-SNAPSHOT+release-1-11"
|
||||||
jb-compose-icons = "1.7.8"
|
jb-compose-icons = "1.7.8"
|
||||||
jb-exposed = "1.3.0"
|
jb-exposed = "1.3.0"
|
||||||
jb-dokka = "2.2.0"
|
jb-dokka = "2.2.0"
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
project.version = "$version"
|
project.version = "$version"
|
||||||
project.group = "$group"
|
project.group = "$group"
|
||||||
|
|
||||||
apply plugin: 'org.jetbrains.dokka'
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
|
||||||
id "com.android.library"
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "$mppJvmJsWasmJsAndroidLinuxMingwLinuxArm64Project"
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
sourceSets {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
package dev.inmo.micro_utils.meta
|
|
||||||
|
|
||||||
import kotlinx.serialization.Polymorphic
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A polymorphic container for storing heterogeneous key-value pairs with type-safe retrieval.
|
|
||||||
* Each key is bound to a specific type, enabling type-safe access to stored values.
|
|
||||||
*
|
|
||||||
* @property map The underlying map storing key-value pairs with polymorphic values.
|
|
||||||
*/
|
|
||||||
@Serializable
|
|
||||||
data class MetaContainer(
|
|
||||||
@MetaContainerRootMapWarning
|
|
||||||
val map: Map<Key<*>, @Polymorphic Any>
|
|
||||||
) {
|
|
||||||
/**
|
|
||||||
* A marker interface for type-safe keys in [MetaContainer].
|
|
||||||
*
|
|
||||||
* @param T The type of value associated with this key.
|
|
||||||
*/
|
|
||||||
interface Key<T : Any>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a value from the container by its key.
|
|
||||||
*
|
|
||||||
* @param key The type-safe key to look up.
|
|
||||||
* @return The value associated with the key, or null if not present.
|
|
||||||
*/
|
|
||||||
@Suppress("UNCHECKED_CAST", "OPT_IN_USAGE")
|
|
||||||
operator fun <T : Any> get(key: Key<T>): T? = map[key] as? T?
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether a value exists for the given key.
|
|
||||||
*
|
|
||||||
* @param key The type-safe key to check.
|
|
||||||
* @return true if the key exists and has a non-null value, false otherwise.
|
|
||||||
*/
|
|
||||||
operator fun <T : Any> contains(key: Key<T>): Boolean = get(key) != null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builder for constructing [MetaContainer] instances with a fluent API.
|
|
||||||
*/
|
|
||||||
class Builder(
|
|
||||||
@MetaContainerRootMapWarning
|
|
||||||
private val map: MutableMap<Key<*>, Any> = mutableMapOf<Key<*>, Any>()
|
|
||||||
) {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Puts a value associated with the given key into the builder.
|
|
||||||
*
|
|
||||||
* @param k The type-safe key.
|
|
||||||
* @param v The value to store.
|
|
||||||
*/
|
|
||||||
fun <T : Any> put(k: Key<T>, v: T) {
|
|
||||||
map[k] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a value from the builder by its key.
|
|
||||||
*
|
|
||||||
* @param key The type-safe key to look up.
|
|
||||||
* @return The value associated with the key, or null if not present.
|
|
||||||
*/
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
operator fun <T : Any> get(key: Key<T>): T? = map[key] as T?
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether a value exists for the given key in the builder.
|
|
||||||
*
|
|
||||||
* @param key The type-safe key to check.
|
|
||||||
* @return true if the key exists and has a non-null value, false otherwise.
|
|
||||||
*/
|
|
||||||
operator fun <T : Any> contains(key: Key<T>): Boolean = get(key) != null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds and returns the immutable [MetaContainer] instance.
|
|
||||||
*
|
|
||||||
* @return A new [MetaContainer] with the accumulated key-value pairs.
|
|
||||||
*/
|
|
||||||
fun build(): MetaContainer = MetaContainer(map.toMap())
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
/**
|
|
||||||
* An empty [MetaContainer] instance with no entries.
|
|
||||||
*/
|
|
||||||
val EMPTY = MetaContainer(emptyMap())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package dev.inmo.micro_utils.meta
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marks the direct use of [MetaContainer.map] as requiring explicit opt-in.
|
|
||||||
*
|
|
||||||
* This annotation warns against direct manipulation of the internal map without using
|
|
||||||
* the type-safe accessors, which could break type safety guarantees.
|
|
||||||
*/
|
|
||||||
@RequiresOptIn(
|
|
||||||
"Do not use this directly without any special reason",
|
|
||||||
RequiresOptIn.Level.WARNING
|
|
||||||
)
|
|
||||||
@Target(
|
|
||||||
AnnotationTarget.FIELD,
|
|
||||||
)
|
|
||||||
@Retention(AnnotationRetention.BINARY)
|
|
||||||
annotation class MetaContainerRootMapWarning
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package dev.inmo.micro_utils.meta
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DSL builder function for creating a [MetaContainer] with a lambda block.
|
|
||||||
*
|
|
||||||
* @param block A lambda with receiver ([MetaContainer.Builder]) to configure the container.
|
|
||||||
* @return A new [MetaContainer] instance built from the DSL block.
|
|
||||||
*/
|
|
||||||
fun buildMetaContainer(block: MetaContainer.Builder.() -> Unit): MetaContainer {
|
|
||||||
val builder = MetaContainer.Builder()
|
|
||||||
builder.block()
|
|
||||||
return builder.build()
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
rootProject.name='micro_utils'
|
rootProject.name='micro_utils'
|
||||||
|
|
||||||
String[] includes = [
|
String[] includes = [
|
||||||
":meta",
|
|
||||||
":common",
|
":common",
|
||||||
":common:compose",
|
":common:compose",
|
||||||
":transactions",
|
":transactions",
|
||||||
|
|||||||
Reference in New Issue
Block a user