Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
:sample-compose:main-parallel:routing:assembleDebug \
:sample-compose:categories:ui:assembleDebug \
:sample-compose:login:routing:assembleDebug \
:way-compose:assembleDebug \
:way-compose:assembleAndroidMain \
:sample-compose:main-parallel:ui:assembleDebug \
:sample-compose:categories:routing:assembleDebug \
:sample-compose:permissions:routing:assembleDebug
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ permissions:

jobs:
publish-libraries:
runs-on: ubuntu-latest
# iOS targets only compile on macOS; on Linux they are skipped and the release would ship without them
runs-on: macos-latest
environment: release

steps:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 0.12.0 - 2026-11-08

### Added

* `way` is published for Android and iOS (`iosArm64`, `iosSimulatorArm64`, `iosX64`) next to JVM. The coordinates
stay `ru.kode:way`: Gradle metadata gives each consumer the artifact of its platform, an Android module gets
`way-android` instead of the JVM jar.
* `way-compose` is a Kotlin Multiplatform library for Android and iOS. On Android it depends on androidx Compose
1.10.6 as before; on iOS it uses Compose Multiplatform 1.10.3.

### Changed

* `way-compose` is built with the Android Kotlin Multiplatform library plugin instead of `com.android.library`.
The coordinates stay `ru.kode:way-compose`.
* The javadoc jars are empty, which makes the upload to Maven Central smaller.

## 0.11.0 - 2026-10-06

### Added
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ The Compose integration (`:way-compose`) renders active nodes with `NodeHost`.

## Modules

- `:way` - Runtime library structured as a Kotlin Multiplatform project (common + JVM). **Current release targets JVM/Android only. iOS and other native targets are planned for a future release.**
- `:way-compose` - Android Compose integration for `NavigationService`.
- `:way` - Kotlin Multiplatform runtime library: JVM, Android, iOS (`iosArm64`, `iosSimulatorArm64`, `iosX64`).
- `:way-compose` - Compose integration for `NavigationService`: Android (androidx Compose) and iOS (Compose Multiplatform).
- `:way-gradle-plugin` - Gradle plugin (`id("ru.kode.way")`) that generates code from `.dot` schemas.
- `:sample` - JVM sample (KMP multi-target support is not yet released).
- `:sample` - JVM sample.
- `:sample-compose:*` - Android sample split into feature modules.
- `:sample-compose:main-parallel:*` - tab-bar example using `ParallelFlowNode` (see [Compose Integration](#compose-integration)).
- `:sample-compose:app:routing` - `google`/`huawei` product flavors with a per-flavor `.dot` extension (see [Flavor-Specific Routing](#flavor-specific-routing)).
Expand Down
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinCompose) apply false
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidKmpLibrary) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.kotest) apply false
alias(libs.plugins.kotlinJvm) apply false
alias(libs.plugins.vanniktech.maven.publish) apply false
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kotlin.native.ignoreDisabledTargets=true

android.useAndroidX=true

versionName=0.11.0
versionName=0.12.0
pomGroupId=ru.kode
pomDescription=Navigation library based on statechart-like node graphs
pomUrl=https://github.com/appKODE/way
Expand Down
7 changes: 7 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ kotlin = "2.3.20"
spotless = "8.4.0"
turbine = "1.2.1"
compose = "1.10.6"
# Compose Multiplatform for iOS; its Android artifacts map to androidx compose 1.10.5, so `compose` above wins
composeMultiplatform = "1.10.3"
androidExtensions = "1.13.0"
agp = "9.0.1"
kotlinPoet = "2.2.0"
Expand Down Expand Up @@ -34,6 +36,9 @@ composeRuntime = { module = "androidx.compose.runtime:runtime", version.ref = "c
composeMaterial = { module = "androidx.compose.material:material", version.ref = "compose" }
composeAnimation = { module = "androidx.compose.animation:animation", version.ref = "compose" }
composeFoundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
cmpUi = { module = "org.jetbrains.compose.ui:ui", version.ref = "composeMultiplatform" }
cmpAnimation = { module = "org.jetbrains.compose.animation:animation", version.ref = "composeMultiplatform" }
cmpFoundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "composeMultiplatform" }
composeUiTestJunit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" }
composeUiTestManifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" }
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
Expand All @@ -60,8 +65,10 @@ kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinCompose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
androidKmpLibrary = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
androidApplication = { id = "com.android.application", version.ref = "agp" }
way = { id = "ru.kode.way" }
gradlePublish = { id = "com.gradle.plugin-publish", version.ref = "gradlePublishPlugin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
kotest = { id = "io.kotest", version.ref = "koTest" }
vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktechMavenPublish" }
71 changes: 36 additions & 35 deletions way-compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,47 +1,60 @@
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.kotlinMultiplatform.get().pluginId)
id(libs.plugins.androidKmpLibrary.get().pluginId)
alias(libs.plugins.kotlinCompose)
alias(libs.plugins.vanniktech.maven.publish)
}

