How comes that `commonMain/kotlin` is recognized a...
# multiplatform
m
How comes that
commonMain/kotlin
is recognized as a source folder and
androidMain/kotlin
is not? The Gradle view in IntelliJ also doesn't list any Android source sets 😞 https://gist.github.com/fluidsonic/04f7b15c4bc5263cd5f82632697804a4
r
The android target is a bit special. You have to configure it with the android gradle plugin. See one example here https://gist.github.com/Ribesg/95a172ceb2177d74cf5b15993d40092e#file-build-gradle-kts-L27-L34
m
That helps, thanks! The folder is now correct, but IntelliJ still refuses to list the source set 🤔
r
Well I don’t have the right icon but everything works and the contained
kotlin
folder is automatically marked as a source directory, so it’s enough for me
m
nope, file isn't checked for errors and source set isn't listed 😕
r
The gist I linked is what I have and I have no problems. The sourceSet doesn’t show up in the Gradle tab either, but who cares. I have IDE support in it anyway.
m
Looks like that Android Studio is doing some non-Gradle magic here because it works there but not in IntelliJ 🙄
k
well, AS does utilize the android gradle plugin, so that's not entirely surprising
m
I wonder if there is a way to force the Source Set to become visible to IntelliJ 🤔
k
i had some other funny business when building with intellij at first. I had to check a box to force it to delegate to gradle in Preferences
m
Copy code
val sourceSetToCompilationData = LinkedHashMap<KotlinSourceSet, MutableSet<GradleSourceSetData>>()
for (target in mppModel.targets) {
    if (target.platform == KotlinPlatform.ANDROID) continue
ugh!
r
I’m not using AS.
m
I wonder what the difference is which causes that 😞 https://gist.github.com/fluidsonic/04f7b15c4bc5263cd5f82632697804a4
r
androidMain
already depends on
commonMain
👌 1
You can also try to completely delete your IDEA project and reimport your Gradle project
m
tried already, didn't help though 😕
r
I’m also using Gradle 5.2.1 and Android Gradle Plugin 3.2.1 because more recent versions of both are bugged
m
Yeah I saw that and tried 3.2.1 too. doesn't help either
r
After rollbacking the android gradle plugin you need to clean your project (remove
.gradle
and
build
folders then invalidate cache and restart)
Sorry, I meant Gradle 5.1.1, 5.2.1 is the buggy one
m
😵 I guess I'll just start over later today and check if that helps.