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

Nicholas Bilyk

11/25/2019, 9:53 PM
I'm having trouble with transitive runtime dependencies from a multiplatform library project. My library has runtime dependencies that need to be used by the consumer. Example:
Copy code
// My library
kotlin.sourcesets.named("jvmMain") {
  dependencies {
     runtimeOnly("$lwjglGroup:$lwjglName:$lwjglVersion:natives-$os")
  }
}
However, the consumer can't see this dependency unless it also specifies the runtimeOnly. Is there a way to make this apply without the consumer of my library needing to specify it explicitly?
d

Dominaezzz

11/25/2019, 10:27 PM
api(...)
I think.
n

Nicholas Bilyk

11/25/2019, 11:00 PM
api doesn't work. It's my understanding that api is if you expose types from the dependent library in your library's API, which I don't.
It feels to me like a bug, because if I look at the POM when I use runtimeOnly from my library, I see:
Copy code
<dependency>
      <groupId>org.lwjgl</groupId>
      <artifactId>lwjgl-glfw</artifactId>
      <version>3.2.2</version>
      <classifier>natives-linux</classifier>
      <scope>runtime</scope>
    </dependency>
Which is about what I'd expect. However, the consumer of my library doesn't have the native jars in the classpath
It only does if I list them from the consumer, but the problem with that is that the consumer then needs to know the correct natives version to use, which I'd rather be automatic for them.
2 Views