Skip to content

Conversation

@marandaneto
Copy link

@marandaneto marandaneto commented Jan 22, 2026

Description

Closes #215

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring

Testing

  • Lint passes locally
  • Added/updated tests for changes

Platform-Specific Testing (check all that apply)

Swift SDK / iOS Sample:

  • Tested on iPhone (Simulator or Device)
  • Tested on iPad / Tablet
  • Tested on Mac (macOS target)

Kotlin SDK / Android Sample:

  • Tested on Android Phone (Emulator or Device)
  • Tested on Android Tablet

Flutter SDK / Flutter Sample:

  • Tested on iOS
  • Tested on Android

React Native SDK / React Native Sample:

  • Tested on iOS
  • Tested on Android

Labels

Please add the appropriate label(s):

SDKs:

  • Swift SDK - Changes to Swift SDK (sdk/runanywhere-swift)
  • Kotlin SDK - Changes to Kotlin SDK (sdk/runanywhere-kotlin)
  • Flutter SDK - Changes to Flutter SDK (sdk/runanywhere-flutter)
  • React Native SDK - Changes to React Native SDK (sdk/runanywhere-react-native)
  • Commons - Changes to shared native code (sdk/runanywhere-commons)

Sample Apps:

  • iOS Sample - Changes to iOS example app (examples/ios)
  • Android Sample - Changes to Android example app (examples/android)
  • Flutter Sample - Changes to Flutter example app (examples/flutter)
  • React Native Sample - Changes to React Native example app (examples/react-native)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)

Screenshots

Attach relevant UI screenshots for changes (if applicable):

  • Mobile (Phone)
  • Tablet / iPad
  • Desktop / Mac

Important

Refactor Kotlin SDK build scripts by introducing shared build logic and conventions in a new build-logic directory.

  • Build Logic:
    • Introduces build-logic directory with build.gradle.kts, settings.gradle.kts, and runanywhere.conventions.gradle.kts for shared build utilities.
    • Adds resolveModulePath() function in runanywhere.conventions.gradle.kts for module path resolution.
  • Plugin Application:
    • Applies runanywhere.conventions plugin in build.gradle.kts of runanywhere-kotlin, runanywhere-core-llamacpp, and runanywhere-core-onnx.
  • Refactoring:
    • Removes resolveModulePath() function from build.gradle.kts in runanywhere-kotlin and delegates to runanywhere.conventions plugin.
    • Updates settings.gradle.kts to include build-logic for convention plugins.

This description was created by Ellipsis for 0ac9ae8. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Chores
    • Introduced shared build conventions framework to improve build consistency and maintainability across modules
    • Updated build infrastructure with centralized utilities for enhanced build configuration management

✏️ Tip: You can customize this high-level summary in your review settings.

Greptile Summary

This PR successfully extracts shared Gradle build conventions into a new build-logic plugin, eliminating code duplication of the resolveModulePath() function across Kotlin SDK modules. The implementation introduces a clean, reusable convention plugin that handles module path resolution for composite builds, reducing maintenance burden and ensuring consistent behavior across all backend modules.

Key Changes:

  • Introduced build-logic plugin infrastructure with proper settings and gradle-dsl configuration
  • Created runanywhere.conventions Gradle plugin with resolveModulePath() extension function that handles multiple composite build scenarios
  • Removed duplicate resolveModulePath() implementation from main SDK build.gradle.kts (47 lines eliminated)
  • Applied convention plugin to all modules: runanywhere-kotlin, runanywhere-core-llamacpp, and runanywhere-core-onnx
  • Updated settings.gradle.kts to include build-logic in pluginManagement

Benefits:

  • Single source of truth for module path resolution logic
  • Reduced code duplication (47 lines removed from main build script)
  • Consistent behavior across all SDK modules
  • Foundation for future shared build conventions (publishing, code quality, versioning)
  • Follows Gradle best practices for convention plugins

