sqldelight: duplicated commonCommonMain module created

SQLDelight Version

1.5.4

Operating System

windows 10

Gradle Version

7.4.2

Kotlin Version

1.8.0-Beta

Dialect

postgresql

AGP Version

No response

Describe the Bug

While build project I’ve got compile error because 2 similar modules created with different names: commonMain and commonCommonMain

image

Stacktrace

No response

Gradle Build Script

val kotlin_version = "1.8.0-Beta"
plugins {
    kotlin("multiplatform") version "1.8.0-Beta"
    kotlin("plugin.serialization") version "1.8.0-Beta"
    application
    id("com.squareup.sqldelight") version "2.0.0-SNAPSHOT"
}


group = "com.rhythmix"
version = "1.0-SNAPSHOT"
val jacksonVersion = "2.13.3"
val napierVersion = "2.6.1"
val ktor_version = "2.2.1"
val sqlDelightVersion = "1.5.4"
val coroutinesVersion = "1.6.4"

repositories {
    jcenter()
    mavenCentral()
    maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
    maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}

kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
            kotlinOptions.languageVersion = "1.8"
        }
        withJava()
        testRuns["test"].executionTask.configure {
            useJUnitPlatform()
        }
    }
    js(LEGACY) {
        binaries.executable()
        browser {
            commonWebpackConfig {
                cssSupport {

                }
            }
        }
    }
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0-RC")
                implementation("io.github.pdvrieze.xmlutil:serialization:0.84.2")
                implementation("io.fluidsonic.locale:fluid-locale:0.11.0")//https://github.com/fluidsonic/fluid-locale
                implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
                implementation("io.github.aakira:napier:$napierVersion")
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val jvmMain by getting {
            dependencies {
                implementation("io.ktor:ktor-server-core:$ktor_version")
                implementation("io.ktor:ktor-server-netty:$ktor_version")
                implementation("io.ktor:ktor-serialization:$ktor_version")
                implementation("io.ktor:ktor-server-cors:$ktor_version")
                implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
                implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
                implementation("io.ktor:ktor-server-html-builder-jvm:$ktor_version")

                implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
                implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version")
                implementation("com.fasterxml.jackson.core:jackson-core:$jacksonVersion")
                implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion")
                implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
                implementation ("com.squareup.sqldelight:jdbc-driver:$sqlDelightVersion")
                implementation("org.postgresql:postgresql:42.5.1")
            }
        }
        val jvmTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val jsMain by getting {
            dependencies {
                implementation(enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:1.0.0-pre.462"))

                implementation("org.jetbrains.kotlin-wrappers:kotlin-react:18.2.0-pre.462")
                implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:18.2.0-pre.462")
                implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom:6.3.0-pre.462")

                implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion:11.10.5-pre.462")
            }
        }
        val jsTest by getting {
            dependencies {
            }
        }
    }

}


sqldelight {
    database("Database") {
        packageName = "rhythmix"
        sourceFolders = listOf("sqldelight")
        dialect = "postgresql"
    }
}


application {
    mainClass.set("com.rhythmix.ServerKt")
}

tasks.named<Copy>("jvmProcessResources") {
    val jsBrowserDistribution = tasks.named("jsBrowserDistribution")
    from(jsBrowserDistribution)
}

tasks.named<JavaExec>("run") {
    dependsOn(tasks.named<Jar>("jvmJar"))
    classpath(tasks.named<Jar>("jvmJar"))
}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 12
  • Comments: 17

Most upvoted comments

release will be out soon

Have the same problem! kotlin 1.8.0

@AlecStrong issue still can be reproduced after update to 1.5.5

I tried this with 2.0.0-SNAPSHOT and Kotlin 1.8.0 and have the same problem.

As noted in #3738, Sqldelight v1.5.5 contains a fix for this. For now, I’ve got it to work by disabling sourceSet-specific tasks for sources other than commonMain. I’ve done this by adding this code to my build.gradle.kts.

afterEvaluate {
    for (task in tasks) {
        if (task.group != "sqldelight") continue
        if (task.name == "generateSqlDelightInterface" || task.name == "verifySqlDelightMigration") {
            continue
        }

        if (
            !task.name.startsWith("generateCommonMain") &&
            !task.name.startsWith("verifyCommonMain")
        ) {
            task.enabled = false
        }
    }
}

Don’t forget to run clean task for the database module or delete its build folder manually.

I can’t provide you with an example because that was in a big project but all I did was switching to the latest version 2.0.0-alpha04. This made it necessary to change all package names from com.squareup.cash to app.cash.sqldelight though.