group = providers.gradleProperty("pomGroupId").get()
version = providers.gradleProperty("versionName").get()

android {
namespace = "ru.kode.way.compose"

compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
kotlin {
androidLibrary {
namespace = "ru.kode.way.compose"
compileSdk = libs.versions.compileSdk.get().toInt()
minSdk = 21
// JVM 11 bytecode, but no jvmToolchain(11): Robolectric host tests need the running JDK 17+
compilerOptions { jvmTarget.set(JvmTarget.JVM_11) }

aarMetadata {
minCompileSdk = 21
withHostTestBuilder {}.configure {
isIncludeAndroidResources = true
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
compose = true
buildConfig = true
}

testOptions {
unitTests.isIncludeAndroidResources = true
iosArm64()
iosSimulatorArm64()
iosX64()

sourceSets {
commonMain.dependencies {
// Compose Multiplatform; on Android these resolve to the androidx artifacts below
api(libs.cmpUi)
api(libs.cmpAnimation)
api(libs.cmpFoundation)
implementation(project(":way"))
}
androidMain.dependencies {
api(libs.composeUi)
api(libs.composeAnimation)
api(libs.composeFoundation)
}
getByName("androidHostTest").dependencies {
implementation(libs.composeUiTestJunit4)
implementation(libs.composeUiTestManifest)
implementation(libs.robolectric)
implementation(libs.junit)
}
}
}

mavenPublishing {
coordinates(artifactId = "way-compose")
configure(AndroidSingleVariantLibrary(javadocJar = JavadocJar.Empty()))
configure(KotlinMultiplatform(javadocJar = JavadocJar.Empty()))

publishToMavenCentral()
signAllPublications()
Expand Down Expand Up @@ -85,15 +98,3 @@ mavenPublishing {
}
}
}

dependencies {
api(libs.composeUi)
api(libs.composeAnimation)
api(libs.composeFoundation)
implementation(project(":way"))

testImplementation(libs.composeUiTestJunit4)
testImplementation(libs.composeUiTestManifest)
testImplementation(libs.robolectric)
testImplementation(libs.junit)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ru.kode.way.compose

import android.content.pm.ApplicationInfo
import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext

internal actual fun logWarn(tag: String, message: String) {
Log.w(tag, message)
}

internal actual fun logDebug(tag: String, message: String) {
Log.d(tag, message)
}

@Composable
internal actual fun isDebuggable(): Boolean =
LocalContext.current.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package ru.kode.way.compose

import android.content.pm.ApplicationInfo
import android.util.Log
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.AnimatedContentTransitionScope.SlideDirection
Expand Down Expand Up @@ -29,7 +27,6 @@ import androidx.compose.runtime.saveable.SaveableStateHolder
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import ru.kode.way.FlowTransition
import ru.kode.way.NavigationService
import ru.kode.way.NavigationState
Expand Down Expand Up @@ -90,7 +87,7 @@ private fun FirstRegionFallback(
root: NodeWithPath?,
) {
if (root != null) {
Log.w(
logWarn(
LOG_TAG,
"parallel-flow root \"${root.path}\" is not a ComposableNode; only the first region will render — " +
"implement ComposableNode on it and call NodeHost(regionId) per sub-region in its Content()",
Expand Down Expand Up @@ -193,13 +190,13 @@ private fun NodeAnimatedContent(
} else {
if (path != null) {
if (node is ParallelFlowNode<*>) {
Log.w(
logWarn(
LOG_TAG,
"parallel-flow node at \"$path\" is not a ComposableNode; rendering an empty content — " +
"implement ComposableNode on it and call NodeHost(regionId) per sub-region in its Content()",
)
} else {
Log.d(LOG_TAG, "didn't find a ComposableNode for \"$path\", rendering an empty content")
logDebug(LOG_TAG, "didn't find a ComposableNode for \"$path\", rendering an empty content")
}
}
Box {}
Expand Down Expand Up @@ -277,7 +274,7 @@ fun <R : Any> NodeHost(nodeBuilder: NodeBuilder, onFinishRequest: (R) -> FlowTra
// nodeBuilder only, so a new lambda passed on recomposition (the common case for an inline
// lambda) would otherwise be ignored and the stale callback kept forever.
val currentOnFinishRequest by rememberUpdatedState(onFinishRequest)
val isDebuggable = LocalContext.current.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
val isDebuggable = isDebuggable()
val service = remember(nodeBuilder) {
NavigationService(nodeBuilder) { result: R -> currentOnFinishRequest(result) }
// debug builds throw on a dropped event so the bug surfaces, release builds drop it silently
Expand Down
10 changes: 10 additions & 0 deletions way-compose/src/commonMain/kotlin/ru/kode/way/compose/Platform.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ru.kode.way.compose

import androidx.compose.runtime.Composable

internal expect fun logWarn(tag: String, message: String)

internal expect fun logDebug(tag: String, message: String)

@Composable
internal expect fun isDebuggable(): Boolean
16 changes: 16 additions & 0 deletions way-compose/src/iosMain/kotlin/ru/kode/way/compose/Platform.ios.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ru.kode.way.compose

import androidx.compose.runtime.Composable
import kotlin.experimental.ExperimentalNativeApi

internal actual fun logWarn(tag: String, message: String) {
println("W/$tag: $message")
}

internal actual fun logDebug(tag: String, message: String) {
println("D/$tag: $message")
}

@OptIn(ExperimentalNativeApi::class)
@Composable
internal actual fun isDebuggable(): Boolean = Platform.isDebugBinary
4 changes: 0 additions & 4 deletions way-compose/src/main/AndroidManifest.xml

This file was deleted.

2 changes: 1 addition & 1 deletion way-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ gradlePlugin {
implementationClass = "ru.kode.way.gradle.WayPlugin"
displayName = "Code generation gradle plugin for Way navigation library"
description = "Code generation gradle plugin for Way navigation library"
tags = listOf("navigation", "codegen", "android", "kmm", "compose", "compose-desktop")
tags = listOf("navigation", "codegen", "android", "ios", "kmp", "compose", "compose-multiplatform")
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions way/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id(libs.plugins.kotlinMultiplatform.get().pluginId)
id(libs.plugins.androidKmpLibrary.get().pluginId)
// KSP before Kotest: the Kotest plugin needs it to run specs on native
id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.kotest.get().pluginId)
alias(libs.plugins.way)
alias(libs.plugins.vanniktech.maven.publish)
}
Expand All @@ -17,6 +21,16 @@ kotlin {
}
}

androidLibrary {
namespace = "ru.kode.way"
compileSdk = libs.versions.compileSdk.get().toInt()
minSdk = 21
}

iosArm64()
iosSimulatorArm64()
iosX64()

sourceSets {
val commonMain by getting {
dependencies {
Expand All @@ -29,8 +43,6 @@ kotlin {
implementation(libs.turbine)
}
}
val jvmMain by getting {
}
val jvmTest by getting {
dependencies {
implementation(libs.bundles.koTestJvm)
Expand Down
4 changes: 4 additions & 0 deletions way/src/commonTest/kotlin/ru/kode/way/Charset.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package ru.kode.way

// Stand-in for java.nio.charset.Charset so the nav-service12 schema compiles on every target
enum class Charset { UTF_8, UTF_32 }
Loading
Loading