feat: add KMP support to dari-core - #88
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesKMP core migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
.github/workflows/kmp-core.yml (1)
40-45: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRun the common tests on an iOS simulator.
These tasks compile iOS production and test sources, but they do not execute the common tests on iOS. Add the iOS simulator test task when the
macos-15runner provides a compatible simulator.This validates the iOS clock actual and shared runtime behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/kmp-core.yml around lines 40 - 45, Add the Kotlin Multiplatform iOS simulator test execution task to the workflow’s existing iOS task list, alongside the compile tasks, using the simulator-compatible task for the macos-15 runner. Keep the current production and test compilation tasks unchanged.dari-core/build.gradle.kts (1)
10-20: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueSet the Java compile target to 11.
withJava()enables Java compilation, but this file only sets Kotlin bytecode toJvmTarget.JVM_11. The Android Java sources are not constrained to Java compatible bytecode, so use Java 11 compatibility for the Android Java compilation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dari-core/build.gradle.kts` around lines 10 - 20, Update the Android configuration near the KotlinCompile settings and kotlin.android block to set Java source and target compatibility to Java 11 alongside JvmTarget.JVM_11. Ensure the Java compilation enabled by withJava() produces Java 11-compatible bytecode.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/kmp-core.yml:
- Around line 5-20: Add "gradlew" to both paths filters in the workflow’s
pull_request and push trigger definitions so wrapper changes run KMP
verification; preserve all existing path entries.
- Line 29: Update the actions/checkout@v4 step in the workflow to set
persist-credentials to false, preventing the checkout token from being stored in
local Git configuration while leaving the rest of the checkout behavior
unchanged.
In `@dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt`:
- Around line 31-43: The DariConfig primary constructor changes must preserve
the previous JVM constructor descriptor for existing Android binaries. In
DariConfig, add the required compatibility constructor or overload using the
former parameter set and delegate new fields to their defaults; update
DariInterceptor’s affected construction or usage site only as needed to route
through the compatibility-preserving API. Ensure both old compiled callers and
new callers can instantiate DariConfig without changing existing behavior.
In `@README.md`:
- Around line 225-231: Update the README dependency snippet to avoid the
undefined dariVersion reference by using a clear version placeholder such as
<version>, or define dariVersion within the example before it is used.
---
Nitpick comments:
In @.github/workflows/kmp-core.yml:
- Around line 40-45: Add the Kotlin Multiplatform iOS simulator test execution
task to the workflow’s existing iOS task list, alongside the compile tasks,
using the simulator-compatible task for the macos-15 runner. Keep the current
production and test compilation tasks unchanged.
In `@dari-core/build.gradle.kts`:
- Around line 10-20: Update the Android configuration near the KotlinCompile
settings and kotlin.android block to set Java source and target compatibility to
Java 11 alongside JvmTarget.JVM_11. Ensure the Java compilation enabled by
withJava() produces Java 11-compatible bytecode.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8aedc6b0-156d-44b1-9344-69ff3f472c59
📒 Files selected for processing (23)
.github/workflows/kmp-core.ymlREADME.mdbuild.gradle.ktsdari-core/build.gradle.ktsdari-core/src/androidMain/kotlin/com/easyhooon/dari/Clock.android.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/Clock.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessageDirection.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessageEntry.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessagePayloadMetadata.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessageStatus.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/ProtobufDariInterceptor.ktdari-core/src/commonTest/kotlin/com/easyhooon/dari/DariConfigTest.ktdari-core/src/commonTest/kotlin/com/easyhooon/dari/MessageEntryTest.ktdari-core/src/commonTest/kotlin/com/easyhooon/dari/PublicApiCompatibilityTest.ktdari-core/src/iosMain/kotlin/com/easyhooon/dari/Clock.ios.ktdari-core/src/jvmMain/kotlin/com/easyhooon/dari/Clock.jvm.ktdari-noop/build.gradle.ktsdari/build.gradle.ktsdocumentation/content/docs/ko/modules.mdxdocumentation/content/docs/modules.mdxgradle/libs.versions.toml
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 4
🧹 Nitpick comments (2)
.github/workflows/kmp-core.yml (1)
40-45: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRun the common tests on an iOS simulator.
These tasks compile iOS production and test sources, but they do not execute the common tests on iOS. Add the iOS simulator test task when the
macos-15runner provides a compatible simulator.This validates the iOS clock actual and shared runtime behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/kmp-core.yml around lines 40 - 45, Add the Kotlin Multiplatform iOS simulator test execution task to the workflow’s existing iOS task list, alongside the compile tasks, using the simulator-compatible task for the macos-15 runner. Keep the current production and test compilation tasks unchanged.dari-core/build.gradle.kts (1)
10-20: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueSet the Java compile target to 11.
withJava()enables Java compilation, but this file only sets Kotlin bytecode toJvmTarget.JVM_11. The Android Java sources are not constrained to Java compatible bytecode, so use Java 11 compatibility for the Android Java compilation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dari-core/build.gradle.kts` around lines 10 - 20, Update the Android configuration near the KotlinCompile settings and kotlin.android block to set Java source and target compatibility to Java 11 alongside JvmTarget.JVM_11. Ensure the Java compilation enabled by withJava() produces Java 11-compatible bytecode.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/kmp-core.yml:
- Around line 5-20: Add "gradlew" to both paths filters in the workflow’s
pull_request and push trigger definitions so wrapper changes run KMP
verification; preserve all existing path entries.
- Line 29: Update the actions/checkout@v4 step in the workflow to set
persist-credentials to false, preventing the checkout token from being stored in
local Git configuration while leaving the rest of the checkout behavior
unchanged.
In `@dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt`:
- Around line 31-43: The DariConfig primary constructor changes must preserve
the previous JVM constructor descriptor for existing Android binaries. In
DariConfig, add the required compatibility constructor or overload using the
former parameter set and delegate new fields to their defaults; update
DariInterceptor’s affected construction or usage site only as needed to route
through the compatibility-preserving API. Ensure both old compiled callers and
new callers can instantiate DariConfig without changing existing behavior.
In `@README.md`:
- Around line 225-231: Update the README dependency snippet to avoid the
undefined dariVersion reference by using a clear version placeholder such as
<version>, or define dariVersion within the example before it is used.
---
Nitpick comments:
In @.github/workflows/kmp-core.yml:
- Around line 40-45: Add the Kotlin Multiplatform iOS simulator test execution
task to the workflow’s existing iOS task list, alongside the compile tasks,
using the simulator-compatible task for the macos-15 runner. Keep the current
production and test compilation tasks unchanged.
In `@dari-core/build.gradle.kts`:
- Around line 10-20: Update the Android configuration near the KotlinCompile
settings and kotlin.android block to set Java source and target compatibility to
Java 11 alongside JvmTarget.JVM_11. Ensure the Java compilation enabled by
withJava() produces Java 11-compatible bytecode.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8aedc6b0-156d-44b1-9344-69ff3f472c59
📒 Files selected for processing (23)
.github/workflows/kmp-core.ymlREADME.mdbuild.gradle.ktsdari-core/build.gradle.ktsdari-core/src/androidMain/kotlin/com/easyhooon/dari/Clock.android.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/Clock.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessageDirection.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessageEntry.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessagePayloadMetadata.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/MessageStatus.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.ktdari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/ProtobufDariInterceptor.ktdari-core/src/commonTest/kotlin/com/easyhooon/dari/DariConfigTest.ktdari-core/src/commonTest/kotlin/com/easyhooon/dari/MessageEntryTest.ktdari-core/src/commonTest/kotlin/com/easyhooon/dari/PublicApiCompatibilityTest.ktdari-core/src/iosMain/kotlin/com/easyhooon/dari/Clock.ios.ktdari-core/src/jvmMain/kotlin/com/easyhooon/dari/Clock.jvm.ktdari-noop/build.gradle.ktsdari/build.gradle.ktsdocumentation/content/docs/ko/modules.mdxdocumentation/content/docs/modules.mdxgradle/libs.versions.toml
🛑 Comments failed to post (1)
dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt (1)
31-43: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail config='dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt' interceptor='dari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.kt' # Inspect the predecessor declarations and the current descriptor-changing diff. git show "HEAD^:${config}" 2>/dev/null || true git show "HEAD^:${interceptor}" 2>/dev/null || true git diff HEAD^ -- "$config" "$interceptor" # Locate the repository's declared API compatibility tooling and API dumps. fd -HI '.*(api|compat|binary).*' . || true rg -n -C 3 'DariConfig|onWebToAppRequest|onAppToWebRequest|1\.7\.0' \ -g '*.kt' -g '*.kts' -g '*.api' .Repository: easyhooon/dari
Length of output: 24348
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== git history ==" git log --oneline -10 || true echo echo "== current declarations ==" cat -n dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt | sed -n '1,90p' echo cat -n dari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.kt | sed -n '1,80p' echo cat -n dari-core/src/commonMain kotlin/com/easyhooon/dari/interceptor/DefaultDariInterceptor.kt | sed -n '1,90p' echo echo "== compatibility artifacts/tooling ==" git ls-files | rg -n '(\.api$|api|binary|compat|compatibility|versioning|library|aarm|android|publish|build\.gradle|gradle\.kts)$' || true echo echo "== build config around compatibility publishing ==" for f in $(git ls-files | rg '(^|/)build\.gradle(\.kts)?|(^|/)settings\.gradle(\.kts)?$'); do echo "--- $f" rg -n -C 2 'api|compat|binary|kotlin|android|multiplatform|library|publication|publish|1\.7\.0|1\.7|compatibility' "$f" || true done echo echo "== compatibility test ==" cat -n dari-core/src/commonTest/kotlin/com/easyhooon/dari/PublicApiCompatibilityTest.kt | sed -n '1,120p' echo echo "== current refs if available ==" git tag -l | sed -n '1,80p' || true git branch -a | sed -n '1,80p' || trueRepository: easyhooon/dari
Length of output: 4816
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== build compatibility and publishing config ==" git ls-files | rg '(^|/)build\.gradle(\.kts)?$|(^|/)settings\.gradle(\.kts)?$|gradle\.properties|local\.properties|\.kotlin_module$|\.api$|api/' || true for f in settings.gradle.kts settings.gradle build.gradle.kts build.gradle gradle.properties; do if [ -f "$f" ]; then echo "--- $f ---" rg -n -C 3 'api|compat|binary|kotlin|android|multiplatform|library|publication|publish|1\.7\.0|1\.7|compatibility|maven|binaryCompatibility|apiDump|apiCheck|kotlinMultiplatform' "$f" || true fi done echo echo "== published 1.7.0 references in tracked and remote refs ==" git tag -l '1.7.0' || true git show "1.7.0:dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt" 2>/dev/null | sed -n '1,90p' || true git show "1.7.0:dari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.kt" 2>/dev/null | sed -n '1,60p' || true git branch -r 2>/dev/null | sed -n '1,80p' || true echo echo "== all DariInterceptor declarations ==" git ls-files | rg 'DariInterceptor\.kt$|DefaultDariInterceptor\.kt$|PublicApiCompatibilityTest\.kt$' | while read -r f; do echo "--- $f ---" cat -n "$f" | sed -n '1,120p' doneRepository: easyhooon/dari
Length of output: 14778
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== 1.7.0 DariConfig and DariInterceptor from origin/HEAD~1, if available ==" git show "origin/HEAD~1:dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt" 2>/dev/null | sed -n '1,90p' || true git show "origin/HEAD~1:dari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.kt" 2>/dev/null | sed -n '1,60p' || true echo echo "== exact diff for both files ==" git diff "origin/HEAD~1" -- dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt dari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.kt echo echo "== JVM descriptor probe for Kotlin primary constructor/def-arg methods ==" python3 - <<'PY' from pathlib import Path import re for path in [ "dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt", "dari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.kt", ]: text = Path(path).read_text() print(f"-- {path} --") for m in re.finditer(r'fun\s+\w+\((.*?)\)\s*(?:=|$\s*$)', text, re.S): print(m.group(0).replace("\n", " ")) # Show parameter names with defaults without executing repo code. for m in re.finditer(r'fun\s+([^\s(]+)\s*\n?\s*(.*?)\)', text, re.S): name, params = m.group(1, 2) print(name, [re.sub(r'\s*.+$', '', p.strip()) for p in params.split(',')]) PYRepository: easyhooon/dari
Length of output: 4788
Keep the existing
DariConfigconstructor descriptor while adding the new fields.Kotlin data-class arguments change the primary constructor and generated default-argument bridge. Add the compatibility wrapper/overloads so existing Android clients compiled against the previous constructor can still instantiate
DariConfig.📍 Affects 2 files
dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt#L31-L43(this comment)dari-core/src/commonMain/kotlin/com/easyhooon/dari/interceptor/DariInterceptor.kt#L17-L23🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dari-core/src/commonMain/kotlin/com/easyhooon/dari/DariConfig.kt` around lines 31 - 43, The DariConfig primary constructor changes must preserve the previous JVM constructor descriptor for existing Android binaries. In DariConfig, add the required compatibility constructor or overload using the former parameter set and delegate new fields to their defaults; update DariInterceptor’s affected construction or usage site only as needed to route through the compatibility-preserving API. Ensure both old compiled callers and new callers can instantiate DariConfig without changing existing behavior.
🤖 CodeRabbit Review ResolutionTotal unresolved: 3 | Applied: 3 | Declined: 0 ✅ Applied
❌ DeclinedNone. |
Summary
Progresses #13.
dari-coreto Kotlin Multiplatform with Android, JVM, iOS x64, iOS arm64, and iOS simulator arm64 targetscommonMainwhile preserving the existing Android public API andio.github.easyhooon:dari-coreroot coordinateCompatibility
Verification
./gradlew :dari-core:compileAndroidMain :dari-core:jvmTest :dari-core:testAndroidHostTest :dari-core:ktlintCheck./gradlew :dari:assemble :dari-noop:assemble :sample:assembleDebugSummary by CodeRabbit