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:
@@ -3,6 +3,7 @@ def pluginProjects = [
|
||||
project(':kotlin-allopen'),
|
||||
project(':kotlin-noarg'),
|
||||
project(':kotlin-serialization'),
|
||||
project(':atomicfu'),
|
||||
project(':kotlin-lombok')
|
||||
]
|
||||
configure(pluginProjects) { project ->
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'jps-compatible'
|
||||
|
||||
configurePublishing(project)
|
||||
|
||||
pill {
|
||||
variant = 'FULL'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(':kotlin-gradle-plugin')
|
||||
compileOnly project(':kotlin-gradle-plugin-api')
|
||||
|
||||
compileOnly kotlinStdlib()
|
||||
compileOnly project(':kotlin-compiler-embeddable')
|
||||
|
||||
embedded(project(":kotlinx-atomicfu-compiler-plugin"))
|
||||
}
|
||||
|
||||
jar {
|
||||
manifestAttributes(manifest, project)
|
||||
}
|
||||
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
||||
configureSourcesJar()
|
||||
configureJavadocJar()
|
||||
|
||||
pluginBundle {
|
||||
plugins {
|
||||
atomicfu {
|
||||
id = 'org.jetbrains.kotlin.plugin.atomicfu'
|
||||
description = displayName = 'Kotlin compiler plugin for kotlinx.atomicfu library'
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
@@ -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
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
implementation-class=org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin
|
||||
+1
@@ -0,0 +1 @@
|
||||
implementation-class=org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin
|
||||
+17
@@ -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
|
||||
Reference in New Issue
Block a user