Confidence Score: 5/5

  • This PR is safe to merge with high confidence - it's a well-executed refactoring that eliminates duplication, follows Gradle best practices, and introduces no functional changes or breaking modifications.
  • Score reflects a clean, focused refactoring PR with: (1) proper Gradle convention plugin structure following best practices, (2) correct implementation of module path resolution logic with robust fallback handling, (3) consistent application across all modules, (4) clear documentation and comments, (5) 47 lines of code eliminated through DRY principle, (6) no functional behavior changes—purely structural improvement, (7) proper settings.gradle.kts configuration for plugin discovery.
  • No files require special attention - all changes are straightforward and well-implemented.

Important Files Changed

Filename Overview
sdk/runanywhere-kotlin/build-logic/src/main/kotlin/runanywhere.conventions.gradle.kts New shared convention plugin defining resolveModulePath() extension function. Implements robust module path resolution handling multiple composite build scenarios. Logic is correct and well-documented with clear fallback behavior.
sdk/runanywhere-kotlin/build.gradle.kts Updated to apply the runanywhere.conventions plugin (line 11). Removed 47 lines of resolveModulePath() function implementation and replaced with comment directing to convention plugin. No functional changes—pure refactoring.
sdk/runanywhere-kotlin/modules/runanywhere-core-llamacpp/build.gradle.kts Updated to apply the runanywhere.conventions plugin (line 25). Backend module now reuses shared build logic. No other changes.
sdk/runanywhere-kotlin/modules/runanywhere-core-onnx/build.gradle.kts Updated to apply the runanywhere.conventions plugin (line 29). Backend module now reuses shared build logic. No other changes.
sdk/runanywhere-kotlin/settings.gradle.kts Updated pluginManagement block to include build-logic (line 3). Enables convention plugins for all modules. Configuration correct and matches Gradle composite build best practices.

Sequence Diagram

sequenceDiagram
    participant Settings as settings.gradle.kts
    participant BuildLogic as build-logic Plugin
    participant Convention as runanywhere.conventions
    participant MainBuild as Main SDK Build
    participant BackendBuild as Backend Modules Build

    Settings->>BuildLogic: includeBuild("build-logic")
    BuildLogic->>Convention: Registers convention plugin
    Convention->>Convention: Defines resolveModulePath()

    MainBuild->>Convention: applies id("runanywhere.conventions")
    Convention->>MainBuild: Provides resolveModulePath() extension

    BackendBuild->>Convention: applies id("runanywhere.conventions")
    Convention->>BackendBuild: Provides resolveModulePath() extension

    MainBuild->>MainBuild: Uses resolveModulePath("core-llamacpp")
    BackendBuild->>BackendBuild: Can also use resolveModulePath() if needed

    Convention->>Convention: Resolves paths for composite builds<br/>(SDK as root or subproject)
Loading

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

Introduces a new Gradle build-logic module that extracts the duplicated resolveModulePath function into a reusable convention plugin, eliminating duplication across the RunAnywhere Kotlin SDK modules and providing a single source of truth for module path resolution.

Changes

Cohort / File(s) Summary
Build Logic Infrastructure
sdk/runanywhere-kotlin/build-logic/build.gradle.kts, sdk/runanywhere-kotlin/build-logic/settings.gradle.kts, sdk/runanywhere-kotlin/build-logic/src/main/kotlin/runanywhere.conventions.gradle.kts
Establishes new build-logic module with Gradle configuration, settings, and introduces runanywhere.conventions plugin containing Project.resolveModulePath(moduleName: String) extension function for shared module path resolution
Root Configuration Updates
sdk/runanywhere-kotlin/build.gradle.kts, sdk/runanywhere-kotlin/settings.gradle.kts
Applies new convention plugin to root build, removes local resolveModulePath implementation, and includes build-logic module via includeBuild()
Module Plugin Application
sdk/runanywhere-kotlin/modules/runanywhere-core-llamacpp/build.gradle.kts, sdk/runanywhere-kotlin/modules/runanywhere-core-onnx/build.gradle.kts
Applies runanywhere.conventions plugin to enable shared build utilities across backend modules

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

kotlin-sdk

Poem

