Landry Norris

    Landry Norris

    7 months ago
    I’m planning on starting a project soon that will require server, desktop, cli, and maybe mobile or web, and I’d like to make it entirely in Kotlin Multiplatform. The current plan is to make a monorepo, but I’m wondering if it would be better to set it up as separate projects inside of a folder or use several modules in one project, with a module for shared code, and a module for each platform. My primary concern is that I’ll need to be able to deploy each platform (desktop, server, mobile) separately once I get that far. What is the suggested setup for something like this?
    mbonnin

    mbonnin

    7 months ago
    I'd vote for single git repo + multiple gradle modules
    Being able to share code between your backend and frontend is super nice
    You can always deploy individual modules separately
    Landry Norris

    Landry Norris

    7 months ago
    I was leaning towards modules. How is deployment when doing this? Does config get annoying?
    mbonnin

    mbonnin

    7 months ago
    It depends your workflow but I wouldn't expect anything to be too complicated
    Worst case you have to call
    ./gradlew :backend:deploy
    instead of
    ./gradlew deploy
    nothing good CI/script can handle
    Landry Norris

    Landry Norris

    7 months ago
    Since I'll be using Compose for UI, which requires a specific kotlin version, is there a good way to use newest kotlin for server/cli and a different version for desktop/mobile?
    mbonnin

    mbonnin

    7 months ago
    Ouch, I know nothing about that but that does sound like it could complicate things....
    I'd hope you can use the Compose version of Kotlin for all the rest and that in a couple of months everything becomes streamlined
    Landry Norris

    Landry Norris

    7 months ago
    I can look into it. It’s not a dealbreaker if the Kotlin version has to be the same for the platforms.
    Thank you. I think I’ll look into setting up one project with different modules. I once set up a project with one git repo that had two separate gradle projects in separate folders, but keeping models in sync got a bit annoying.
    e

    ephemient

    7 months ago
    it is possible to use different kotlin versions in different included builds, and compose a larger build out of that
    mbonnin

    mbonnin

    7 months ago
    So composite builds instead of multiple modules?
    I think I'd still try to use the same Kotlin version everywhere, sounds easier to manage and I've had some issues with IDEA + included builds
    e

    ephemient

    7 months ago
    personally, I'd split into as few composite builds as possible, because there are still some annoyances across them (e.g.
    ./gradlew test
    runs all tasks named
    test
    in the build, but not included builds)
    mbonnin

    mbonnin

    7 months ago
    Yea, running tests from included builds from IDEA is also another thing that isn't super reliable
    e

    ephemient

    7 months ago
    if you can get away with a single kotlin version for all your modules, all the better. but if not, it is possible to work around
    well, you can run
    :includedBuild:test
    without any issues, it just doesn't happen when you run an unqualified
    test
    mbonnin

    mbonnin

    7 months ago
    I'm talking in the UI + debugging
    e

    ephemient

    7 months ago
    oh I never bother with the UI 😃
    mbonnin

    mbonnin

    7 months ago
    I like clicking the green triangle and setting breakpoints with my mouse 🙂
    e

    ephemient

    7 months ago
    IIRC if you tell IntelliJ to debug a Gradle task explicitly, it does work and you can set breakpoints
    mbonnin

    mbonnin

    7 months ago
    Haven't tried recently maybe it's working now