[Parcelize] Move FIR related parts of parcelize to separate module

This is needed to avoid bundling of FIR classes to IDE plugin for
  parcelize, because it can cause compatibility issues, because
  IDE plugin does not contain FIR compiler
This commit is contained in:
Dmitriy Novozhilov
2022-01-20 16:27:04 +03:00
committed by teamcity
parent 756ff6cf43
commit bea2bc3980
18 changed files with 57 additions and 22 deletions
@@ -26,18 +26,6 @@ dependencies {
compileOnly(intellijCore())
compileOnly(commonDependency("org.jetbrains.intellij.deps:asm-all"))
// FIR dependencies
compileOnly(project(":compiler:fir:cones"))
compileOnly(project(":compiler:fir:tree"))
compileOnly(project(":compiler:fir:resolve"))
compileOnly(project(":compiler:fir:checkers"))
compileOnly(project(":compiler:fir:checkers:checkers.jvm"))
compileOnly(project(":compiler:fir:fir2ir"))
compileOnly(project(":compiler:ir.backend.common"))
compileOnly(project(":compiler:ir.tree.impl"))
compileOnly(project(":compiler:fir:entrypoint"))
compileOnly(project(":kotlin-reflect-api"))
testApiJUnit5()
testApi(project(":compiler:util"))
@@ -56,6 +44,7 @@ dependencies {
// FIR dependencies
testApi(project(":compiler:fir:checkers"))
testApi(project(":compiler:fir:checkers:checkers.jvm"))
testApi(project(":plugins:parcelize:parcelize-compiler:parcelize-fir"))
testRuntimeOnly(project(":compiler:fir:fir-serialization"))
testCompileOnly(project(":kotlin-reflect-api"))
@@ -0,0 +1,34 @@
description = "Parcelize FIR compiler plugin"
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
testApi(intellijCore())
compileOnly(project(":plugins:parcelize:parcelize-compiler"))
compileOnly(intellijCore())
compileOnly(project(":compiler:fir:cones"))
compileOnly(project(":compiler:fir:tree"))
compileOnly(project(":compiler:fir:resolve"))
compileOnly(project(":compiler:fir:checkers"))
compileOnly(project(":compiler:fir:checkers:checkers.jvm"))
compileOnly(project(":compiler:fir:fir2ir"))
compileOnly(project(":compiler:ir.backend.common"))
compileOnly(project(":compiler:ir.tree.impl"))
compileOnly(project(":compiler:fir:entrypoint"))
compileOnly(project(":kotlin-reflect-api"))
}
sourceSets {
"main" { projectDefault() }
"test" { none() }
}
runtimeJar()
javadocJar()
sourcesJar()
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.parcelize
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.parcelize.ir.AndroidSymbols
import org.jetbrains.kotlin.parcelize.ir.ParcelizeFirIrTransformer
class ParcelizeFirIrGeneratorExtension : IrGenerationExtension {
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
val androidSymbols = AndroidSymbols(pluginContext.irBuiltIns, moduleFragment)
ParcelizeFirIrTransformer(pluginContext, androidSymbols).transform(moduleFragment)
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -11,11 +11,9 @@ import org.jetbrains.kotlin.fir.backend.IrPluginDeclarationOrigin
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.declarations.IrProperty
import org.jetbrains.kotlin.ir.util.companionObject
import org.jetbrains.kotlin.ir.util.functions
import org.jetbrains.kotlin.ir.util.render
import org.jetbrains.kotlin.parcelize.ParcelizeNames.CREATOR_NAME
import org.jetbrains.kotlin.parcelize.ParcelizeNames.PARCELER_FQN
import org.jetbrains.kotlin.parcelize.ParcelizeSyntheticComponent
import org.jetbrains.kotlin.parcelize.fir.FirParcelizePluginKey
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.parcelize.ir.AndroidSymbols
import org.jetbrains.kotlin.parcelize.ir.ParcelizeFirIrTransformer
import org.jetbrains.kotlin.parcelize.ir.ParcelizeIrTransformer
class ParcelizeIrGeneratorExtension : IrGenerationExtension {
@@ -19,9 +18,3 @@ class ParcelizeIrGeneratorExtension : IrGenerationExtension {
}
}
class ParcelizeFirIrGeneratorExtension : IrGenerationExtension {
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
val androidSymbols = AndroidSymbols(pluginContext.irBuiltIns, moduleFragment)
ParcelizeFirIrTransformer(pluginContext, androidSymbols).transform(moduleFragment)
}
}
+1
View File
@@ -111,6 +111,7 @@ val distCompilerPluginProjects = listOf(
":kotlin-allopen-compiler-plugin",
":kotlin-android-extensions-runtime",
":plugins:parcelize:parcelize-compiler",
":plugins:parcelize:parcelize-compiler:parcelize-fir",
":plugins:parcelize:parcelize-runtime",
":kotlin-noarg-compiler-plugin",
":kotlin-sam-with-receiver-compiler-plugin",
+1
View File
@@ -332,6 +332,7 @@ include ":compiler:test-infrastructure",
":compiler:tests-common-new"
include ":plugins:parcelize:parcelize-compiler",
":plugins:parcelize:parcelize-compiler:parcelize-fir",
":plugins:parcelize:parcelize-runtime",
":kotlin-parcelize-compiler"