x - posting here because I think it is relevant. ...
# gradle
a
x - posting here because I think it is relevant. Is any one here using gradle composite build as dependency substitutors for kotlin multiplatform projects with success? Any workaround is welcomed
s
It came up a bit in this thread and I think a couple of workarounds may have been mentioned in the linked tickets
m
Are you concerned about Gradle build or IDE support?
We have a MPP composite build that's working well there
a
I would love both (IDE and Gradle) to be honest. but I'll take what I can get
m
IDE supports is hit&miss but Gradle works fine in my experience (even if it's not 100% supported apparently). Do you have a specific error when building?
a
@mbonnin I am getting resolution errors
Copy code
> Task :authenticator-core:compileCommonMainKotlinMetadata FAILED
e: /media/andylamax/Auxilliary/Workspace/PiCortex/home/authenticator/core/src/commonMain/kotlin/authenticator/ProfileServiceCore.kt: (3, 17): Unresolved reference: RequestBody
. . .
Funny thing is the following tasks all do compile successfully • compileKotlinMetadata • compileKotlinJvm • compileKotlinJs
m
I've seen this one. I'm on mobile right now but if you search "compileCommonMainMetadata" on this slack you should find something
Tldr: you can disable the task and you'll be fine
a
ooooh, let me try that approach then
@mbonnin, thanks a lot. Just disabling that task, seemed to work. Next, how do I get IDEA to play well now? Any hints/clues?
👍 1
m
That's a lot more complicated story....
If you looking at https://github.com/apollographql/apollo-kotlin/tree/main/tests we do some hacks based on "idea.sync" property to use different versions of Kotlin
It's working but quite a hack
a
I'l take what I can get
m
Look for constructs like
Copy code
System.getProperty("idea.sync.active") == null
The idea is to use 1.6.10 during IDEA sync and a newer version at build time
a
Its a big repo. How do I make idea use kotlin 1.6.10 after checking ?
Copy code
System.getProperty("idea.sync.active") == null
do I apply a different kotlin plugin?
m
Yea mostly
But as you said, there's a lot of details. Especially, if you're using AGP you might have issues no matter what
a
Good new is I am not using AGP
I currently have it like this
Copy code
plugins {
    if (System.getProperty("idea.sync.active") == null) {
        println("Idea is not syncing")
        kotlin("multiplatform") version "1.7.0" apply false
    } else {
        println("Idea is syncing")
        kotlin("multiplatform") version "1.6.10" apply false
    }
}
Tried in IDEA and AS to no avail. I realize appollo is doing the checking in a build-logic module. Is that the rout I should take as well?? or same principles should apply?
m
I think it doesn't have to be in build-logic but since this is all a big hack, it's hard to tell :-/