Kotlin / kotlinx.serialization

Kotlin multiplatform / multi-format serialization
Apache License 2.0
5.44k stars 623 forks source link

Depending on locally built release in KMP Project #2408

Closed JesusMcCloud closed 1 year ago

JesusMcCloud commented 1 year ago

Describe the bug We are currently extending the CBOR serializer (upstreaming already started, more to come). As we depend on our WIP features in another project, we included the out fork as a composite build (with some temp. tweaks to make it work with Gradle 8.0).

If we try to publish our library that depends on our fork (be it through a composite build, or a release published to maven local, we get hundreds of errors along the lines of:

  - Variant 'metadataSourcesElements' capability org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.6.0-SNAPSHOT:
      - Incompatible because this component declares a usage of 'kotlin-runtime' of documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
      - Other compatible attributes:
          - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
          - Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_arm64')

We can develop "just fine", because idea still manages to import the project, but not without spewing those errors all over the place. However, we cant build an XCFramework for iOS, as only the JVM target builds.

To be clear, publishToMavenLocal works for kotlinx.serialization

To Reproduce

Recursively clone https://github.com/a-sit-plus/kmm-vc-library using branch tmp/morebuildsystemtests and import it into IDEA or try to publish or build an XCFramework (see also the output of the workflow trying to build an XCFramework for that branch)

Expected behaviour Building works.

Environment

sandwwraith commented 1 year ago

Did you pass -Pnative.deploy=true to Gradle as it says here? Alternatively, you can change this value in gradle.properties

JesusMcCloud commented 1 year ago

🤦🤦🤦 I did not 🤦🤦🤦 Thank you very much! I'll try to return the favour by upstreaming a clean and efficient implementation of all features required for COSE compliance