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
@@ -0,0 +1,58 @@
/*
* Copyright 2010-2020 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlinx.atomicfu.gradle
import org.gradle.api.Project
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.compile.AbstractCompile
import org.jetbrains.kotlin.gradle.plugin.*
class AtomicfuKotlinGradleSubplugin :
KotlinCompilerPluginSupportPlugin,
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
KotlinGradleSubplugin<AbstractCompile> {
companion object {
const val ATOMICFU_ARTIFACT_NAME = "atomicfu"
}
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true
override fun applyToCompilation(
kotlinCompilation: KotlinCompilation<*>
): Provider<List<SubpluginOption>> =
kotlinCompilation.target.project.provider { emptyList<SubpluginOption>() }
override fun getPluginArtifact(): SubpluginArtifact =
JetBrainsSubpluginArtifact(ATOMICFU_ARTIFACT_NAME)
override fun getCompilerPluginId() = "org.jetbrains.kotlinx.atomicfu"
//region Stub implementation for legacy API, KT-39809
override fun isApplicable(project: Project, task: AbstractCompile): Boolean = true
override fun apply(
project: Project,
kotlinCompile: AbstractCompile,
javaCompile: AbstractCompile?,
variantData: Any?,
androidProjectHandler: Any?,
kotlinCompilation: KotlinCompilation<*>?
): List<SubpluginOption> {
return emptyList()
}
//endregion
}
@@ -0,0 +1 @@
implementation-class=org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin
@@ -0,0 +1 @@
implementation-class=org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin
@@ -0,0 +1,17 @@
#
# Copyright 2010-2020 JetBrains s.r.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin