Amper's 0.1.0 option to use gradle's kmp directory...
# amper
r
Amper's 0.1.0 option to use gradle's kmp directory structure via (
Copy code
module.layout: gradle-kmp) seems not working.
No matter what, ,I cannot have the equivalent of 'commonMain/kotrlin
when working on library with a single platform.
a
Hi! Can you please throw a reproducer? Or maybe a bit more detailed explanation? I removed android platform in
gradle-migration-kpm
example and project imported successfully, also
commonMain/kotlin
directory was recognized as source set.
r
Hi @Alexander Tsarev I think it was my bad. I had the impression that
commonMain
, in multiplatform plugin or in amper , somehow, is restricted to a subset of Kotlin common among any platform. It seems that this is not the case, since what is content of commonMain depends on the declared targets. For instance, when targeting only JVM you can use java in commonMain. The same is true if you target both JVM or Android. BTW, I was not able to locate a description of the above behavior neither for multiplatform plugin nor for amper. I wish amper had a more "predictable" approach. That is to, • reserve
src
&
test
for common code • use src@platform for platform specific code
🙏 1
a
AFAIK, for now (at least for KMP in Gradle) the situation in short is like this: If some source set is shared among platforms, that KMP gradle plugins tries its best to find a subset of API that matches these platforms
So, basically you want restricted (kind of) api in common to be able to gradually increase the amount of platform code, yet being calm about common, since no errors will arise there?
plus1 1
r
Exactly. Imagine that I have a library targeting just JVM (no mutliplatform) that I want to port it to kmp AND, for some reason, I don't know beforehand which additional targets will be added.
a
Thanks for the case!