gradle-native icon indicating copy to clipboard operation
gradle-native copied to clipboard

Demonstrate how to consume static linkage variant of a dual-linkage library

Open lacasseio opened this issue 5 years ago • 1 comments

lacasseio avatar May 07 '19 17:05 lacasseio

🎉 🎉 🎉 Thanks @ljacomet for helping nailing the right semantic for solving this use case.

Screen Shot 2019-11-20 at 9 21 10 PM

The code should look like this:

library {
    dependencies {
        api(project(':list')) {
            attributes { attribute(Attribute.of("org.gradle.native.linkage", Linkage), Linkage.STATIC) }
        }
    }
}

But because of issue https://github.com/gradle/gradle-native/issues/1053, it needs to look like this:

dependencies {
    api(project(':list')) {
        attributes { attribute(Attribute.of("org.gradle.native.linkage", Linkage), Linkage.STATIC) }
    }
}

Unfortunately, when going through the Project#getDependencies() container, it will make it a bit more complicated when dealing with variants as you will have to know the variant name for the dependency to configure.

lacasseio avatar Nov 20 '19 17:11 lacasseio