Repository: sqldelight/sqldelight

Issue #2070: Table dependency not working. Getter not implemented on the final merged interface implementation
Created: 2020-10-27T03:07:08Z
:app
sqldelight {
    AppDatabase {
        packageName = "sk.foo.app"
        dependency project(":install:impl")
    }
}

import sk.foo.install.AppDatabase as AppDatabase0

interface AppDatabase : Transacter, AppDatabase0 {
  val dummyQueries: DummyQueries

  companion object {
    val Schema: SqlDriver.Schema
      get() = AppDatabase::class.schema

    operator fun invoke(driver: SqlDriver): AppDatabase = AppDatabase::class.newInstance(driver)}
}

internal val KClass<AppDatabase>.schema: SqlDriver.Schema
  get() = AppDatabaseImpl.Schema

internal fun KClass<AppDatabase>.newInstance(driver: SqlDriver): AppDatabase =
    AppDatabaseImpl(driver)

private class AppDatabaseImpl(
  driver: SqlDriver
) : TransacterImpl(driver), AppDatabase {
  override val dummyQueries: DummyQueriesImpl = DummyQueriesImpl(this, driver)

  ///////// installdQueries missing here ///////////////

  object Schema : SqlDriver.Schema {
    override val version: Int
      get() = 1

    override fun create(driver: SqlDriver) {
      driver.execute(null, """
          |CREATE TABLE dummy (
          |    value TEXT
          |)
          """.trimMargin(), 0)
    }

    override fun migrate(
      driver: SqlDriver,
      oldVersion: Int,
      newVersion: Int
    ) {
    }
  }
}

private class DummyQueriesImpl(
  private val database: AppDatabaseImpl,
  private val driver: SqlDriver
) : TransacterImpl(driver), DummyQueries

:install:impl
sqldelight {
    AppDatabase {
        packageName = "sk.foo.install"
    }
}

package sk.foo.install

import com.squareup.sqldelight.Transacter
import com.squareup.sqldelight.db.SqlDriver
import sk.o2.install.impl.newInstance
import sk.o2.install.impl.schema

interface AppDatabase : Transacter {
  val installIdQueries: InstallIdQueries

  companion object {
    val Schema: SqlDriver.Schema
      get() = AppDatabase::class.schema

    operator fun invoke(driver: SqlDriver): AppDatabase = AppDatabase::class.newInstance(driver)}
}

The final AppDatabase implementa AppDatabase0 correctly. However the AppDatabaseImpl doesnt implement the AppDatabase0 getter
Class 'AppDatabaseImpl' is not abstract and does not implement abstract member public abstract val installIdQueries: InstallIdQueries defined in sk.foo.app.AppDatabase

Am I doing something wrong?

Duplicate issue #1360: Dependencies with mismatched product flavors don't work 
Created: 2019-06-10T17:59:01Z
Two gradle modules: app and pending-actions. app depends on pending-actions via
sqldelight {
    MainDatabase {
        packageName = "myapp.persistence"
        sourceFolders = ["sqldelight"]
        dependency project (':pending-actions')
    }
}

build.gradle in the app defines two product flavours: internal and external
pending-actions's build.gradle doesn't define any flavours at all.
Trying to build the project I'm getting a compilation error
Class 'MainDatabaseImpl' is not abstract and does not implement abstract member public abstract val pendingActionsQueries: PendingActionsQueries defined in myapp.persistence.MainDatabase
If I add the same product flavours to depended pending-actions everything works great.

Closing comment (2022-04-16T22:46:08Z): dup of #2070