Kotlin / binary-compatibility-validator

Public API management tool
Apache License 2.0
828 stars 59 forks source link

KLib dumps merge: support dumps with different library names #249

Open fzhinkin opened 4 months ago

fzhinkin commented 4 months ago

Currently, KLib dumps generated for several targets won't be merged with an error if these dumps contain different "unique library names".

In some cases, namely Kotlin Stdlib, the same library may use different unique names depending on the target.

It's worth considering how such a case could be handled by the BCV.

hfhbd commented 2 months ago

We at sqldelight got the same error, we use the (deprecated) archivesBaseName to specify the js module name: https://github.com/cashapp/sqldelight/pull/5444/files#r1750539059

A failure occurred while executing kotlinx.validation.KlibMergeAbiWorker
      > File header doesn't match the header of other files
        [// Rendering settings:, // - Signature version: 2, // - Show manifest properties: true, // - Show declarations: true, , // Library unique name: <app.cash.sqldelight:sqldelight-primitive-adapters>]

        [// Rendering settings:, // - Signature version: 2, // - Show manifest properties: true, // - Show declarations: true, , // Library unique name: <app.cash.sqldelight:primitive-adapters>]

The solution for our use-case for JS

kotlin {
  js {
    moduleName = "sqldelight-primitive-adapters"
  }
}

does not work with convention plugins (will create a youtrack issue too: https://youtrack.jetbrains.com/issue/KT-71362/KGP-JS-moduleName-is-not-compatible-with-convention-plugins).

ZacSweers commented 2 months ago

Here is another repro: https://github.com/amzn/kotlin-inject-anvil/pull/38