Composite builds? Is it known to not work? Any wor...
# multiplatform
d
Composite builds? Is it known to not work? Any work-arounds? (
publishToMavenLocal
is a last resort.)
1
d
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
I should have been more specific. My project builds with gradle but IntelliJ marks everything as red.
a
I assume it's a known problem https://youtrack.jetbrains.com/issue/KT-30285 (see also related issues)
n
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
Interesting, is the sym link strictly necessary?
n
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)