@@ -37,10 +37,6 @@ dependencies {
3737 implementation(kotlin(" stdlib" ))
3838 implementation(kotlin(" stdlib-jdk8" ))
3939
40- attributesSchema.attribute(LIBRARY_ELEMENTS_ATTRIBUTE ).compatibilityRules.add(ModularJarCompatibilityRule ::class )
41- components { withModule<ModularKotlinRule >(kotlin(" stdlib" )) }
42- components { withModule<ModularKotlinRule >(kotlin(" stdlib-jdk8" )) }
43-
4440 implementation(" $kx :kotlin-unsigned:$unsignedVersion " )
4541 implementation(" $kx :kool:$koolVersion " )
4642 implementation(" $kx :glm:$glmVersion " )
@@ -131,42 +127,4 @@ publishing {
131127}
132128
133129// == Add access to the 'modular' variant of kotlin("stdlib"): Put this into a buildSrc plugin and reuse it in all your subprojects
134- configurations.all {
135- attributes.attribute(TARGET_JVM_VERSION_ATTRIBUTE , 11 )
136- val n = name.toLowerCase()
137- if (n.endsWith(" compileclasspath" ) || n.endsWith(" runtimeclasspath" ))
138- attributes.attribute(LIBRARY_ELEMENTS_ATTRIBUTE , objects.named(" modular-jar" ))
139- if (n.endsWith(" compile" ) || n.endsWith(" runtime" ))
140- isCanBeConsumed = false
141- }
142-
143- abstract class ModularJarCompatibilityRule : AttributeCompatibilityRule <LibraryElements > {
144- override fun execute (details : CompatibilityCheckDetails <LibraryElements >): Unit = details.run {
145- if (producerValue?.name == LibraryElements .JAR && consumerValue?.name == " modular-jar" )
146- compatible()
147- }
148- }
149-
150- abstract class ModularKotlinRule : ComponentMetadataRule {
151-
152- @javax.inject.Inject
153- abstract fun getObjects (): ObjectFactory
154-
155- override fun execute (ctx : ComponentMetadataContext ) {
156- val id = ctx.details.id
157- listOf (" compile" , " runtime" ).forEach { baseVariant ->
158- ctx.details.addVariant(" ${baseVariant} Modular" , baseVariant) {
159- attributes {
160- attribute(LIBRARY_ELEMENTS_ATTRIBUTE , getObjects().named(" modular-jar" ))
161- }
162- withFiles {
163- removeAllFiles()
164- addFile(" ${id.name} -${id.version} -modular.jar" )
165- }
166- withDependencies {
167- clear() // 'kotlin-stdlib-common' and 'annotations' are not modules and are also not needed
168- }
169- }
170- }
171- }
172- }
130+ configurations.all { attributes.attribute(TARGET_JVM_VERSION_ATTRIBUTE , 11 ) }
0 commit comments