kotlinx.atomicfu compiler plugin for JS_IR backend (#4581)

* kotlinx.atomicfu compiler plugin for JS_IR

Support transformations of atomic operations introduced by the kotlinx.atomicfu library for the JS_IR backend. Compiler plugin is applied externally by the kotlinx.atomicfu gradle plugin.

* Apply compiler plugin for JS platform only

* New plugin test structure

* testGroupOutputDirPrefix changed
This commit is contained in:
mvicsokolova
2021-12-01 22:33:13 +03:00
committed by GitHub
parent 05695761ec
commit 93561a1a55
45 changed files with 2655 additions and 4 deletions
@@ -314,7 +314,7 @@ class ClassicFrontendFacade(
dependentDescriptors: List<ModuleDescriptorImpl>,
friendsDescriptors: List<ModuleDescriptorImpl>,
): AnalysisResult {
val runtimeKlibsNames = JsEnvironmentConfigurator.getStdlibPathsForModule(module)
val runtimeKlibsNames = JsEnvironmentConfigurator.getRuntimePathsForModule(module, testServices)
val runtimeKlibs = loadKlib(runtimeKlibsNames, configuration)
val transitiveLibraries = JsEnvironmentConfigurator.getDependencies(module, testServices, DependencyRelation.RegularDependency)
val friendLibraries = JsEnvironmentConfigurator.getDependencies(module, testServices, DependencyRelation.FriendDependency)
@@ -137,13 +137,17 @@ class JsEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigu
return getMainModule(testServices).name
}
fun getStdlibPathsForModule(module: TestModule): List<String> {
fun getRuntimePathsForModule(module: TestModule, testServices: TestServices): List<String> {
val result = mutableListOf<String>()
val needsFullIrRuntime = JsEnvironmentConfigurationDirectives.KJS_WITH_FULL_RUNTIME in module.directives ||
ConfigurationDirectives.WITH_STDLIB in module.directives ||
ConfigurationDirectives.WITH_RUNTIME in module.directives
val names = if (needsFullIrRuntime) listOf("full.stdlib", "kotlin.test") else listOf("reduced.stdlib")
return names.map { System.getProperty("kotlin.js.$it.path") }
names.mapTo(result) { System.getProperty("kotlin.js.$it.path") }
val runtimeClasspaths = testServices.runtimeClasspathProviders.flatMap { it.runtimeClassPaths(module) }
runtimeClasspaths.mapTo(result) { it.absolutePath }
return result
}
fun getDependencies(module: TestModule, testServices: TestServices, kind: DependencyRelation): List<ModuleDescriptorImpl> {