Skip to content

Commit 4f2329e

Browse files
ALikhachevmvicsokolova
authored andcommitted
WA for broken atomicfu compiler plugin dependency in kotlin 1.7.0
1 parent cbcf4c5 commit 4f2329e

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

build.gradle

+25-25
Original file line numberDiff line numberDiff line change
@@ -182,31 +182,6 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) {
182182
// Remove null assertions to get smaller bytecode on Android
183183
kotlinOptions.freeCompilerArgs += ["-Xno-param-assertions", "-Xno-receiver-assertions", "-Xno-call-assertions"]
184184
}
185-
186-
dependencies {
187-
components {
188-
it.withModule("org.jetbrains.kotlin:atomicfu") {
189-
def componentMetadataDetails = it as ComponentMetadataDetails
190-
componentMetadataDetails.withVariant("runtimeElements") {
191-
def runtimeElementsVariant = it as VariantMetadata
192-
componentMetadataDetails.addVariant("runtimeJsIrElements") {
193-
def runtimeJsIrElementsVariant = it
194-
runtimeElementsVariant.attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
195-
runtimeElementsVariant.attributes.attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.ir)
196-
runtimeElementsVariant.attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage, Usage.JAVA_RUNTIME))
197-
runtimeElementsVariant.withFiles {
198-
def runtimeElementsFiles = it as DefaultMutableVariantFilesMetadata
199-
runtimeJsIrElementsVariant.withFiles {
200-
runtimeElementsFiles.files.forEach {
201-
addFile(it.name)
202-
}
203-
}
204-
}
205-
}
206-
}
207-
}
208-
}
209-
}
210185
}
211186

212187
if (build_snapshot_train) {
@@ -381,4 +356,29 @@ allprojects { subProject ->
381356
"triggering all sort of incompatible class changes errors")
382357
}
383358
}
359+
360+
dependencies {
361+
components { component ->
362+
component.withModule("org.jetbrains.kotlin:atomicfu") { ComponentMetadataDetails componentMetadataDetails ->
363+
componentMetadataDetails.withVariant("runtimeElements") { VariantMetadata runtimeElementsVariant ->
364+
[KotlinJsCompilerAttribute.legacy, KotlinJsCompilerAttribute.ir].forEach { jsType ->
365+
componentMetadataDetails.addVariant("runtimeJs${jsType.name().capitalize()}Elements") { jsVariant ->
366+
jsVariant.attributes {
367+
it.attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
368+
it.attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, jsType)
369+
it.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage, Usage.JAVA_RUNTIME))
370+
}
371+
runtimeElementsVariant.withFiles { DefaultMutableVariantFilesMetadata runtimeElementsFiles ->
372+
jsVariant.withFiles {
373+
runtimeElementsFiles.files.forEach { file ->
374+
addFile(file.name)
375+
}
376+
}
377+
}
378+
}
379+
}
380+
}
381+
}
382+
}
383+
}
384384
}

0 commit comments

Comments
 (0)