Migrating to 1.3 preview API
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<groupId>org.jetbrains.kotlinx</groupId>
|
<groupId>org.jetbrains.kotlinx</groupId>
|
||||||
<artifactId>kotlinx-maven-serialization-plugin</artifactId>
|
<artifactId>kotlinx-maven-serialization-plugin</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>0.5.2-SNAPSHOT</version>
|
<version>0.7.0-eap-1</version>
|
||||||
<description>Serialization plugin for Maven</description>
|
<description>Serialization plugin for Maven</description>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ configureJvmProject(project)
|
|||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
group = 'org.jetbrains.kotlinx'
|
group = 'org.jetbrains.kotlinx'
|
||||||
version = '0.7.1'
|
version = '0.7.0'
|
||||||
if (!project.hasProperty("deploy")) {
|
if (!project.hasProperty("deploy")) {
|
||||||
version = "$version-SNAPSHOT"
|
version = "$version-eap-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ class SerializationKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val log = Logging.getLogger(this.javaClass)
|
private val log = Logging.getLogger(this.javaClass)
|
||||||
private val pluginVersion = "0.7.1-SNAPSHOT"
|
private val pluginVersion = "0.7.0-eap-1"
|
||||||
private var useUnshaded = false
|
private var useUnshaded = false
|
||||||
|
|
||||||
override fun isApplicable(project: Project, task: AbstractCompile): Boolean {
|
override fun isApplicable(project: Project, task: AbstractCompile): Boolean {
|
||||||
|
|||||||
+6
-2
@@ -33,6 +33,8 @@ import org.jetbrains.kotlinx.serialization.compiler.backend.jvm.contextSerialize
|
|||||||
import org.jetbrains.kotlinx.serialization.compiler.backend.jvm.enumSerializerId
|
import org.jetbrains.kotlinx.serialization.compiler.backend.jvm.enumSerializerId
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.backend.jvm.referenceArraySerializerId
|
import org.jetbrains.kotlinx.serialization.compiler.backend.jvm.referenceArraySerializerId
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.resolve.*
|
import org.jetbrains.kotlinx.serialization.compiler.resolve.*
|
||||||
|
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.DECODER_CLASS
|
||||||
|
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.ENCODER_CLASS
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_DESCRIPTOR_CLASS_IMPL
|
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SERIAL_DESCRIPTOR_CLASS_IMPL
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.STRUCTURE_DECODER_CLASS
|
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.STRUCTURE_DECODER_CLASS
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.STRUCTURE_ENCODER_CLASS
|
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.STRUCTURE_ENCODER_CLASS
|
||||||
@@ -168,13 +170,14 @@ class SerializerIrGenerator(val irClass: IrClass, override val compilerContext:
|
|||||||
IrGetValueImpl(startOffset, endOffset, saveFunc.dispatchReceiverParameter!!.symbol)
|
IrGetValueImpl(startOffset, endOffset, saveFunc.dispatchReceiverParameter!!.symbol)
|
||||||
|
|
||||||
val kOutputClass = serializerDescriptor.getClassFromSerializationPackage(STRUCTURE_ENCODER_CLASS)
|
val kOutputClass = serializerDescriptor.getClassFromSerializationPackage(STRUCTURE_ENCODER_CLASS)
|
||||||
|
val kOutputSmallClass = serializerDescriptor.getClassFromSerializationPackage(ENCODER_CLASS)
|
||||||
|
|
||||||
val descriptorGetterSymbol = compilerContext.localSymbolTable.referenceFunction(anySerialDescProperty?.getter!!) //???
|
val descriptorGetterSymbol = compilerContext.localSymbolTable.referenceFunction(anySerialDescProperty?.getter!!) //???
|
||||||
|
|
||||||
val localSerialDesc = irTemporary(irGet(descriptorGetterSymbol.owner.returnType, irThis(), descriptorGetterSymbol), "desc")
|
val localSerialDesc = irTemporary(irGet(descriptorGetterSymbol.owner.returnType, irThis(), descriptorGetterSymbol), "desc")
|
||||||
|
|
||||||
// fun beginStructure(desc: SerialDescriptor, vararg typeParams: KSerializer<*>): StructureEncoder
|
// fun beginStructure(desc: SerialDescriptor, vararg typeParams: KSerializer<*>): StructureEncoder
|
||||||
val beginFunc = kOutputClass.referenceMethod(CallingConventions.begin) // todo: retrieve from actual encoder instead
|
val beginFunc = kOutputSmallClass.referenceMethod(CallingConventions.begin) // todo: retrieve from actual encoder instead
|
||||||
|
|
||||||
val call = irCall(beginFunc).mapValueParametersIndexed { i, parameterDescriptor ->
|
val call = irCall(beginFunc).mapValueParametersIndexed { i, parameterDescriptor ->
|
||||||
if (i == 0) irGet(localSerialDesc) else IrVarargImpl(
|
if (i == 0) irGet(localSerialDesc) else IrVarargImpl(
|
||||||
@@ -257,6 +260,7 @@ class SerializerIrGenerator(val irClass: IrClass, override val compilerContext:
|
|||||||
fun IrVariable.get() = irGet(this)
|
fun IrVariable.get() = irGet(this)
|
||||||
|
|
||||||
val inputClass = serializerDescriptor.getClassFromSerializationPackage(STRUCTURE_DECODER_CLASS)
|
val inputClass = serializerDescriptor.getClassFromSerializationPackage(STRUCTURE_DECODER_CLASS)
|
||||||
|
val inputSmallClass = serializerDescriptor.getClassFromSerializationPackage(DECODER_CLASS)
|
||||||
val descriptorGetterSymbol = compilerContext.localSymbolTable.referenceFunction(anySerialDescProperty?.getter!!) //???
|
val descriptorGetterSymbol = compilerContext.localSymbolTable.referenceFunction(anySerialDescProperty?.getter!!) //???
|
||||||
val localSerialDesc = irTemporary(irGet(descriptorGetterSymbol.owner.returnType, irThis(), descriptorGetterSymbol), "desc")
|
val localSerialDesc = irTemporary(irGet(descriptorGetterSymbol.owner.returnType, irThis(), descriptorGetterSymbol), "desc")
|
||||||
|
|
||||||
@@ -283,7 +287,7 @@ class SerializerIrGenerator(val irClass: IrClass, override val compilerContext:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//input = input.beginStructure(...)
|
//input = input.beginStructure(...)
|
||||||
val beginFunc = inputClass.referenceMethod(CallingConventions.begin)
|
val beginFunc = inputSmallClass.referenceMethod(CallingConventions.begin)
|
||||||
val call = irInvoke(
|
val call = irInvoke(
|
||||||
irGet(loadFunc.valueParameters[0]),
|
irGet(loadFunc.valueParameters[0]),
|
||||||
beginFunc,
|
beginFunc,
|
||||||
|
|||||||
+4
-4
@@ -33,9 +33,9 @@ object SerialEntityNames {
|
|||||||
val IMPL_NAME = Name.identifier("Impl")
|
val IMPL_NAME = Name.identifier("Impl")
|
||||||
|
|
||||||
const val ENCODER_CLASS = "Encoder"
|
const val ENCODER_CLASS = "Encoder"
|
||||||
const val STRUCTURE_ENCODER_CLASS = "StructureEncoder"
|
const val STRUCTURE_ENCODER_CLASS = "CompositeEncoder"
|
||||||
const val DECODER_CLASS = "Decoder"
|
const val DECODER_CLASS = "Decoder"
|
||||||
const val STRUCTURE_DECODER_CLASS = "StructureDecoder"
|
const val STRUCTURE_DECODER_CLASS = "CompositeDecoder"
|
||||||
|
|
||||||
const val SERIAL_SAVER_CLASS = "SerializationStrategy"
|
const val SERIAL_SAVER_CLASS = "SerializationStrategy"
|
||||||
const val SERIAL_LOADER_CLASS = "DeserializationStrategy"
|
const val SERIAL_LOADER_CLASS = "DeserializationStrategy"
|
||||||
@@ -75,8 +75,8 @@ object CallingConventions {
|
|||||||
const val decode = "decode"
|
const val decode = "decode"
|
||||||
const val update = "update"
|
const val update = "update"
|
||||||
const val encode = "encode"
|
const val encode = "encode"
|
||||||
const val decodeElementIndex = "decodeElement"
|
const val decodeElementIndex = "decodeElementIndex"
|
||||||
const val elementPostfix = "ElementValue"
|
const val elementPostfix = "Element"
|
||||||
|
|
||||||
const val addElement = "addElement"
|
const val addElement = "addElement"
|
||||||
const val addAnnotation = "pushAnnotation"
|
const val addAnnotation = "pushAnnotation"
|
||||||
|
|||||||
Reference in New Issue
Block a user