My trying to publish a multimodule and multiplatfo...
# multiplatform
m
My trying to publish a multimodule and multiplatform library. I believe my gradle configuration is pretty standard and I'm using the hierarchical project structure.
Copy code
kotlin {
    ios()
    jvm()
    android {
        publishAllLibraryVariants()
    }

    sourceSets {
        @Suppress("UNUSED_VARIABLE")
        val commonMain by getting {
            dependencies {
            }
        }

        @Suppress("UNUSED_VARIABLE")
        val commonTest by getting {
            dependencies {
                implementation(project(":test-common"))
                implementation(project(":pangea-data-test-support"))
            }
        }

        @Suppress("UNUSED_VARIABLE")
        val jvmMain by getting {
            kotlin.srcDir("src/jvmMainCommon/kotlin")
            dependencies {
            }
        }

        @Suppress("UNUSED_VARIABLE")
        val jvmTest by getting {
            kotlin.srcDir("src/jvmTestCommon/kotlin")
        }

        @Suppress("UNUSED_VARIABLE")
        val androidMain by getting {
            dependencies {
            }
        }

        @Suppress("UNUSED_VARIABLE")
        val androidTest by getting {
            dependencies {
            }
            resources.srcDir("src/commonTest/resources")
        }
    }
}
Once I apply the
maven-publish
plugin the builds start to break. The
compileIosMainKotlinMetadata
task fails due to unresolved reference to class that in in the common source set dependencies when that class is accessed from the
iosMain
directory. Seems related to https://youtrack.jetbrains.com/issue/KT-42387 but the work around mentioned there is not helpful. I tried disabling hierarchical settings and then it complained that source set
commonTest
is part of several compilations
[debugAndroidTest, debugUnitTest, releaseUnitTest, test]
If I disable the iOS target then everything else builds and gets published, but I still want to be able to publish the iOS klibs so that is not really a solution. Does anyone know how to work around this metadata issue?