https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Dominaezzz

07/01/2019, 10:59 PM
Composite builds? Is it known to not work? Any work-arounds? (
publishToMavenLocal
is a last resort.)
1
d

Dico

07/02/2019, 6:13 AM
You are talking about includeBuild I assume
That doesn't allow using the same
project
notation
Instead you should use
dependencySubstitution
in settings.gradle.kts
I reckon you can Google now that you know what you're looking for
d

Dominaezzz

07/02/2019, 7:10 AM
I should have been more specific. My project builds with gradle but IntelliJ marks everything as red.
a

Alexey Belkov [JB]

07/02/2019, 8:45 AM
I assume it's a known problem https://youtrack.jetbrains.com/issue/KT-30285 (see also related issues)
n

Nicholas Bilyk

07/09/2019, 4:46 PM
This burned me as well. I've found that if the app project is jvm and not multi-platform, composite projects work fine (even if the library is multi-platform), it's only multi-platform app projects that have trouble. I figured out an incredibly hacky workaround. 1) If your library is multi-project, then don't use project dependencies in your multi-platform multi-project library, use coordinates. 2) Create a sym-link to the library source within your app. Include the library projects in your settings.gradle.kts 3) Use dependency substitution to replace the module dependencies with project ones.
d

Dominaezzz

07/09/2019, 4:53 PM
Interesting, is the sym link strictly necessary?
n

Nicholas Bilyk

07/09/2019, 4:54 PM
I'm new to gradle, but I didn't think there was a way to include a sub-project unless it was relative to the root project
so the sym-link lets me have multiple app projects that do this hacky composite builds using the same library project
As I said, I'm new to gradle 🙂 Turns out the sym-link isn't necessary, you can do something like:
Copy code
include(":otherproject:blah")
project(":otherproject:blah").projectDir = file("../../otherproject/blah")
and of course this isn't a true composite workaround -- you don't get the build setup for that other project. (It doesn't follow its settings.gradle.kts, etc)