Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Please check the [Installation](https://arkivanov.github.io/Decompose/getting-st

### Supported platforms

In general, Decompose supports the following targets: `android`, `jvm`, `ios`, `watchos`, `tvos`, `macos`, `wasmJs`, `js`. However, some modules do not support all targets or the support depends on the Decompose version. Please see the installation docs for details.
In general, Decompose supports the following targets: `android`, `jvm`, `ios`, `watchos`, `tvos`, `macos`, `linuxX64`, `linuxArm64`, `wasmJs`, `js`. However, some modules do not support all targets or the support depends on the Decompose version. Please see the installation docs for details.

## Overview

Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ setupDefaults(
jvm()
js { browser() }
wasmJs { browser() }
linuxX64()
linuxArm64()
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
iosCompat()
watchosCompat()
tvosCompat()
Expand Down
3 changes: 3 additions & 0 deletions decompose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ kotlin {
val wasmJs by bundle()
val nonWeb by bundle()
val web by bundle()
val linux by bundle()

(darwin) dependsOn common
nonWeb dependsOn common
Expand All @@ -44,6 +45,8 @@ kotlin {
(js + wasmJs) dependsOn web
(iosSet + tvosSet) dependsOn itvos
(darwinSet - iosSet - tvosSet + itvos) dependsOn darwin
linux dependsOn common
linuxSet dependsOn linux

all {
languageSettings {
Expand Down
20 changes: 10 additions & 10 deletions decompose/dependencies/releaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing:1.0.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
com.arkivanov.essenty:back-handler-android:2.6.0
com.arkivanov.essenty:back-handler:2.6.0
com.arkivanov.essenty:instance-keeper-android:2.6.0
com.arkivanov.essenty:instance-keeper:2.6.0
com.arkivanov.essenty:lifecycle-android:2.6.0
com.arkivanov.essenty:lifecycle:2.6.0
com.arkivanov.essenty:state-keeper-android:2.6.0
com.arkivanov.essenty:state-keeper:2.6.0
com.arkivanov.essenty:utils-internal-android:2.6.0
com.arkivanov.essenty:utils-internal:2.6.0
com.arkivanov.essenty:back-handler-android:2.7.0-alpha01
com.arkivanov.essenty:back-handler:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper:2.7.0-alpha01
com.arkivanov.essenty:lifecycle-android:2.7.0-alpha01
com.arkivanov.essenty:lifecycle:2.7.0-alpha01
com.arkivanov.essenty:state-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:state-keeper:2.7.0-alpha01
com.arkivanov.essenty:utils-internal-android:2.7.0-alpha01
com.arkivanov.essenty:utils-internal:2.7.0-alpha01
com.google.guava:listenablefuture:1.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0
Expand Down
67 changes: 67 additions & 0 deletions decompose/src/linuxMain/kotlin/com/arkivanov/decompose/Lock.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.arkivanov.decompose

import kotlinx.cinterop.Arena
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.alloc
import kotlinx.cinterop.ptr
import platform.posix.PTHREAD_MUTEX_RECURSIVE
import platform.posix.pthread_mutex_destroy
import platform.posix.pthread_mutex_init
import platform.posix.pthread_mutex_lock
import platform.posix.pthread_mutex_t
import platform.posix.pthread_mutex_unlock
import platform.posix.pthread_mutexattr_destroy
import platform.posix.pthread_mutexattr_init
import platform.posix.pthread_mutexattr_settype
import platform.posix.pthread_mutexattr_t
import kotlin.experimental.ExperimentalNativeApi
import kotlin.native.ref.createCleaner

@OptIn(ExperimentalForeignApi::class)
Comment thread
arkivanov marked this conversation as resolved.
Resolved
internal actual class Lock actual constructor() {

private val arena = Arena()
private val attr = arena.alloc<pthread_mutexattr_t>()
private val mutex = arena.alloc<pthread_mutex_t>()

@Suppress("unused") // Must be stored in a property
@OptIn(ExperimentalNativeApi::class)
private val cleaner = createCleaner(Resources(arena, attr, mutex), Resources::destroy)

init {
pthread_mutexattr_init(attr.ptr)
pthread_mutexattr_settype(attr.ptr, PTHREAD_MUTEX_RECURSIVE.toInt())
pthread_mutex_init(mutex.ptr, attr.ptr)
}

actual inline fun <T> synchronizedImpl(block: () -> T): T {
lock()
try {
return block()
} finally {
unlock()
}
}

@PublishedApi
internal fun lock() {
pthread_mutex_lock(mutex.ptr)
Comment thread
arkivanov marked this conversation as resolved.
Resolved
}

@PublishedApi
internal fun unlock() {
pthread_mutex_unlock(mutex.ptr)
}

private class Resources(
private val arena: Arena,
private val attr: pthread_mutexattr_t,
private val mutex: pthread_mutex_t,
) {
fun destroy() {
pthread_mutex_destroy(mutex.ptr)
pthread_mutexattr_destroy(attr.ptr)
arena.clear()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.arkivanov.decompose.errorhandler

internal actual fun printError(exception: Exception) {
exception.printStackTrace()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.arkivanov.decompose.mainthread

internal actual fun checkMainThread() {
// No-op
}
2 changes: 1 addition & 1 deletion deps.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

decompose = "3.6.0-beta01"
kotlin = "2.3.21"
essenty = "2.6.0"
essenty = "2.7.0-alpha01"
reaktive = "2.2.0"
junit = "4.13.2"
jetbrainsCompose = "1.9.3"
Expand Down
20 changes: 10 additions & 10 deletions extensions-android/dependencies/releaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing:1.0.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
com.arkivanov.essenty:back-handler-android:2.6.0
com.arkivanov.essenty:back-handler:2.6.0
com.arkivanov.essenty:instance-keeper-android:2.6.0
com.arkivanov.essenty:instance-keeper:2.6.0
com.arkivanov.essenty:lifecycle-android:2.6.0
com.arkivanov.essenty:lifecycle:2.6.0
com.arkivanov.essenty:state-keeper-android:2.6.0
com.arkivanov.essenty:state-keeper:2.6.0
com.arkivanov.essenty:utils-internal-android:2.6.0
com.arkivanov.essenty:utils-internal:2.6.0
com.arkivanov.essenty:back-handler-android:2.7.0-alpha01
com.arkivanov.essenty:back-handler:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper:2.7.0-alpha01
com.arkivanov.essenty:lifecycle-android:2.7.0-alpha01
com.arkivanov.essenty:lifecycle:2.7.0-alpha01
com.arkivanov.essenty:state-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:state-keeper:2.7.0-alpha01
com.arkivanov.essenty:utils-internal-android:2.7.0-alpha01
com.arkivanov.essenty:utils-internal:2.7.0-alpha01
com.google.guava:listenablefuture:1.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing:1.2.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
com.arkivanov.essenty:back-handler-android:2.6.0
com.arkivanov.essenty:back-handler:2.6.0
com.arkivanov.essenty:instance-keeper-android:2.6.0
com.arkivanov.essenty:instance-keeper:2.6.0
com.arkivanov.essenty:lifecycle-android:2.6.0
com.arkivanov.essenty:lifecycle:2.6.0
com.arkivanov.essenty:state-keeper-android:2.6.0
com.arkivanov.essenty:state-keeper:2.6.0
com.arkivanov.essenty:utils-internal-android:2.6.0
com.arkivanov.essenty:utils-internal:2.6.0
com.arkivanov.essenty:back-handler-android:2.7.0-alpha01
com.arkivanov.essenty:back-handler:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper:2.7.0-alpha01
com.arkivanov.essenty:lifecycle-android:2.7.0-alpha01
com.arkivanov.essenty:lifecycle:2.7.0-alpha01
com.arkivanov.essenty:state-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:state-keeper:2.7.0-alpha01
com.arkivanov.essenty:utils-internal-android:2.7.0-alpha01
com.arkivanov.essenty:utils-internal:2.7.0-alpha01
com.google.guava:listenablefuture:1.0
org.jetbrains.androidx.lifecycle:lifecycle-common:2.9.6
org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose:2.9.6
Expand Down
20 changes: 10 additions & 10 deletions extensions-compose/dependencies/releaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing:1.2.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
com.arkivanov.essenty:back-handler-android:2.6.0
com.arkivanov.essenty:back-handler:2.6.0
com.arkivanov.essenty:instance-keeper-android:2.6.0
com.arkivanov.essenty:instance-keeper:2.6.0
com.arkivanov.essenty:lifecycle-android:2.6.0
com.arkivanov.essenty:lifecycle:2.6.0
com.arkivanov.essenty:state-keeper-android:2.6.0
com.arkivanov.essenty:state-keeper:2.6.0
com.arkivanov.essenty:utils-internal-android:2.6.0
com.arkivanov.essenty:utils-internal:2.6.0
com.arkivanov.essenty:back-handler-android:2.7.0-alpha01
com.arkivanov.essenty:back-handler:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper:2.7.0-alpha01
com.arkivanov.essenty:lifecycle-android:2.7.0-alpha01
com.arkivanov.essenty:lifecycle:2.7.0-alpha01
com.arkivanov.essenty:state-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:state-keeper:2.7.0-alpha01
com.arkivanov.essenty:utils-internal-android:2.7.0-alpha01
com.arkivanov.essenty:utils-internal:2.7.0-alpha01
com.google.guava:listenablefuture:1.0
org.jetbrains.androidx.lifecycle:lifecycle-common:2.9.6
org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose:2.9.6
Expand Down
20 changes: 10 additions & 10 deletions jetpack-component-context/dependencies/releaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing:1.0.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
com.arkivanov.essenty:back-handler-android:2.6.0
com.arkivanov.essenty:back-handler:2.6.0
com.arkivanov.essenty:instance-keeper-android:2.6.0
com.arkivanov.essenty:instance-keeper:2.6.0
com.arkivanov.essenty:lifecycle-android:2.6.0
com.arkivanov.essenty:lifecycle:2.6.0
com.arkivanov.essenty:state-keeper-android:2.6.0
com.arkivanov.essenty:state-keeper:2.6.0
com.arkivanov.essenty:utils-internal-android:2.6.0
com.arkivanov.essenty:utils-internal:2.6.0
com.arkivanov.essenty:back-handler-android:2.7.0-alpha01
com.arkivanov.essenty:back-handler:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:instance-keeper:2.7.0-alpha01
com.arkivanov.essenty:lifecycle-android:2.7.0-alpha01
com.arkivanov.essenty:lifecycle:2.7.0-alpha01
com.arkivanov.essenty:state-keeper-android:2.7.0-alpha01
com.arkivanov.essenty:state-keeper:2.7.0-alpha01
com.arkivanov.essenty:utils-internal-android:2.7.0-alpha01
com.arkivanov.essenty:utils-internal:2.7.0-alpha01
com.google.guava:listenablefuture:1.0
org.jetbrains.androidx.lifecycle:lifecycle-common:2.9.1
org.jetbrains.androidx.lifecycle:lifecycle-runtime:2.9.1
Expand Down
Loading