https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
e

egorand

06/09/2019, 2:05 AM
I tried providing an explicit
extendsFrom
value to the custom configuration, but it didn’t seem to work for
implementation
or
compile
d

Dico

06/09/2019, 6:19 AM
You need to publish separate artifacts. If you can use
project
notation, you can do
project(":name", "jvmMainApiElements")
e

egorand

06/09/2019, 2:32 PM
I don’t think that
project
notation works for Maven artifacts
t

tapchicoma

06/09/2019, 8:21 PM
I would suppose you should use either jvm specific library artifact (if there is one) or use Gradle metadata variants: https://docs.gradle.org/current/userguide/feature_variants.html#sec::consuming_feature_variants I haven't tried to use Gradle variants myself, so further is just my assumptions. For example you want to consume jvm variant of sqldelight runtime (for whatever reason). It has following gradle metadata: https://oss.sonatype.org/content/repositories/snapshots/com/squareup/sqldelight/runtime-jvm/1.2.0-SNAPSHOT/runtime-jvm-1.2.0-20190425.151844-34.module So requesting it as a dependency may look following:
Copy code
cli("com.squareup:sqldelight-runtime:1.2.0") {
   capabilities {
       requireCapability "com.squareup:sqldelight-runtime-jvm-runtime"
    }
}
e

egorand

06/09/2019, 8:22 PM
Looks like this could work! I'll give it a go and report back. Thanks!
tried your suggestion, the problem is that the metadata for the JVM artifact declares 3 variant, which Gradle then can’t choose from:
Copy code
Cannot choose between the following variants of com.squareup.sqldelight:runtime-jvm:1.2.0-SNAPSHOT:
          - jvm-api
          - jvm-runtime
          - metadata-api
they all declare the same capability
Copy code
All of them match the consumer attributes:
          - Variant 'jvm-api' capability com.squareup.sqldelight:runtime-jvm:1.2.0-SNAPSHOT:
              - Unmatched attributes:
                  - Found org.gradle.status 'integration' but wasn't required.
                  - Found org.gradle.usage 'java-api-jars' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
          - Variant 'jvm-runtime' capability com.squareup.sqldelight:runtime-jvm:1.2.0-SNAPSHOT:
              - Unmatched attributes:
                  - Found org.gradle.status 'integration' but wasn't required.
                  - Found org.gradle.usage 'java-runtime-jars' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
          - Variant 'metadata-api' capability com.squareup.sqldelight:runtime-jvm:1.2.0-SNAPSHOT:
              - Unmatched attributes:
                  - Found org.gradle.status 'integration' but wasn't required.
                  - Found org.gradle.usage 'kotlin-api' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'common' but wasn't required.
what does look different is the value for
org.gradle.usage
, but I couldn’t find a way to filter by this attribute
t

tapchicoma

06/10/2019, 4:45 PM
At Gradle slack I was advised to try following notation of capability:
Copy code
requireCapability "com.squareup.sqldelight:runtime-jvm"
e

egorand

06/10/2019, 5:05 PM
yeah, I pinged Gradle Slack too, feel like I have enough to work with
I think
requireCapability
won’t work since all JVM variants declare the same capability
k

Kirill Zhukov

07/04/2019, 12:28 AM
@egorand were you able to solve this?
e

egorand

07/04/2019, 1:44 AM
I have! DM if you still need help
❤️ 1
3 Views