Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

IDE can't find import in KMP module's commonMain source set #6

Closed
edenman opened this issue Nov 12, 2020 · 6 comments
Closed

IDE can't find import in KMP module's commonMain source set #6

edenman opened this issue Nov 12, 2020 · 6 comments
Labels
kotlin-bug A bug in Kotlin

Comments

@edenman
Copy link

edenman commented Nov 12, 2020

I've added the plugin to both my android app module and my KMP module but the import for the Exhaustive annotation can't be found in the KMP module's commonMain source set. It works fine in the androidMain source set.

https://github.com/edenman/kmpPlayground/compare/edenman/exhaustive-when

@JakeWharton
Copy link
Member

What task are you running? Doing gw :app:build is successful. Doing a full build fails in yarn about an invalid module name.

@edenman
Copy link
Author

edenman commented Nov 16, 2020

Hm, I just meant AndroidStudio can't resolve the import in FooProvider

@edenman
Copy link
Author

edenman commented Nov 16, 2020

I've never actually built this thing for js/iOS, it's just sort of a stub project to show off stuff that is weird about KMP

@edenman
Copy link
Author

edenman commented Nov 16, 2020

I wonder if "The @exhaustive annotation will be made available in your main and test source sets" means that it just finds the androidMain source set and doesn't add the dep to commonMain?

@JakeWharton
Copy link
Member

I think it's an IDE plugin bug.

The classpaths all appear correct with the dependencies task and as I said a normal compile works.

If you add the annotation dependency manually to commonMain as compileOnly("app.cash.exhaustive:exhaustive-annotation:0.1.1") it will resolve. The Gradle plugin does this automatically, which is why we can see it in the dependencies task, but it seems like the IDE doesn't see that for some reason.

I created https://youtrack.jetbrains.com/issue/KT-43385 to track. Closing this unless they come back with changes needed on our side.

@JakeWharton
Copy link
Member

Going to leave this open, actually. It's super annoying and I expect others to run into it.

@JakeWharton JakeWharton reopened this Nov 20, 2020
@JakeWharton JakeWharton added the kotlin-bug A bug in Kotlin label Nov 20, 2020
@JakeWharton JakeWharton changed the title Can't find import in KMP module's commonMain source set IDE can't find import in KMP module's commonMain source set Nov 25, 2020
@JakeWharton JakeWharton closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kotlin-bug A bug in Kotlin
Projects
None yet
Development

No branches or pull requests

2 participants