Selecting between Static and Shared usage

plugins
not-a-bug
native

(Shahji) #1

Assuming a “project A” generates both static and shared artifact, how do I select which one to use when consuming

// Project A

group = "com.whatever"
library {
    linkage = [ Linkage.SHARED, Linkage.STATIC]
}

// Project B

library {
    linkage = [ Linkage.SHARED ]

    dependencies {
        api("com:whatever:projectA") // How do I select linkage here?
    }
}

Looks like it currently defaults to Shared since projectB is using a shared linkage.


(Daniel Lacasse) #2

This may be a limitation at the moment. Please open an issue on the native repository and we will get around to it.

At the moment, the quick workaround that I can think of is creating Project A Static and Project A Shared that point to the same code. Then from Project B you depend on the right project variant.


(Daniel Lacasse) #3

An issue has already been created here: https://github.com/gradle/gradle-native/issues/923