🐰 A rabbit hops through build files with glee,
Extracting shared logic—finally DRY!
No more duplication, just conventions so clean,
Module paths resolved by the best Gradle seen! 🔨✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: build logic conventions' accurately and concisely summarizes the main change: introducing shared build conventions in the build-logic module.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #215: creates build-logic module with runanywhere.conventions plugin, adds resolveModulePath extension function with identical logic, applies plugin to all three modules, and removes duplicate code.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #215 objectives: build-logic creation, convention plugin introduction, resolveModulePath extraction, and plugin application to relevant modules. No extraneous modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The PR description follows the template structure with all key sections completed: description links to issue #215, type of change is marked as refactoring, testing and labels sections are filled out (with appropriate checkboxes), and includes a detailed IMPORTANT note explaining the refactoring objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@marandaneto marandaneto changed the title chore/build conventions chore: build logic conventions Jan 22, 2026
@marandaneto marandaneto marked this pull request as ready for review January 22, 2026 20:41
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 0ac9ae8 in 1 minute and 6 seconds. Click for details.
  • Reviewed 177 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 7 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. sdk/runanywhere-kotlin/build-logic/build.gradle.kts:6
  • Draft comment:
    Kotlin DSL and reproducibility config look good. Consider parameterizing 'allWarningsAsErrors' if flexibility is needed.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
2. sdk/runanywhere-kotlin/build-logic/settings.gradle.kts:1
  • Draft comment:
    Settings file correctly sets the root project name and repositories for dependency resolution.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. sdk/runanywhere-kotlin/build-logic/src/main/kotlin/runanywhere.conventions.gradle.kts:30
  • Draft comment:
    The shared 'resolveModulePath' function is cleanly extracted with clear documentation and proper fallbacks. This centralizes the module path logic.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. sdk/runanywhere-kotlin/build.gradle.kts:11
  • Draft comment:
    Removal of the local module path resolution function in favor of applying the 'runanywhere.conventions' plugin simplifies composite build configuration.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
5. sdk/runanywhere-kotlin/modules/runanywhere-core-llamacpp/build.gradle.kts:25
  • Draft comment:
    Consistently applying the 'runanywhere.conventions' plugin improves maintainability by centralizing module path resolution.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
6. sdk/runanywhere-kotlin/modules/runanywhere-core-onnx/build.gradle.kts:7
  • Draft comment:
    Applying the 'runanywhere.conventions' plugin to the ONNX module removes duplication and ensures consistent module path resolution.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
7. sdk/runanywhere-kotlin/settings.gradle.kts:1
  • Draft comment:
    Including the 'build-logic' build in pluginManagement ensures the shared conventions plugin is accessible across modules. The module inclusions for backends are also correctly configured.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_Z6sqWKjdLdQ83Aud

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@marandaneto
Copy link
Author

cc @sanchitmonga22

@Siddhesh2377
Copy link
Contributor

Siddhesh2377 commented Jan 23, 2026

Hey Dude , review my PR before making one, cause i have also made some changes in build system
#289
cc : @marandaneto
No to be rude, just asking, i mean it should not cause any conflicts 😊

@shubhammalhotra28
Copy link
Contributor

@coderabbitai please review

@shubhammalhotra28
Copy link
Contributor

@greptile please review

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

@shubhammalhotra28, I'll review the changes in this PR.


🧠 Learnings used
Learnt from: Siddhesh2377
Repo: RunanywhereAI/runanywhere-sdks PR: 289
File: build.gradle.kts:97-100
Timestamp: 2026-01-22T06:26:15.460Z
Learning: In the RunanywhereAI/runanywhere-sdks repository, the module path `:RunAnywhereAI:sdk:runanywhere-kotlin` in build.gradle.kts tasks correctly resolves to the SDK module located at `sdk/runanywhere-kotlin/`, even though settings.gradle.kts uses `include(":runanywhere-kotlin")`. This configuration has been verified to work correctly in Android Studio and other build environments.
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@marandaneto
Copy link
Author

Hey Dude , review my PR before making one, cause i have also made some changes in build system #289 cc : @marandaneto No to be rude, just asking, i mean it should not cause any conflicts 😊

sorry just saw this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract resolveModulePath to shared Gradle build logic

3 participants