1
+ import org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE
2
+ import org.gradle.api.attributes.java.TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE
1
3
import org.jetbrains.dokka.gradle.DokkaTask
2
4
3
5
plugins {
@@ -20,7 +22,7 @@ dependencies {
20
22
implementation(kotlin(" stdlib" ))
21
23
implementation(kotlin(" stdlib-jdk8" ))
22
24
23
- attributesSchema.attribute(LibraryElements . LIBRARY_ELEMENTS_ATTRIBUTE ).compatibilityRules.add(ModularJarCompatibilityRule ::class )
25
+ attributesSchema.attribute(LIBRARY_ELEMENTS_ATTRIBUTE ).compatibilityRules.add(ModularJarCompatibilityRule ::class )
24
26
components { withModule<ModularKotlinRule >(kotlin(" stdlib" )) }
25
27
components { withModule<ModularKotlinRule >(kotlin(" stdlib-jdk8" )) }
26
28
@@ -80,9 +82,10 @@ artifacts {
80
82
81
83
// == Add access to the 'modular' variant of kotlin("stdlib"): Put this into a buildSrc plugin and reuse it in all your subprojects
82
84
configurations.all {
85
+ attributes.attribute(TARGET_JVM_VERSION_ATTRIBUTE , 11 )
83
86
val n = name.toLowerCase()
84
87
if (n.endsWith(" compileclasspath" ) || n.endsWith(" runtimeclasspath" ))
85
- attributes.attribute(LibraryElements . LIBRARY_ELEMENTS_ATTRIBUTE , objects.named(" modular-jar" ))
88
+ attributes.attribute(LIBRARY_ELEMENTS_ATTRIBUTE , objects.named(" modular-jar" ))
86
89
if (n.endsWith(" compile" ) || n.endsWith(" runtime" ))
87
90
isCanBeConsumed = false
88
91
}
@@ -104,7 +107,7 @@ abstract class ModularKotlinRule : ComponentMetadataRule {
104
107
listOf (" compile" , " runtime" ).forEach { baseVariant ->
105
108
ctx.details.addVariant(" ${baseVariant} Modular" , baseVariant) {
106
109
attributes {
107
- attribute(LibraryElements . LIBRARY_ELEMENTS_ATTRIBUTE , getObjects().named(" modular-jar" ))
110
+ attribute(LIBRARY_ELEMENTS_ATTRIBUTE , getObjects().named(" modular-jar" ))
108
111
}
109
112
withFiles {
110
113
removeAllFiles()
0 commit comments