-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Introduce basic Kotlin MPP project layout #77
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @TheTeXnician! This looks good to me. I've added a couple of comments on the Gradle configuration that I'm not sure about.
Also, is there a reason why some of the test files (YamlNodeReaderTest
, YamlReadingTest
and YamlWritingTest
) are in jvmTest
rather than commonTest
?
In terms of the remaining work, I think you're correct in your assessment that the main thing is to get the publishing code working before this can be merged. Is that something you're willing to look into?
build.gradle.kts
Outdated
|
||
apply { id("com.github.ben-manes.versions") version "0.36.0" } | ||
kotlin("multiplatform") version "1.4.10" | ||
id("org.jetbrains.kotlin.plugin.serialization") version "1.4.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I wasn't using it before, but it might be good to switch to the kotlin("plugin.serialization")
method here as well, as described in the kotlinx.serialization readme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Of course it should.
} | ||
val jvmMain by getting { | ||
dependencies { | ||
implementation(project.dependencies.platform("org.jetbrains.kotlin:kotlin-bom")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be applied to kotlinMain
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't know what's kotlinMain
. The source sets are named like the targets (i.e. js
, jvm
, common
, linuxX64
, …) where there is no kotlin
target. As per this forum post it seems that the platform
is nothing that's even supposed to be used in Kotlin/MPP (maybe yet). So this seems to be the currently most viable workaround.
build.gradle.kts
Outdated
implementation(project.dependencies.platform("org.jetbrains.kotlin:kotlin-bom")) | ||
implementation(kotlin("stdlib-jdk8")) | ||
implementation("org.snakeyaml:snakeyaml-engine:${Versions.snakeYaml}") | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.serialization}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be applied again if it's already in commonMain
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good catch. It does not. jvmMain
depends on commonMain
automatically.
val jvmTest by getting { | ||
dependencies { | ||
implementation("org.spekframework.spek2:spek-dsl-jvm:${Versions.spek}") | ||
implementation("ch.tutteli.atrium:atrium-fluent-en_GB:${Versions.atrium}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing again - does this need to be here if it's also in commonTest
? (I haven't worked extensively with a MPP project before, so forgive me if this is a dumb question 😄)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite the opposite. jvmTest
does not depend on commonTest
and it would not make much sense as the JVM implementations of the frameworks are usually more powerful and you don't need conflicting definitions in your classpath. I'd leave it here as it does no harm (version is centralized elsewhere…).
|
||
package com.charleskorn.kaml.build | ||
|
||
object Versions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Renovate support updating versions when configured like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know about Renovate (never heard of it) but you apply the versions
plugin which I'm also using in a number of projects configured this way. That plugin works with such a versions object.
Thanks for the comments. Great pointers to things I overlooked :)
Yes. Those tests (as far as I could see) depend on components that are JVM-only at the moment, e.g.
Unfortunately, I don't think I'll have the time at the moment. Your publishing code looks quite complex to me. I'm part of the Island of TeX which published a MPP library some weeks ago (see very simplistic build file of that publication in the repo). So if you would want to tackle it, you should ;) |
This PR tries to tackle the ROADMAP item of introducing MPP project layout. It does not do much more than renaming. I have run the tests but did not do much more. Some aspects that I have not refactored which will need refactoring:
main
does not work as that source set is empty.dokka
and using the output of thedokkaJavadoc
task.expect
andactual
classes and use other serialization libraries based on the platform.So, please see this as a starter in the direction of making kaml a MPP. If the publication code would be fixed, one could apply this layout to a JVM-only library as well until there is enough time for making it really platform-independent.