Remove dependency on parcelize-runtime in the Parcelize compiler plugin

This commit is contained in:
Yan Zhulanow
2021-03-02 18:53:24 +09:00
parent e90cc30edb
commit cc4c61d2b3
6 changed files with 18 additions and 26 deletions
@@ -19,8 +19,6 @@ dependencies {
compileOnly(project(":compiler:ir.backend.common"))
compileOnly(project(":compiler:backend.jvm"))
compileOnly(project(":compiler:ir.tree.impl"))
compileOnly(project(":plugins:parcelize:parcelize-runtime"))
compileOnly(project(":kotlin-android-extensions-runtime"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeJars("asm-all", rootProject = rootProject) }
@@ -42,9 +40,6 @@ dependencies {
robolectricClasspath(project(":plugins:parcelize:parcelize-runtime")) { isTransitive = false }
robolectricClasspath(project(":kotlin-android-extensions-runtime")) { isTransitive = false }
embedded(project(":plugins:parcelize:parcelize-runtime")) { isTransitive = false }
embedded(project(":kotlin-android-extensions-runtime")) { isTransitive = false }
parcelizeRuntimeForTests(project(":plugins:parcelize:parcelize-runtime")) { isTransitive = false }
parcelizeRuntimeForTests(project(":kotlin-android-extensions-runtime")) { isTransitive = false }
}
@@ -38,8 +38,8 @@ val ANDROID_PARCEL_CLASS_FQNAME = FqName("android.os.Parcel")
open class ParcelizeDeclarationChecker : DeclarationChecker {
private companion object {
private val IGNORED_ON_PARCEL_FQ_NAMES = listOf(
FqName(kotlinx.parcelize.IgnoredOnParcel::class.java.canonicalName),
@Suppress("DEPRECATION") FqName(kotlinx.android.parcel.IgnoredOnParcel::class.java.canonicalName)
FqName("kotlinx.parcelize.IgnoredOnParcel"),
FqName("kotlinx.android.parcel.IgnoredOnParcel")
)
}
@@ -170,33 +170,32 @@ interface ParcelizeSyntheticComponent {
}
val TYPE_PARCELER_FQ_NAMES = listOf(
FqName(kotlinx.parcelize.TypeParceler::class.java.name),
FqName(kotlinx.android.parcel.TypeParceler::class.java.name)
FqName("kotlinx.parcelize.TypeParceler"),
FqName("kotlinx.android.parcel.TypeParceler")
)
val WRITE_WITH_FQ_NAMES = listOf(
FqName(kotlinx.parcelize.WriteWith::class.java.name),
FqName(kotlinx.android.parcel.WriteWith::class.java.name)
FqName("kotlinx.parcelize.WriteWith"),
FqName("kotlinx.android.parcel.WriteWith")
)
val IGNORED_ON_PARCEL_FQ_NAMES = listOf(
FqName(kotlinx.parcelize.IgnoredOnParcel::class.java.name),
FqName(kotlinx.android.parcel.IgnoredOnParcel::class.java.name)
FqName("kotlinx.parcelize.IgnoredOnParcel"),
FqName("kotlinx.android.parcel.IgnoredOnParcel")
)
val PARCELIZE_CLASS_FQ_NAMES: List<FqName> = listOf(
FqName(kotlinx.parcelize.Parcelize::class.java.canonicalName),
FqName(kotlinx.android.parcel.Parcelize::class.java.canonicalName)
FqName("kotlinx.parcelize.Parcelize"),
FqName("kotlinx.android.parcel.Parcelize")
)
val RAW_VALUE_ANNOTATION_FQ_NAMES = listOf(
FqName(kotlinx.parcelize.RawValue::class.java.name),
@Suppress("DEPRECATION") FqName(kotlinx.android.parcel.RawValue::class.java.name)
FqName("kotlinx.parcelize.RawValue"),
FqName("kotlinx.android.parcel.RawValue")
)
internal val PARCELER_FQNAME = FqName(kotlinx.parcelize.Parceler::class.java.canonicalName)
internal val OLD_PARCELER_FQNAME = FqName(kotlinx.android.parcel.Parceler::class.java.canonicalName)
internal val PARCELER_FQNAME = FqName("kotlinx.parcelize.Parceler")
internal val OLD_PARCELER_FQNAME = FqName("kotlinx.android.parcel.Parceler")
val ClassDescriptor.isParcelize: Boolean
get() {
@@ -65,8 +65,8 @@ interface ParcelSerializer {
companion object {
private val WRITE_WITH_FQ_NAMES = listOf(
FqName(kotlinx.parcelize.WriteWith::class.java.name),
@Suppress("DEPRECATION") FqName(kotlinx.android.parcel.WriteWith::class.java.name),
FqName("kotlinx.parcelize.WriteWith"),
FqName("kotlinx.android.parcel.WriteWith"),
)
private fun KotlinTypeMapper.mapTypeSafe(type: KotlinType, forceBoxed: Boolean) = when {
@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.parcelize.serializers
import kotlinx.parcelize.Parceler
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.FrameMap
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
@@ -30,7 +29,7 @@ import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
internal val PARCEL_TYPE = Type.getObjectType("android/os/Parcel")
internal val PARCELER_TYPE = Type.getObjectType(Parceler::class.java.name.replace(".", "/"))
internal val PARCELER_TYPE = Type.getObjectType("kotlinx/parcelize/Parceler")
internal class GenericParcelSerializer(override val asmType: Type) : ParcelSerializer {
override fun writeValue(v: InstructionAdapter) {
@@ -1,8 +1,7 @@
idePluginDependency {
publishProjectJars(
listOf(
":plugins:parcelize:parcelize-compiler",
":plugins:parcelize:parcelize-runtime"
":plugins:parcelize:parcelize-compiler"
)
)
}