Skip to content

Commit

Permalink
WA for broken atomicfu compiler plugin dependency in kotlin 1.7.0 (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvicsokolova committed Jul 11, 2022
1 parent 2ea0414 commit cbcf4c5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
*/


import org.gradle.api.internal.artifacts.repositories.resolver.DefaultMutableVariantFilesMetadata
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute

import static Projects.*

Expand Down Expand Up @@ -180,6 +182,31 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) {
// Remove null assertions to get smaller bytecode on Android
kotlinOptions.freeCompilerArgs += ["-Xno-param-assertions", "-Xno-receiver-assertions", "-Xno-call-assertions"]
}

dependencies {
components {
it.withModule("org.jetbrains.kotlin:atomicfu") {
def componentMetadataDetails = it as ComponentMetadataDetails
componentMetadataDetails.withVariant("runtimeElements") {
def runtimeElementsVariant = it as VariantMetadata
componentMetadataDetails.addVariant("runtimeJsIrElements") {
def runtimeJsIrElementsVariant = it
runtimeElementsVariant.attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
runtimeElementsVariant.attributes.attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.ir)
runtimeElementsVariant.attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage, Usage.JAVA_RUNTIME))
runtimeElementsVariant.withFiles {
def runtimeElementsFiles = it as DefaultMutableVariantFilesMetadata
runtimeJsIrElementsVariant.withFiles {
runtimeElementsFiles.files.forEach {
addFile(it.name)
}
}
}
}
}
}
}
}
}

if (build_snapshot_train) {
Expand Down

0 comments on commit cbcf4c5

Please sign in to comment.