Migrate exposed-core to multiplatform project structure#2629
Migrate exposed-core to multiplatform project structure#2629JGuck wants to merge 1 commit intoJetBrains:mainfrom
Conversation
Refactored exposed-core to use Kotlin Multiplatform, introducing commonMain and jvmMain source sets. Updated build scripts to apply the multiplatform plugin and moved source files accordingly to support multiplatform development. The global application of the kotlin-jvm plugin was removed to avoid conflicts.
|
I'm excited for this to get merged. I want to build a cross platform sync library on top of exposed, but the lack of KMM support is currently my biggest hurdle. |
@BierDav I am in the same situation, maybe we are doing the same thing, should we join the forces? :) |
|
@nikolamin yeah, definitely! Feel free to contact me on discord. It's on my profile ;) |
|
This would be the first part of having kmp support. When this will get merged we'll be able to work on the other modules! (really exited to be able to use it on mobile as well as with kotlin native on linux on server side) One thing to add: seeing you have merge conflicts, maybe try to reach the team on slack so you ensure it's good, and then apply again the changes (gradle files + folder rename) from the current main directly; will be easier than solving merge conflicts. |
|
I don't think he was really working on multiplatform support though. All sources just moved to jvmMain. I already did a real multiplatform conversation. Checkout my fork https://github.com/BierDav/Exposed (it indeed works, because i even published it once to ghcr) The core challenge was that some java Types like decimal and UUID are buried very deep in the code as well as the usage of the Java reflection Class in the API between driver and core. This makes it sometimes impossible to keep binary compatibility. But i tried my best 🥹 @maintainers if you want a PR tell me, currently there is a lot of bloat changes in my fork too, but if it won't get merged anyway it's not worth the hussle for me. |
|
Hi all and thank you @JGuck for taking the time to put together this PR & prompt this discussion. KMP support is naturally on our radar but it has not been a central goal of 1.0.0. The KMP feature is going to be a massive multi-step endeavour and we welcome the assistance of contributors, so it will very much need to be a concerted effort. The first step of that is to actually decide on the ultimate expectations of the feature and put together a plan. That's where we're at right now, the requirements gathering phase. I've updated the details on the parent issue EXPOSED-767 so you can see everything we would need to know and decide on before commencing properly. I can say right now that there are 3 major evaluations we would need to make before any promises or outlines are set:
👋 If you have any thoughts, suggestions, or answers to our questions, please feel free to add them to the parent ticket EXPOSED-767, or here if you wish. We welcome any insight into what you would like the finalized feature to look like or how you would preferably want to use it for your specific use cases. Regarding this PR specifically, I hope you can understand why it won't foreseeably be merged directly to |
|
Hi @bog-walk, thank you for the detailed explanation and for outlining the current state of the roadmap. I fully understand that proper KMP support is a large, multi-stage effort and that the project first needs clear requirements and a long-term plan before major structural changes can be merged. My intention with this PR was not to bypass that process but to take the smallest possible first step to make the transition more approachable for contributors. The motivation behind this PR is simply that exposed-core is currently JVM-only on a structural level, which makes it difficult for the community to progressively move shared logic into commonMain. Even if full multiplatform support is still far down the roadmap, preparing the module structure early enables contributors to gradually migrate code — for example utilities, the UUID implementation, or other JVM-agnostic pieces — without requiring a massive refactor all at once. So the goal of this PR is intentionally minimal:
This approach ensures stability while opening the door to incremental community contributions. Regarding some of the points you raised:
I absolutely understand that merging this PR right now may not align with the timing of your post-v1 planning. If helpful, I can keep the PR rebased and maintained while discussions continue. Thank you again for the openness, clarity, and for sharing the roadmap insights. I’m happy to contribute more once the KMP direction becomes clearer! |
|
I agree on the idea of preparing the module by switching to kmp gradle module instead of jvm gradle module, even if only the jvm target is enabled now. It prepares the project and will simplify upcoming contributions. Note about DAO: some projects use SQL DSL approach and would already benefit of the Multiplatform support even before DAO is supported. |
|
Hi @bog-walk, |
This pull request updates the
exposed-coremodule to use Kotlin Multiplatform, reorganizing dependencies and build configuration to support multiple targets. The most significant changes are the switch from JVM-only to multiplatform, and the restructuring of source sets and dependencies.Summary of the change: Provide a concise summary of this PR. Describe the changes made in a single sentence or short paragraph.
Detailed description:
To start expose as a Kotlin multiplatform project, we have to do a basic configuration. However, the whole task of migrating the core might be to big for a single PR. That's why I placed the main part of the code in jvmMain. This should be an equivalent of the previous setup. Now we can start to gradually move more and more code into the common section. This would also reduce the risk of a big bang migration.
Changed the Gradle plugin from
kotlin("jvm")tokotlin("multiplatform")inexposed-core/build.gradle.kts, enabling multiplatform support.Added the
kotlinblock withjvmtarget configuration, applied the default hierarchy template, and set upcommonMainandjvmMainsource sets with appropriate dependencies. This moveskotlin("reflect"),libs.kotlinx.jvm.datetime, andlibs.slf4jto thejvmMainsource set, whilekotlin("stdlib")andlibs.kotlinx.coroutinesare incommonMain. Refactored exposed-core to use Kotlin Multiplatform, introducing commonMain and jvmMain source sets. Updated build scripts to apply the multiplatform plugin and moved source files accordingly to support multiplatform development. The global application of the kotlin-jvm plugin was removed to avoid conflicts.Type of Change
Please mark the relevant options with an "X":
Updates/remove existing public API methods:
Affected databases:
Checklist
Related Issues
#635