https://kotlinlang.org logo
#gradle
Title
# gradle
a

andylamax

07/07/2022, 1:30 PM
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

Sam

07/07/2022, 1:33 PM
It came up a bit in this thread and I think a couple of workarounds may have been mentioned in the linked tickets
m

mbonnin

07/07/2022, 1:37 PM
Are you concerned about Gradle build or IDE support?
We have a MPP composite build that's working well there
a

andylamax

07/07/2022, 2:03 PM
I would love both (IDE and Gradle) to be honest. but I'll take what I can get
m

mbonnin

07/07/2022, 2:09 PM
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

andylamax

07/07/2022, 3:43 PM
@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

mbonnin

07/07/2022, 3:47 PM
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

andylamax

07/07/2022, 3:49 PM
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

mbonnin

07/08/2022, 12:33 PM
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

andylamax

07/08/2022, 1:27 PM
I'l take what I can get
m

mbonnin

07/08/2022, 1:33 PM
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

andylamax

07/08/2022, 1:46 PM
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

mbonnin

07/08/2022, 1:48 PM
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

andylamax

07/08/2022, 1:52 PM
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

mbonnin

07/08/2022, 3:04 PM
I think it doesn't have to be in build-logic but since this is all a big hack, it's hard to tell :-/
6 Views