Hi there, I am using SQLDelight and I am trying t...
# squarelibraries
a
Hi there, I am using SQLDelight and I am trying to setup a dependency between two database (defined with the sqldelight gradle plugin). I followed the documentation and it shows clearly how to do this on a gradle subproject. There are two ways to setup these kind of dependencies
Copy code
fun dependency(dependencyProject: Project)
fun dependency(delegatedProject: DelegatingProjectDependency)
The issue that I have here is that, the dependencies are defined inside a composite build (not just a subproject). And I am having a hard time getting an instance of that subproject. If anyone can help me how to achieve this, I will greatly appreciate
I have attempted the following solutions
Copy code
dependency(project(":included-build:subproject"))
Gradle screams by saying
project ":included-build:subproject"
could not be found I have tried also tried adding the dependency sql directory as a sourceSet to the dependent but looks like sqldelight doesn't pick up sourceSets that go beyond the parent's directory
Copy code
val ib = gradle.includedBuild("overwatch-core")
val src = ib.projectDir.resolve("dtos/src/commonMain/sql")
srcDirs(src.path, "src/commonMain/sql")
Doesn't fail, but just sources aren't being picked up.
h
It’s not yet supported: https://github.com/sqldelight/sqldelight/issues/3952 We don’t use Gradle variants for database dependencies yet.
a
but gradle are subprojects supported? right?
h
What do you mean?
a
I mean, right now, you can do this
Copy code
databases {
   create("OverwatchPersonalDatabase") {
      generateAsync = true
      packageName = "overwatch"
      dependencies(project(":subproject"))
   }
}
And it seems to work
h
Yeah, but is quite a hack and not supported with composite builds or published dependencies.