[Gradle] Move IdeDependency into kgp-idea module and share serializer logic
KT-54825
This commit is contained in:
committed by
Space Team
parent
1befefc687
commit
f3998d523d
+5
-5
@@ -1,8 +1,8 @@
|
|||||||
public final class org/jetbrains/kotlin/kpm/idea/proto/KpmIdeaProto {
|
public final class org/jetbrains/kotlin/kpm/idea/proto/KpmIdeaProto {
|
||||||
public static final fun IdeaKpmProject (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext;Ljava/io/InputStream;)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;
|
public static final fun IdeaKpmProject (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext;Ljava/io/InputStream;)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;
|
||||||
public static final fun IdeaKpmProject (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext;Ljava/nio/ByteBuffer;)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;
|
public static final fun IdeaKpmProject (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext;Ljava/nio/ByteBuffer;)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;
|
||||||
public static final fun IdeaKpmProject (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext;[B)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;
|
public static final fun IdeaKpmProject (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext;[B)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;
|
||||||
public static final fun toByteArray (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext;)[B
|
public static final fun toByteArray (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext;)[B
|
||||||
public static final fun writeTo (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;Ljava/io/OutputStream;Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext;)V
|
public static final fun writeTo (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKpmProject;Ljava/io/OutputStream;Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -233,15 +233,15 @@ public final class org/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasS
|
|||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer {
|
||||||
public static final field Companion Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer$Companion;
|
public static final field Companion Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer$Companion;
|
||||||
public abstract fun deserialize (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext;[B)Ljava/lang/Object;
|
public abstract fun deserialize (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext;[B)Ljava/lang/Object;
|
||||||
public abstract fun serialize (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext;Ljava/lang/Object;)[B
|
public abstract fun serialize (Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext;Ljava/lang/Object;)[B
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class org/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer$Companion {
|
public final class org/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer$Companion {
|
||||||
public final fun javaIoSerializable (Lkotlin/reflect/KClass;)Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer;
|
public final fun javaIoSerializable (Lkotlin/reflect/KClass;)Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationContext {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaSerializationContext {
|
||||||
public abstract fun getExtrasSerializationExtension ()Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializationExtension;
|
public abstract fun getExtrasSerializationExtension ()Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmExtrasSerializationExtension;
|
||||||
public abstract fun getLogger ()Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationLogger;
|
public abstract fun getLogger ()Lorg/jetbrains/kotlin/gradle/kpm/idea/serialize/IdeaKpmSerializationLogger;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
|
|
||||||
internal fun IdeaKpmBinaryCoordinatesProto(coordinates: IdeaKpmBinaryCoordinates): IdeaKpmBinaryCoordinatesProto {
|
internal fun IdeaKpmBinaryCoordinatesProto(coordinates: IdeaKpmBinaryCoordinates): IdeaKpmBinaryCoordinatesProto {
|
||||||
return ideaKpmBinaryCoordinatesProto {
|
return ideaKpmBinaryCoordinatesProto {
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmCompilationOutput
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmCompilationOutput
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmCompilationOutputImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmCompilationOutputImpl
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal fun IdeaKpmCompilationOutputProto(output: IdeaKpmCompilationOutput): IdeaKpmCompilationOutputProto {
|
internal fun IdeaKpmCompilationOutputProto(output: IdeaKpmCompilationOutput): IdeaKpmCompilationOutputProto {
|
||||||
|
|||||||
+11
-10
@@ -9,25 +9,26 @@
|
|||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import com.google.protobuf.InvalidProtocolBufferException
|
import com.google.protobuf.InvalidProtocolBufferException
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProject
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProject
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
|
||||||
fun IdeaKpmSerializationContext.IdeaKpmProject(data: ByteArray): IdeaKpmProject? {
|
|
||||||
|
fun IdeaSerializationContext.IdeaKpmProject(data: ByteArray): IdeaKpmProject? {
|
||||||
return IdeaKpmProject(data) { IdeaKpmContainerProto.parseFrom(data) }
|
return IdeaKpmProject(data) { IdeaKpmContainerProto.parseFrom(data) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IdeaKpmSerializationContext.IdeaKpmProject(data: ByteBuffer): IdeaKpmProject? {
|
fun IdeaSerializationContext.IdeaKpmProject(data: ByteBuffer): IdeaKpmProject? {
|
||||||
return IdeaKpmProject(data) { IdeaKpmContainerProto.parseFrom(data) }
|
return IdeaKpmProject(data) { IdeaKpmContainerProto.parseFrom(data) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IdeaKpmSerializationContext.IdeaKpmProject(stream: InputStream): IdeaKpmProject? {
|
fun IdeaSerializationContext.IdeaKpmProject(stream: InputStream): IdeaKpmProject? {
|
||||||
return IdeaKpmProject(stream) { IdeaKpmContainerProto.parseFrom(stream) }
|
return IdeaKpmProject(stream) { IdeaKpmContainerProto.parseFrom(stream) }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T> IdeaKpmSerializationContext.IdeaKpmProject(data: T, proto: (T) -> IdeaKpmContainerProto): IdeaKpmProject? {
|
internal fun <T> IdeaSerializationContext.IdeaKpmProject(data: T, proto: (T) -> IdeaKpmContainerProto): IdeaKpmProject? {
|
||||||
val container = try {
|
val container = try {
|
||||||
proto(data)
|
proto(data)
|
||||||
} catch (e: InvalidProtocolBufferException) {
|
} catch (e: InvalidProtocolBufferException) {
|
||||||
@@ -38,15 +39,15 @@ internal fun <T> IdeaKpmSerializationContext.IdeaKpmProject(data: T, proto: (T)
|
|||||||
return IdeaKpmProject(container)
|
return IdeaKpmProject(container)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IdeaKpmProject.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
fun IdeaKpmProject.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmContainerProto(this).toByteArray()
|
return context.IdeaKpmContainerProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IdeaKpmProject.writeTo(output: OutputStream, context: IdeaKpmSerializationContext) {
|
fun IdeaKpmProject.writeTo(output: OutputStream, context: IdeaSerializationContext) {
|
||||||
context.IdeaKpmContainerProto(this).writeDelimitedTo(output)
|
context.IdeaKpmContainerProto(this).writeDelimitedTo(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmContainerProto(project: IdeaKpmProject): IdeaKpmContainerProto {
|
internal fun IdeaSerializationContext.IdeaKpmContainerProto(project: IdeaKpmProject): IdeaKpmContainerProto {
|
||||||
return ideaKpmContainerProto {
|
return ideaKpmContainerProto {
|
||||||
schemaVersionMajor = IdeaKpmProtoSchema.versionMajor
|
schemaVersionMajor = IdeaKpmProtoSchema.versionMajor
|
||||||
schemaVersionMinor = IdeaKpmProtoSchema.versionMinor
|
schemaVersionMinor = IdeaKpmProtoSchema.versionMinor
|
||||||
@@ -56,7 +57,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmContainerProto(project: IdeaKpmP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmProject(proto: IdeaKpmContainerProto): IdeaKpmProject? {
|
internal fun IdeaSerializationContext.IdeaKpmProject(proto: IdeaKpmContainerProto): IdeaKpmProject? {
|
||||||
if (!proto.hasSchemaVersionMajor()) {
|
if (!proto.hasSchemaVersionMajor()) {
|
||||||
logger.error("Missing 'schema_version_major'", Throwable())
|
logger.error("Missing 'schema_version_major'", Throwable())
|
||||||
return null
|
return null
|
||||||
|
|||||||
+7
-7
@@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRoot
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmContentRoot
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRootImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmContentRootImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmContentRootProto(sourceDirectory: IdeaKpmContentRoot): IdeaKpmContentRootProto {
|
internal fun IdeaSerializationContext.IdeaKpmContentRootProto(sourceDirectory: IdeaKpmContentRoot): IdeaKpmContentRootProto {
|
||||||
return ideaKpmContentRootProto {
|
return ideaKpmContentRootProto {
|
||||||
absolutePath = sourceDirectory.file.absolutePath
|
absolutePath = sourceDirectory.file.absolutePath
|
||||||
type = sourceDirectory.type
|
type = sourceDirectory.type
|
||||||
@@ -18,7 +18,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmContentRootProto(sourceDirectory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmContentRoot(proto: IdeaKpmContentRootProto): IdeaKpmContentRoot {
|
internal fun IdeaSerializationContext.IdeaKpmContentRoot(proto: IdeaKpmContentRootProto): IdeaKpmContentRoot {
|
||||||
return IdeaKpmContentRootImpl(
|
return IdeaKpmContentRootImpl(
|
||||||
file = File(proto.absolutePath),
|
file = File(proto.absolutePath),
|
||||||
type = proto.type,
|
type = proto.type,
|
||||||
@@ -26,10 +26,10 @@ internal fun IdeaKpmSerializationContext.IdeaKpmContentRoot(proto: IdeaKpmConten
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmContentRoot(data: ByteArray): IdeaKpmContentRoot {
|
internal fun IdeaSerializationContext.IdeaKpmContentRoot(data: ByteArray): IdeaKpmContentRoot {
|
||||||
return IdeaKpmContentRoot(IdeaKpmContentRootProto.parseFrom(data))
|
return IdeaKpmContentRoot(IdeaKpmContentRootProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmContentRoot.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmContentRoot.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmContentRootProto(this).toByteArray()
|
return context.IdeaKpmContentRootProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -7,11 +7,15 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmUnresolvedBinaryDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
|
||||||
import org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmDependencyProto.DependencyCase
|
import org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmDependencyProto.DependencyCase
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmDependencyProto(dependency: IdeaKpmDependency): IdeaKpmDependencyProto {
|
internal fun IdeaSerializationContext.IdeaKpmDependencyProto(dependency: IdeaKpmDependency): IdeaKpmDependencyProto {
|
||||||
return ideaKpmDependencyProto {
|
return ideaKpmDependencyProto {
|
||||||
when (dependency) {
|
when (dependency) {
|
||||||
is IdeaKpmResolvedBinaryDependency -> resolvedBinaryDependency = IdeaKpmResolvedBinaryDependencyProto(dependency)
|
is IdeaKpmResolvedBinaryDependency -> resolvedBinaryDependency = IdeaKpmResolvedBinaryDependencyProto(dependency)
|
||||||
@@ -21,7 +25,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmDependencyProto(dependency: Idea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmDependency(proto: IdeaKpmDependencyProto): IdeaKpmDependency? {
|
internal fun IdeaSerializationContext.IdeaKpmDependency(proto: IdeaKpmDependencyProto): IdeaKpmDependency? {
|
||||||
return when (proto.dependencyCase) {
|
return when (proto.dependencyCase) {
|
||||||
DependencyCase.UNRESOLVED_BINARY_DEPENDENCY -> IdeaKpmUnresolvedBinaryDependency(proto.unresolvedBinaryDependency)
|
DependencyCase.UNRESOLVED_BINARY_DEPENDENCY -> IdeaKpmUnresolvedBinaryDependency(proto.unresolvedBinaryDependency)
|
||||||
DependencyCase.RESOLVED_BINARY_DEPENDENCY -> IdeaKpmResolvedBinaryDependency(proto.resolvedBinaryDependency)
|
DependencyCase.RESOLVED_BINARY_DEPENDENCY -> IdeaKpmResolvedBinaryDependency(proto.resolvedBinaryDependency)
|
||||||
|
|||||||
+5
-5
@@ -6,19 +6,19 @@
|
|||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import com.google.protobuf.ByteString
|
import com.google.protobuf.ByteString
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializer
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializer
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
import org.jetbrains.kotlin.tooling.core.toExtras
|
import org.jetbrains.kotlin.tooling.core.toExtras
|
||||||
import org.jetbrains.kotlin.tooling.core.withValue
|
import org.jetbrains.kotlin.tooling.core.withValue
|
||||||
|
|
||||||
@Suppress("unchecked_cast")
|
@Suppress("unchecked_cast")
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmExtrasProto(extras: Extras): IdeaKpmExtrasProto {
|
internal fun IdeaSerializationContext.IdeaKpmExtrasProto(extras: Extras): IdeaKpmExtrasProto {
|
||||||
val context = this
|
val context = this
|
||||||
return ideaKpmExtrasProto {
|
return ideaKpmExtrasProto {
|
||||||
extras.entries.forEach { (key, value) ->
|
extras.entries.forEach { (key, value) ->
|
||||||
val serializer = context.extrasSerializationExtension.serializer(key) ?: return@forEach
|
val serializer = context.extrasSerializationExtension.serializer(key) ?: return@forEach
|
||||||
serializer as IdeaKpmExtrasSerializer<Any>
|
serializer as IdeaExtrasSerializer<Any>
|
||||||
val serialized = runCatching { serializer.serialize(context, value) ?: return@forEach }.getOrElse { exception ->
|
val serialized = runCatching { serializer.serialize(context, value) ?: return@forEach }.getOrElse { exception ->
|
||||||
logger.error("Failed to serialize $key, using ${serializer.javaClass.simpleName}", exception)
|
logger.error("Failed to serialize $key, using ${serializer.javaClass.simpleName}", exception)
|
||||||
return@forEach
|
return@forEach
|
||||||
@@ -30,7 +30,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmExtrasProto(extras: Extras): Ide
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unchecked_cast")
|
@Suppress("unchecked_cast")
|
||||||
internal fun IdeaKpmSerializationContext.Extras(proto: IdeaKpmExtrasProto): Extras {
|
internal fun IdeaSerializationContext.Extras(proto: IdeaKpmExtrasProto): Extras {
|
||||||
return proto.valuesMap.entries.mapNotNull { (keyString, value) ->
|
return proto.valuesMap.entries.mapNotNull { (keyString, value) ->
|
||||||
val key = Extras.Key.fromString(keyString) as Extras.Key<Any>
|
val key = Extras.Key.fromString(keyString) as Extras.Key<Any>
|
||||||
val serializer = extrasSerializationExtension.serializer(key) ?: return@mapNotNull null
|
val serializer = extrasSerializationExtension.serializer(key) ?: return@mapNotNull null
|
||||||
|
|||||||
+7
-7
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragment
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragment
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmFragmentProto(fragment: IdeaKpmFragment): IdeaKpmFragmentProto {
|
internal fun IdeaSerializationContext.IdeaKpmFragmentProto(fragment: IdeaKpmFragment): IdeaKpmFragmentProto {
|
||||||
return ideaKpmFragmentProto {
|
return ideaKpmFragmentProto {
|
||||||
coordinates = IdeaKpmFragmentCoordinatesProto(fragment.coordinates)
|
coordinates = IdeaKpmFragmentCoordinatesProto(fragment.coordinates)
|
||||||
platforms.addAll(fragment.platforms.map { IdeaKpmPlatformProto(it) })
|
platforms.addAll(fragment.platforms.map { IdeaKpmPlatformProto(it) })
|
||||||
@@ -20,7 +20,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmFragmentProto(fragment: IdeaKpmF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmFragment(proto: IdeaKpmFragmentProto): IdeaKpmFragment {
|
internal fun IdeaSerializationContext.IdeaKpmFragment(proto: IdeaKpmFragmentProto): IdeaKpmFragment {
|
||||||
return IdeaKpmFragmentImpl(
|
return IdeaKpmFragmentImpl(
|
||||||
coordinates = IdeaKpmFragmentCoordinates(proto.coordinates),
|
coordinates = IdeaKpmFragmentCoordinates(proto.coordinates),
|
||||||
platforms = proto.platformsList.map { IdeaKpmPlatform(it) }.toSet(),
|
platforms = proto.platformsList.map { IdeaKpmPlatform(it) }.toSet(),
|
||||||
@@ -31,10 +31,10 @@ internal fun IdeaKpmSerializationContext.IdeaKpmFragment(proto: IdeaKpmFragmentP
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmFragment(data: ByteArray): IdeaKpmFragment {
|
internal fun IdeaSerializationContext.IdeaKpmFragment(data: ByteArray): IdeaKpmFragment {
|
||||||
return IdeaKpmFragment(IdeaKpmFragmentProto.parseFrom(data))
|
return IdeaKpmFragment(IdeaKpmFragmentProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmFragment.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmFragment.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmFragmentProto(this).toByteArray()
|
return context.IdeaKpmFragmentProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentCoordinatesImpl
|
||||||
|
|
||||||
internal fun IdeaKpmFragmentCoordinatesProto(coordinates: IdeaKpmFragmentCoordinates): IdeaKpmFragmentCoordinatesProto {
|
internal fun IdeaKpmFragmentCoordinatesProto(coordinates: IdeaKpmFragmentCoordinates): IdeaKpmFragmentCoordinatesProto {
|
||||||
return ideaKpmFragmentCoordinatesProto {
|
return ideaKpmFragmentCoordinatesProto {
|
||||||
|
|||||||
+7
-7
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentDependencyImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmFragmentDependencyProto(dependency: IdeaKpmFragmentDependency): IdeaKpmFragmentDependencyProto {
|
internal fun IdeaSerializationContext.IdeaKpmFragmentDependencyProto(dependency: IdeaKpmFragmentDependency): IdeaKpmFragmentDependencyProto {
|
||||||
return ideaKpmFragmentDependencyProto {
|
return ideaKpmFragmentDependencyProto {
|
||||||
type = when (dependency.type) {
|
type = when (dependency.type) {
|
||||||
IdeaKpmFragmentDependency.Type.Regular -> IdeaKpmFragmentDependencyProto.Type.REGULAR
|
IdeaKpmFragmentDependency.Type.Regular -> IdeaKpmFragmentDependencyProto.Type.REGULAR
|
||||||
@@ -22,7 +22,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmFragmentDependencyProto(dependen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmFragmentDependency(proto: IdeaKpmFragmentDependencyProto): IdeaKpmFragmentDependency {
|
internal fun IdeaSerializationContext.IdeaKpmFragmentDependency(proto: IdeaKpmFragmentDependencyProto): IdeaKpmFragmentDependency {
|
||||||
return IdeaKpmFragmentDependencyImpl(
|
return IdeaKpmFragmentDependencyImpl(
|
||||||
type = when (proto.type) {
|
type = when (proto.type) {
|
||||||
IdeaKpmFragmentDependencyProto.Type.REGULAR -> IdeaKpmFragmentDependency.Type.Regular
|
IdeaKpmFragmentDependencyProto.Type.REGULAR -> IdeaKpmFragmentDependency.Type.Regular
|
||||||
@@ -35,10 +35,10 @@ internal fun IdeaKpmSerializationContext.IdeaKpmFragmentDependency(proto: IdeaKp
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmFragmentDependency(data: ByteArray): IdeaKpmFragmentDependency {
|
internal fun IdeaSerializationContext.IdeaKpmFragmentDependency(data: ByteArray): IdeaKpmFragmentDependency {
|
||||||
return IdeaKpmFragmentDependency(IdeaKpmFragmentDependencyProto.parseFrom(data))
|
return IdeaKpmFragmentDependency(IdeaKpmFragmentDependencyProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmFragmentDependency.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmFragmentDependency.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmFragmentDependencyProto(this).toByteArray()
|
return context.IdeaKpmFragmentDependencyProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@
|
|||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmLanguageSettings
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmLanguageSettings
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmLanguageSettingsImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmLanguageSettingsImpl
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal fun IdeaKpmLanguageSettingsProto(languageSettings: IdeaKpmLanguageSettings): IdeaKpmLanguageSettingsProto {
|
internal fun IdeaKpmLanguageSettingsProto(languageSettings: IdeaKpmLanguageSettings): IdeaKpmLanguageSettingsProto {
|
||||||
|
|||||||
+8
-8
@@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModule
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModule
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModuleImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModuleImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmVariant
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmVariant
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmModuleProto(module: IdeaKpmModule): IdeaKpmModuleProto {
|
internal fun IdeaSerializationContext.IdeaKpmModuleProto(module: IdeaKpmModule): IdeaKpmModuleProto {
|
||||||
return ideaKpmModuleProto {
|
return ideaKpmModuleProto {
|
||||||
coordinates = IdeaKpmModuleCoordinatesProto(module.coordinates)
|
coordinates = IdeaKpmModuleCoordinatesProto(module.coordinates)
|
||||||
fragments.addAll(module.fragments.filter { it !is IdeaKpmVariant }.map { IdeaKpmFragmentProto(it) })
|
fragments.addAll(module.fragments.filter { it !is IdeaKpmVariant }.map { IdeaKpmFragmentProto(it) })
|
||||||
@@ -18,17 +18,17 @@ internal fun IdeaKpmSerializationContext.IdeaKpmModuleProto(module: IdeaKpmModul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmModule(proto: IdeaKpmModuleProto): IdeaKpmModule {
|
internal fun IdeaSerializationContext.IdeaKpmModule(proto: IdeaKpmModuleProto): IdeaKpmModule {
|
||||||
return IdeaKpmModuleImpl(
|
return IdeaKpmModuleImpl(
|
||||||
coordinates = IdeaKpmModuleCoordinates(proto.coordinates),
|
coordinates = IdeaKpmModuleCoordinates(proto.coordinates),
|
||||||
fragments = proto.fragmentsList.map { IdeaKpmFragment(it) } + proto.variantsList.map { IdeaKpmVariant(it) }
|
fragments = proto.fragmentsList.map { IdeaKpmFragment(it) } + proto.variantsList.map { IdeaKpmVariant(it) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmModule(data: ByteArray): IdeaKpmModule {
|
internal fun IdeaSerializationContext.IdeaKpmModule(data: ByteArray): IdeaKpmModule {
|
||||||
return IdeaKpmModule(IdeaKpmModuleProto.parseFrom(data))
|
return IdeaKpmModule(IdeaKpmModuleProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmModule.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmModule.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmModuleProto(this).toByteArray()
|
return context.IdeaKpmModuleProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModuleCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModuleCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModuleCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModuleCoordinatesImpl
|
||||||
|
|
||||||
internal fun IdeaKpmModuleCoordinatesProto(coordinates: IdeaKpmModuleCoordinates): IdeaKpmModuleCoordinatesProto {
|
internal fun IdeaKpmModuleCoordinatesProto(coordinates: IdeaKpmModuleCoordinates): IdeaKpmModuleCoordinatesProto {
|
||||||
return ideaKpmModuleCoordinatesProto {
|
return ideaKpmModuleCoordinatesProto {
|
||||||
|
|||||||
+24
-24
@@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
import org.jetbrains.kotlin.gradle.idea.kpm.*
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmPlatformProto(platform: IdeaKpmPlatform): IdeaKpmPlatformProto {
|
internal fun IdeaSerializationContext.IdeaKpmPlatformProto(platform: IdeaKpmPlatform): IdeaKpmPlatformProto {
|
||||||
return ideaKpmPlatformProto {
|
return ideaKpmPlatformProto {
|
||||||
when (platform) {
|
when (platform) {
|
||||||
is IdeaKpmJsPlatformImpl -> js = IdeaKpmJsPlatformProto(platform)
|
is IdeaKpmJsPlatformImpl -> js = IdeaKpmJsPlatformProto(platform)
|
||||||
@@ -20,7 +20,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmPlatformProto(platform: IdeaKpmP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmPlatform(proto: IdeaKpmPlatformProto): IdeaKpmPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmPlatform(proto: IdeaKpmPlatformProto): IdeaKpmPlatform {
|
||||||
return when (proto.platformCase) {
|
return when (proto.platformCase) {
|
||||||
IdeaKpmPlatformProto.PlatformCase.JVM -> IdeaKpmJvmPlatform(proto.jvm)
|
IdeaKpmPlatformProto.PlatformCase.JVM -> IdeaKpmJvmPlatform(proto.jvm)
|
||||||
IdeaKpmPlatformProto.PlatformCase.NATIVE -> IdeaKpmNativePlatform(proto.native)
|
IdeaKpmPlatformProto.PlatformCase.NATIVE -> IdeaKpmNativePlatform(proto.native)
|
||||||
@@ -33,116 +33,116 @@ internal fun IdeaKpmSerializationContext.IdeaKpmPlatform(proto: IdeaKpmPlatformP
|
|||||||
|
|
||||||
/* Jvm */
|
/* Jvm */
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmJvmPlatformProto(platform: IdeaKpmJvmPlatform): IdeaKpmJvmPlatformProto {
|
internal fun IdeaSerializationContext.IdeaKpmJvmPlatformProto(platform: IdeaKpmJvmPlatform): IdeaKpmJvmPlatformProto {
|
||||||
return ideaKpmJvmPlatformProto {
|
return ideaKpmJvmPlatformProto {
|
||||||
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
||||||
jvmTarget = platform.jvmTarget
|
jvmTarget = platform.jvmTarget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmJvmPlatform(proto: IdeaKpmJvmPlatformProto): IdeaKpmJvmPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmJvmPlatform(proto: IdeaKpmJvmPlatformProto): IdeaKpmJvmPlatform {
|
||||||
return IdeaKpmJvmPlatformImpl(
|
return IdeaKpmJvmPlatformImpl(
|
||||||
jvmTarget = proto.jvmTarget,
|
jvmTarget = proto.jvmTarget,
|
||||||
extras = Extras(proto.extras)
|
extras = Extras(proto.extras)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmJvmPlatform(data: ByteArray): IdeaKpmJvmPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmJvmPlatform(data: ByteArray): IdeaKpmJvmPlatform {
|
||||||
return IdeaKpmJvmPlatform(IdeaKpmJvmPlatformProto.parseFrom(data))
|
return IdeaKpmJvmPlatform(IdeaKpmJvmPlatformProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmJvmPlatform.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmJvmPlatform.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmJvmPlatformProto(this).toByteArray()
|
return context.IdeaKpmJvmPlatformProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Native */
|
/* Native */
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmNativePlatformProto(platform: IdeaKpmNativePlatform): IdeaKpmNativePlatformProto {
|
internal fun IdeaSerializationContext.IdeaKpmNativePlatformProto(platform: IdeaKpmNativePlatform): IdeaKpmNativePlatformProto {
|
||||||
return ideaKpmNativePlatformProto {
|
return ideaKpmNativePlatformProto {
|
||||||
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
||||||
konanTarget = platform.konanTarget
|
konanTarget = platform.konanTarget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmNativePlatform(proto: IdeaKpmNativePlatformProto): IdeaKpmNativePlatform {
|
internal fun IdeaSerializationContext.IdeaKpmNativePlatform(proto: IdeaKpmNativePlatformProto): IdeaKpmNativePlatform {
|
||||||
return IdeaKpmNativePlatformImpl(
|
return IdeaKpmNativePlatformImpl(
|
||||||
konanTarget = proto.konanTarget,
|
konanTarget = proto.konanTarget,
|
||||||
extras = Extras(proto.extras)
|
extras = Extras(proto.extras)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmNativePlatform(data: ByteArray): IdeaKpmNativePlatform {
|
internal fun IdeaSerializationContext.IdeaKpmNativePlatform(data: ByteArray): IdeaKpmNativePlatform {
|
||||||
return IdeaKpmNativePlatform(IdeaKpmNativePlatformProto.parseFrom(data))
|
return IdeaKpmNativePlatform(IdeaKpmNativePlatformProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmNativePlatform.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmNativePlatform.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmNativePlatformProto(this).toByteArray()
|
return context.IdeaKpmNativePlatformProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Js */
|
/* Js */
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmJsPlatformProto(platform: IdeaKpmJsPlatform): IdeaKpmJsPlatformProto {
|
internal fun IdeaSerializationContext.IdeaKpmJsPlatformProto(platform: IdeaKpmJsPlatform): IdeaKpmJsPlatformProto {
|
||||||
return ideaKpmJsPlatformProto {
|
return ideaKpmJsPlatformProto {
|
||||||
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
||||||
isIr = platform.isIr
|
isIr = platform.isIr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmJsPlatform(proto: IdeaKpmJsPlatformProto): IdeaKpmJsPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmJsPlatform(proto: IdeaKpmJsPlatformProto): IdeaKpmJsPlatform {
|
||||||
return IdeaKpmJsPlatformImpl(
|
return IdeaKpmJsPlatformImpl(
|
||||||
isIr = proto.isIr,
|
isIr = proto.isIr,
|
||||||
extras = Extras(proto.extras)
|
extras = Extras(proto.extras)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmJsPlatform(data: ByteArray): IdeaKpmJsPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmJsPlatform(data: ByteArray): IdeaKpmJsPlatform {
|
||||||
return IdeaKpmJsPlatform(IdeaKpmJsPlatformProto.parseFrom(data))
|
return IdeaKpmJsPlatform(IdeaKpmJsPlatformProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmJsPlatform.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmJsPlatform.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmJsPlatformProto(this).toByteArray()
|
return context.IdeaKpmJsPlatformProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wasm */
|
/* Wasm */
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmWasmPlatformProto(platform: IdeaKpmWasmPlatform): IdeaKpmWasmPlatformProto {
|
internal fun IdeaSerializationContext.IdeaKpmWasmPlatformProto(platform: IdeaKpmWasmPlatform): IdeaKpmWasmPlatformProto {
|
||||||
return ideaKpmWasmPlatformProto {
|
return ideaKpmWasmPlatformProto {
|
||||||
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmWasmPlatform(proto: IdeaKpmWasmPlatformProto): IdeaKpmWasmPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmWasmPlatform(proto: IdeaKpmWasmPlatformProto): IdeaKpmWasmPlatform {
|
||||||
return IdeaKpmWasmPlatformImpl(
|
return IdeaKpmWasmPlatformImpl(
|
||||||
extras = Extras(proto.extras)
|
extras = Extras(proto.extras)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmWasmPlatform(data: ByteArray): IdeaKpmWasmPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmWasmPlatform(data: ByteArray): IdeaKpmWasmPlatform {
|
||||||
return IdeaKpmWasmPlatform(IdeaKpmWasmPlatformProto.parseFrom(data))
|
return IdeaKpmWasmPlatform(IdeaKpmWasmPlatformProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmWasmPlatform.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmWasmPlatform.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmWasmPlatformProto(this).toByteArray()
|
return context.IdeaKpmWasmPlatformProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unknown */
|
/* Unknown */
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmUnknownPlatformProto(platform: IdeaKpmUnknownPlatform): IdeaKpmUnknownPlatformProto {
|
internal fun IdeaSerializationContext.IdeaKpmUnknownPlatformProto(platform: IdeaKpmUnknownPlatform): IdeaKpmUnknownPlatformProto {
|
||||||
return ideaKpmUnknownPlatformProto {
|
return ideaKpmUnknownPlatformProto {
|
||||||
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
if (platform.extras.isNotEmpty()) extras = IdeaKpmExtrasProto(platform.extras)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmUnknownPlatform(proto: IdeaKpmUnknownPlatformProto): IdeaKpmUnknownPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmUnknownPlatform(proto: IdeaKpmUnknownPlatformProto): IdeaKpmUnknownPlatform {
|
||||||
return IdeaKpmUnknownPlatformImpl(
|
return IdeaKpmUnknownPlatformImpl(
|
||||||
extras = Extras(proto.extras)
|
extras = Extras(proto.extras)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmUnknownPlatform(data: ByteArray): IdeaKpmUnknownPlatform {
|
internal fun IdeaSerializationContext.IdeaKpmUnknownPlatform(data: ByteArray): IdeaKpmUnknownPlatform {
|
||||||
return IdeaKpmUnknownPlatform(IdeaKpmUnknownPlatformProto.parseFrom(data))
|
return IdeaKpmUnknownPlatform(IdeaKpmUnknownPlatformProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmUnknownPlatform.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmUnknownPlatform.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmUnknownPlatformProto(this).toByteArray()
|
return context.IdeaKpmUnknownPlatformProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProject
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProject
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProjectImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmProjectProto(project: IdeaKpmProject): IdeaKpmProjectProto {
|
internal fun IdeaSerializationContext.IdeaKpmProjectProto(project: IdeaKpmProject): IdeaKpmProjectProto {
|
||||||
return ideaKpmProjectProto {
|
return ideaKpmProjectProto {
|
||||||
gradlePluginVersion = project.gradlePluginVersion
|
gradlePluginVersion = project.gradlePluginVersion
|
||||||
coreLibrariesVersion = project.coreLibrariesVersion
|
coreLibrariesVersion = project.coreLibrariesVersion
|
||||||
@@ -20,7 +20,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmProjectProto(project: IdeaKpmPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmProject(proto: IdeaKpmProjectProto): IdeaKpmProject {
|
internal fun IdeaSerializationContext.IdeaKpmProject(proto: IdeaKpmProjectProto): IdeaKpmProject {
|
||||||
return IdeaKpmProjectImpl(
|
return IdeaKpmProjectImpl(
|
||||||
gradlePluginVersion = proto.gradlePluginVersion,
|
gradlePluginVersion = proto.gradlePluginVersion,
|
||||||
coreLibrariesVersion = proto.coreLibrariesVersion,
|
coreLibrariesVersion = proto.coreLibrariesVersion,
|
||||||
|
|||||||
+7
-7
@@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmResolvedBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmResolvedBinaryDependencyImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmResolvedBinaryDependencyProto(
|
internal fun IdeaSerializationContext.IdeaKpmResolvedBinaryDependencyProto(
|
||||||
dependency: IdeaKpmResolvedBinaryDependency
|
dependency: IdeaKpmResolvedBinaryDependency
|
||||||
): IdeaKpmResolvedBinaryDependencyProto {
|
): IdeaKpmResolvedBinaryDependencyProto {
|
||||||
return ideaKpmResolvedBinaryDependencyProto {
|
return ideaKpmResolvedBinaryDependencyProto {
|
||||||
@@ -21,7 +21,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmResolvedBinaryDependencyProto(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmResolvedBinaryDependency(
|
internal fun IdeaSerializationContext.IdeaKpmResolvedBinaryDependency(
|
||||||
proto: IdeaKpmResolvedBinaryDependencyProto
|
proto: IdeaKpmResolvedBinaryDependencyProto
|
||||||
): IdeaKpmResolvedBinaryDependency {
|
): IdeaKpmResolvedBinaryDependency {
|
||||||
return IdeaKpmResolvedBinaryDependencyImpl(
|
return IdeaKpmResolvedBinaryDependencyImpl(
|
||||||
@@ -32,10 +32,10 @@ internal fun IdeaKpmSerializationContext.IdeaKpmResolvedBinaryDependency(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmResolvedBinaryDependency(data: ByteArray): IdeaKpmResolvedBinaryDependency {
|
internal fun IdeaSerializationContext.IdeaKpmResolvedBinaryDependency(data: ByteArray): IdeaKpmResolvedBinaryDependency {
|
||||||
return IdeaKpmResolvedBinaryDependency(IdeaKpmResolvedBinaryDependencyProto.parseFrom(data))
|
return IdeaKpmResolvedBinaryDependency(IdeaKpmResolvedBinaryDependencyProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmResolvedBinaryDependency.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmResolvedBinaryDependency.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmResolvedBinaryDependencyProto(this).toByteArray()
|
return context.IdeaKpmResolvedBinaryDependencyProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmUnresolvedBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmUnresolvedBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmUnresolvedBinaryDependencyImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmUnresolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmUnresolvedBinaryDependencyProto(
|
internal fun IdeaSerializationContext.IdeaKpmUnresolvedBinaryDependencyProto(
|
||||||
dependency: IdeaKpmUnresolvedBinaryDependency
|
dependency: IdeaKpmUnresolvedBinaryDependency
|
||||||
): IdeaKpmUnresolvedBinaryDependencyProto {
|
): IdeaKpmUnresolvedBinaryDependencyProto {
|
||||||
return ideaKpmUnresolvedBinaryDependencyProto {
|
return ideaKpmUnresolvedBinaryDependencyProto {
|
||||||
@@ -19,7 +19,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmUnresolvedBinaryDependencyProto(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmUnresolvedBinaryDependency(proto: IdeaKpmUnresolvedBinaryDependencyProto): IdeaKpmUnresolvedBinaryDependency {
|
internal fun IdeaSerializationContext.IdeaKpmUnresolvedBinaryDependency(proto: IdeaKpmUnresolvedBinaryDependencyProto): IdeaKpmUnresolvedBinaryDependency {
|
||||||
return IdeaKpmUnresolvedBinaryDependencyImpl(
|
return IdeaKpmUnresolvedBinaryDependencyImpl(
|
||||||
cause = if (proto.hasCause()) proto.cause else null,
|
cause = if (proto.hasCause()) proto.cause else null,
|
||||||
coordinates = if (proto.hasCoordinates()) IdeaKpmBinaryCoordinates(proto.coordinates) else null,
|
coordinates = if (proto.hasCoordinates()) IdeaKpmBinaryCoordinates(proto.coordinates) else null,
|
||||||
@@ -27,10 +27,10 @@ internal fun IdeaKpmSerializationContext.IdeaKpmUnresolvedBinaryDependency(proto
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmUnresolvedBinaryDependency(data: ByteArray): IdeaKpmUnresolvedBinaryDependency {
|
internal fun IdeaSerializationContext.IdeaKpmUnresolvedBinaryDependency(data: ByteArray): IdeaKpmUnresolvedBinaryDependency {
|
||||||
return IdeaKpmUnresolvedBinaryDependency(IdeaKpmUnresolvedBinaryDependencyProto.parseFrom(data))
|
return IdeaKpmUnresolvedBinaryDependency(IdeaKpmUnresolvedBinaryDependencyProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmUnresolvedBinaryDependency.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmUnresolvedBinaryDependency.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmUnresolvedBinaryDependencyProto(this).toByteArray()
|
return context.IdeaKpmUnresolvedBinaryDependencyProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmVariant
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmVariant
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmVariantImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmVariantImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmVariantProto(variant: IdeaKpmVariant): IdeaKpmVariantProto {
|
internal fun IdeaSerializationContext.IdeaKpmVariantProto(variant: IdeaKpmVariant): IdeaKpmVariantProto {
|
||||||
return ideaKpmVariantProto {
|
return ideaKpmVariantProto {
|
||||||
fragment = IdeaKpmFragmentProto(variant)
|
fragment = IdeaKpmFragmentProto(variant)
|
||||||
variantAttributes.putAll(variant.variantAttributes)
|
variantAttributes.putAll(variant.variantAttributes)
|
||||||
@@ -19,7 +19,7 @@ internal fun IdeaKpmSerializationContext.IdeaKpmVariantProto(variant: IdeaKpmVar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmVariant(proto: IdeaKpmVariantProto): IdeaKpmVariant {
|
internal fun IdeaSerializationContext.IdeaKpmVariant(proto: IdeaKpmVariantProto): IdeaKpmVariant {
|
||||||
return IdeaKpmVariantImpl(
|
return IdeaKpmVariantImpl(
|
||||||
fragment = IdeaKpmFragment(proto.fragment),
|
fragment = IdeaKpmFragment(proto.fragment),
|
||||||
platform = IdeaKpmPlatform(proto.platform),
|
platform = IdeaKpmPlatform(proto.platform),
|
||||||
@@ -28,10 +28,10 @@ internal fun IdeaKpmSerializationContext.IdeaKpmVariant(proto: IdeaKpmVariantPro
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmSerializationContext.IdeaKpmVariant(data: ByteArray): IdeaKpmVariant {
|
internal fun IdeaSerializationContext.IdeaKpmVariant(data: ByteArray): IdeaKpmVariant {
|
||||||
return IdeaKpmVariant(IdeaKpmVariantProto.parseFrom(data))
|
return IdeaKpmVariant(IdeaKpmVariantProto.parseFrom(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun IdeaKpmVariant.toByteArray(context: IdeaKpmSerializationContext): ByteArray {
|
internal fun IdeaKpmVariant.toByteArray(context: IdeaSerializationContext): ByteArray {
|
||||||
return context.IdeaKpmVariantProto(this).toByteArray()
|
return context.IdeaKpmVariantProto(this).toByteArray()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmExtrasSerializationExtension
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmExtrasSerializationExtension
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmSerializationLogger
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaSerializationLogger
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
abstract class AbstractSerializationTest<T : Any> : IdeaKpmSerializationContext {
|
abstract class AbstractSerializationTest<T : Any> : IdeaSerializationContext {
|
||||||
|
|
||||||
final override val logger = TestIdeaKpmSerializationLogger()
|
final override val logger = TestIdeaSerializationLogger()
|
||||||
final override val extrasSerializationExtension = TestIdeaKpmExtrasSerializationExtension
|
final override val extrasSerializationExtension = TestIdeaKpmExtrasSerializationExtension
|
||||||
|
|
||||||
abstract fun serialize(value: T): ByteArray
|
abstract fun serialize(value: T): ByteArray
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class BinaryCoordinatesTest : AbstractSerializationTest<IdeaKpmBinaryCoordinates>() {
|
class BinaryCoordinatesTest : AbstractSerializationTest<IdeaKpmBinaryCoordinates>() {
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmCompilationOutput
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmCompilationOutput
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmCompilationOutputImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmCompilationOutputImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -5,17 +5,17 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmExtrasSerializationExtension
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmExtrasSerializationExtension
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmSerializationLogger
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaSerializationLogger
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ContainerTest : IdeaKpmSerializationContext {
|
class ContainerTest : IdeaSerializationContext {
|
||||||
override val logger = TestIdeaKpmSerializationLogger()
|
override val logger = TestIdeaSerializationLogger()
|
||||||
override val extrasSerializationExtension = TestIdeaKpmExtrasSerializationExtension
|
override val extrasSerializationExtension = TestIdeaKpmExtrasSerializationExtension
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+3
-3
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentCoordinatesImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModuleCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModuleCoordinatesImpl
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class FragmentCoordinatesTest : AbstractSerializationTest<IdeaKpmFragmentCoordinates>() {
|
class FragmentCoordinatesTest : AbstractSerializationTest<IdeaKpmFragmentCoordinates>() {
|
||||||
|
|||||||
+4
-6
@@ -5,16 +5,14 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentCoordinatesImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentDependencyImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModuleCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModuleCoordinatesImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasOf
|
import org.jetbrains.kotlin.tooling.core.extrasOf
|
||||||
import org.jetbrains.kotlin.tooling.core.withValue
|
import org.jetbrains.kotlin.tooling.core.withValue
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class FragmentDependencyTest : AbstractSerializationTest<IdeaKpmFragmentDependency>() {
|
class FragmentDependencyTest : AbstractSerializationTest<IdeaKpmFragmentDependency>() {
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
import org.jetbrains.kotlin.gradle.idea.kpm.*
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmLanguageSettings
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmLanguageSettings
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmLanguageSettingsImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmLanguageSettingsImpl
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModuleCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModuleCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModuleCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModuleCoordinatesImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmModule
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmModule
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
import org.jetbrains.kotlin.gradle.idea.kpm.*
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProject
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProject
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -5,17 +5,15 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmResolvedBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmResolvedBinaryDependencyImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
|
||||||
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasOf
|
import org.jetbrains.kotlin.tooling.core.extrasOf
|
||||||
import org.jetbrains.kotlin.tooling.core.withValue
|
import org.jetbrains.kotlin.tooling.core.withValue
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class ResolvedBinaryDependencyTest : AbstractSerializationTest<IdeaKpmResolvedBinaryDependency>() {
|
class ResolvedBinaryDependencyTest : AbstractSerializationTest<IdeaKpmResolvedBinaryDependency>() {
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRoot
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmContentRoot
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRootImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmContentRootImpl
|
||||||
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasOf
|
import org.jetbrains.kotlin.tooling.core.extrasOf
|
||||||
|
|||||||
+3
-5
@@ -5,16 +5,14 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmUnresolvedBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmUnresolvedBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmUnresolvedBinaryDependencyImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmUnresolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
|
||||||
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasOf
|
import org.jetbrains.kotlin.tooling.core.extrasOf
|
||||||
import org.jetbrains.kotlin.tooling.core.withValue
|
import org.jetbrains.kotlin.tooling.core.withValue
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class UnresolvedBinaryTest : AbstractSerializationTest<IdeaKpmUnresolvedBinaryDependency>() {
|
class UnresolvedBinaryTest : AbstractSerializationTest<IdeaKpmUnresolvedBinaryDependency>() {
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kpm.idea.proto
|
package org.jetbrains.kotlin.kpm.idea.proto
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmVariant
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmVariant
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+3
-3
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
@file:Suppress("unused")
|
@file:Suppress("unused")
|
||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRoot.Companion.RESOURCES_TYPE
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmContentRoot.Companion.RESOURCES_TYPE
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRoot.Companion.SOURCES_TYPE
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmContentRoot.Companion.SOURCES_TYPE
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+4
-4
@@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
@file:Suppress("FunctionName")
|
@file:Suppress("FunctionName")
|
||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmDependency.Companion.CLASSPATH_BINARY_TYPE
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency.Companion.CLASSPATH_BINARY_TYPE
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmDependency.Companion.DOCUMENTATION_BINARY_TYPE
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency.Companion.DOCUMENTATION_BINARY_TYPE
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmDependency.Companion.SOURCES_BINARY_TYPE
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency.Companion.SOURCES_BINARY_TYPE
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
@file:Suppress("unused")
|
@file:Suppress("unused")
|
||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
@file:Suppress("FunctionName")
|
@file:Suppress("FunctionName")
|
||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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.gradle.idea.serialize
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
|
|
||||||
|
interface IdeaExtrasSerializationExtension {
|
||||||
|
fun <T : Any> serializer(key: Extras.Key<T>): IdeaExtrasSerializer<T>?
|
||||||
|
|
||||||
|
object Empty : IdeaExtrasSerializationExtension {
|
||||||
|
override fun <T : Any> serializer(key: Extras.Key<T>): IdeaExtrasSerializer<T>? = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IdeaExtrasSerializationExtensionBuilder {
|
||||||
|
fun <T : Any> register(key: Extras.Key<T>, serializer: IdeaExtrasSerializer<T>)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun IdeaExtrasSerializationExtension(
|
||||||
|
builder: IdeaExtrasSerializationExtensionBuilder.() -> Unit
|
||||||
|
): IdeaExtrasSerializationExtension {
|
||||||
|
return IdeaExtrasSerializationExtensionImpl(
|
||||||
|
IdeaExtrasSerializationExtensionBuilderImpl().apply(builder).serializers
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private class IdeaExtrasSerializationExtensionBuilderImpl : IdeaExtrasSerializationExtensionBuilder {
|
||||||
|
val serializers = mutableMapOf<Extras.Key<*>, IdeaExtrasSerializer<*>>()
|
||||||
|
|
||||||
|
override fun <T : Any> register(key: Extras.Key<T>, serializer: IdeaExtrasSerializer<T>) {
|
||||||
|
serializers[key] = serializer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class IdeaExtrasSerializationExtensionImpl(
|
||||||
|
private val map: Map<Extras.Key<*>, IdeaExtrasSerializer<*>>
|
||||||
|
) : IdeaExtrasSerializationExtension {
|
||||||
|
override fun <T : Any> serializer(key: Extras.Key<T>): IdeaExtrasSerializer<T>? {
|
||||||
|
@Suppress("unchecked_cast")
|
||||||
|
return map[key] as? IdeaExtrasSerializer<T>
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* 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.gradle.idea.serialize
|
||||||
|
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
|
|
||||||
|
interface IdeaExtrasSerializer<T : Any> {
|
||||||
|
fun serialize(context: IdeaSerializationContext, value: T): ByteArray?
|
||||||
|
fun deserialize(context: IdeaSerializationContext, data: ByteArray): T?
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* Returns a [IdeaExtrasSerializer] based upon [java.io.Serializable]
|
||||||
|
*/
|
||||||
|
fun <T : Any> javaIoSerializable(clazz: KClass<T>): IdeaExtrasSerializer<T> {
|
||||||
|
return IdeaJavaIoSerializableExtrasSerializer(clazz)
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T : Any> javaIoSerializable(): IdeaExtrasSerializer<T> {
|
||||||
|
return javaIoSerializable(T::class)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-5
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.plugin.ide
|
package org.jetbrains.kotlin.gradle.idea.serialize
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
@@ -11,11 +11,11 @@ import java.io.ObjectInputStream
|
|||||||
import java.io.ObjectOutputStream
|
import java.io.ObjectOutputStream
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
internal class IdeJavaIoSerializableExtrasSerializer<T : Any>(
|
internal class IdeaJavaIoSerializableExtrasSerializer<T : Any>(
|
||||||
private val clazz: KClass<T>
|
private val clazz: KClass<T>
|
||||||
) : IdeExtrasSerializer<T> {
|
) : IdeaExtrasSerializer<T> {
|
||||||
|
|
||||||
override fun serialize(context: IdeSerializationContext, value: T): ByteArray? {
|
override fun serialize(context: IdeaSerializationContext, value: T): ByteArray? {
|
||||||
return try {
|
return try {
|
||||||
ByteArrayOutputStream().use { byteArrayOutputStream ->
|
ByteArrayOutputStream().use { byteArrayOutputStream ->
|
||||||
ObjectOutputStream(byteArrayOutputStream).use { oos -> oos.writeObject(value) }
|
ObjectOutputStream(byteArrayOutputStream).use { oos -> oos.writeObject(value) }
|
||||||
@@ -27,7 +27,7 @@ internal class IdeJavaIoSerializableExtrasSerializer<T : Any>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deserialize(context: IdeSerializationContext, data: ByteArray): T? {
|
override fun deserialize(context: IdeaSerializationContext, data: ByteArray): T? {
|
||||||
return try {
|
return try {
|
||||||
ObjectInputStream(ByteArrayInputStream(data)).use { stream -> clazz.java.cast(stream.readObject()) }
|
ObjectInputStream(ByteArrayInputStream(data)).use { stream -> clazz.java.cast(stream.readObject()) }
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
+4
-4
@@ -3,9 +3,9 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.plugin.ide
|
package org.jetbrains.kotlin.gradle.idea.serialize
|
||||||
|
|
||||||
interface IdeSerializationContext {
|
interface IdeaSerializationContext {
|
||||||
val logger: IdeSerializationLogger
|
val logger: IdeaSerializationLogger
|
||||||
val extrasSerializationExtension: IdeExtrasSerializationExtension
|
val extrasSerializationExtension: IdeaExtrasSerializationExtension
|
||||||
}
|
}
|
||||||
+3
-3
@@ -3,9 +3,9 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.plugin.ide
|
package org.jetbrains.kotlin.gradle.idea.serialize
|
||||||
|
|
||||||
interface IdeSerializationLogger {
|
interface IdeaSerializationLogger {
|
||||||
enum class Severity {
|
enum class Severity {
|
||||||
WARNING,
|
WARNING,
|
||||||
ERROR,
|
ERROR,
|
||||||
@@ -15,7 +15,7 @@ interface IdeSerializationLogger {
|
|||||||
fun warn(message: String, cause: Throwable? = null) = report(Severity.WARNING, message, cause)
|
fun warn(message: String, cause: Throwable? = null) = report(Severity.WARNING, message, cause)
|
||||||
fun error(message: String, cause: Throwable? = null) = report(Severity.ERROR, message, cause)
|
fun error(message: String, cause: Throwable? = null) = report(Severity.ERROR, message, cause)
|
||||||
|
|
||||||
object None : IdeSerializationLogger {
|
object None : IdeaSerializationLogger {
|
||||||
override fun report(severity: Severity, message: String, cause: Throwable?) = Unit
|
override fun report(severity: Severity, message: String, cause: Throwable?) = Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* 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.gradle.idea.tcs
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
sealed class IdeaKotlinBinaryDependency : IdeaKotlinDependency {
|
||||||
|
abstract override val coordinates: IdeaKotlinBinaryCoordinates?
|
||||||
|
}
|
||||||
|
|
||||||
|
data class IdeaKotlinResolvedBinaryDependency(
|
||||||
|
val binaryType: String,
|
||||||
|
val binaryFile: File,
|
||||||
|
override val extras: Extras,
|
||||||
|
override val coordinates: IdeaKotlinBinaryCoordinates?
|
||||||
|
) : IdeaKotlinBinaryDependency()
|
||||||
|
|
||||||
|
data class IdeaKotlinUnresolvedBinaryDependency(
|
||||||
|
val cause: String?,
|
||||||
|
override val coordinates: IdeaKotlinBinaryCoordinates?,
|
||||||
|
override val extras: Extras
|
||||||
|
) : IdeaKotlinBinaryDependency()
|
||||||
+19
@@ -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.gradle.idea.tcs
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
|
|
||||||
|
sealed interface IdeaKotlinDependency {
|
||||||
|
val coordinates: IdeaKotlinDependencyCoordinates?
|
||||||
|
val extras: Extras
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val CLASSPATH_BINARY_TYPE = "org.jetbrains.kotlin.gradle.idea.tcs.IdeDependency.classpathBinaryType"
|
||||||
|
const val SOURCES_BINARY_TYPE = "org.jetbrains.kotlin.gradle.idea.tcs.IdeDependency.sourcesBinaryType"
|
||||||
|
const val DOCUMENTATION_BINARY_TYPE = "org.jetbrains.kotlin.gradle.idea.tcs.IdeDependency.documentationBinaryType"
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-10
@@ -3,24 +3,20 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.plugin.ide
|
package org.jetbrains.kotlin.gradle.idea.tcs
|
||||||
|
|
||||||
sealed class IdeDependencyCoordinates {
|
sealed interface IdeaKotlinDependencyCoordinates
|
||||||
/* Reflection helpers */
|
|
||||||
val isBinaryCoordinates get() = this is IdeBinaryCoordinates
|
|
||||||
val isSourceCoordinates get() = this is IdeSourceCoordinates
|
|
||||||
}
|
|
||||||
|
|
||||||
data class IdeBinaryCoordinates(
|
data class IdeaKotlinBinaryCoordinates(
|
||||||
val group: String,
|
val group: String,
|
||||||
val module: String,
|
val module: String,
|
||||||
val version: String?,
|
val version: String?,
|
||||||
val sourceSetName: String?
|
val sourceSetName: String?
|
||||||
) : IdeDependencyCoordinates()
|
) : IdeaKotlinDependencyCoordinates
|
||||||
|
|
||||||
data class IdeSourceCoordinates(
|
data class IdeaKotlinSourceCoordinates(
|
||||||
val buildId: String,
|
val buildId: String,
|
||||||
val projectPath: String,
|
val projectPath: String,
|
||||||
val projectName: String,
|
val projectName: String,
|
||||||
val sourceSetName: String
|
val sourceSetName: String
|
||||||
) : IdeDependencyCoordinates()
|
) : IdeaKotlinDependencyCoordinates
|
||||||
+19
@@ -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.gradle.idea.tcs
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
data class IdeaKotlinSourceDependency(
|
||||||
|
val type: Type,
|
||||||
|
override val coordinates: IdeaKotlinSourceCoordinates,
|
||||||
|
override val extras: Extras
|
||||||
|
) : IdeaKotlinDependency {
|
||||||
|
enum class Type : Serializable {
|
||||||
|
Regular, Friend, DependsOn
|
||||||
|
}
|
||||||
|
}
|
||||||
-46
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.gradle.kpm.idea.serialize
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
|
||||||
|
|
||||||
interface IdeaKpmExtrasSerializationExtension {
|
|
||||||
fun <T : Any> serializer(key: Extras.Key<T>): IdeaKpmExtrasSerializer<T>?
|
|
||||||
|
|
||||||
object Empty : IdeaKpmExtrasSerializationExtension {
|
|
||||||
override fun <T : Any> serializer(key: Extras.Key<T>): IdeaKpmExtrasSerializer<T>? = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IdeaKpmExtrasSerializationExtensionBuilder {
|
|
||||||
fun <T : Any> register(key: Extras.Key<T>, serializer: IdeaKpmExtrasSerializer<T>)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun IdeaKpmExtrasSerializationExtension(
|
|
||||||
builder: IdeaKpmExtrasSerializationExtensionBuilder.() -> Unit
|
|
||||||
): IdeaKpmExtrasSerializationExtension {
|
|
||||||
return IdeaKpmExtrasSerializationExtensionImpl(
|
|
||||||
IdeaKpmExtrasSerializationExtensionBuilderImpl().apply(builder).serializers
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private class IdeaKpmExtrasSerializationExtensionBuilderImpl : IdeaKpmExtrasSerializationExtensionBuilder {
|
|
||||||
val serializers = mutableMapOf<Extras.Key<*>, IdeaKpmExtrasSerializer<*>>()
|
|
||||||
|
|
||||||
override fun <T : Any> register(key: Extras.Key<T>, serializer: IdeaKpmExtrasSerializer<T>) {
|
|
||||||
serializers[key] = serializer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private class IdeaKpmExtrasSerializationExtensionImpl(
|
|
||||||
private val map: Map<Extras.Key<*>, IdeaKpmExtrasSerializer<*>>
|
|
||||||
) : IdeaKpmExtrasSerializationExtension {
|
|
||||||
override fun <T : Any> serializer(key: Extras.Key<T>): IdeaKpmExtrasSerializer<T>? {
|
|
||||||
@Suppress("unchecked_cast")
|
|
||||||
return map[key] as? IdeaKpmExtrasSerializer<T>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.gradle.kpm.idea.serialize
|
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
interface IdeaKpmExtrasSerializer<T : Any> {
|
|
||||||
fun serialize(context: IdeaKpmSerializationContext, value: T): ByteArray?
|
|
||||||
fun deserialize(context: IdeaKpmSerializationContext, data: ByteArray): T?
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
/**
|
|
||||||
* Returns a [IdeaKpmExtrasSerializer] based upon [java.io.Serializable]
|
|
||||||
*/
|
|
||||||
fun <T : Any> javaIoSerializable(clazz: KClass<T>): IdeaKpmExtrasSerializer<T> {
|
|
||||||
return IdeaKpmJavaIoSerializableExtrasSerializer(clazz)
|
|
||||||
}
|
|
||||||
|
|
||||||
inline fun <reified T : Any> javaIoSerializable(): IdeaKpmExtrasSerializer<T> {
|
|
||||||
return javaIoSerializable(T::class)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-43
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.gradle.kpm.idea.serialize
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream
|
|
||||||
import java.io.ByteArrayOutputStream
|
|
||||||
import java.io.ObjectInputStream
|
|
||||||
import java.io.ObjectOutputStream
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
internal class IdeaKpmJavaIoSerializableExtrasSerializer<T : Any>(
|
|
||||||
private val clazz: KClass<T>
|
|
||||||
) : IdeaKpmExtrasSerializer<T> {
|
|
||||||
|
|
||||||
override fun serialize(context: IdeaKpmSerializationContext, value: T): ByteArray? {
|
|
||||||
return try {
|
|
||||||
ByteArrayOutputStream().use { byteArrayOutputStream ->
|
|
||||||
ObjectOutputStream(byteArrayOutputStream).use { oos -> oos.writeObject(value) }
|
|
||||||
byteArrayOutputStream.toByteArray()
|
|
||||||
}
|
|
||||||
} catch (t: Throwable) {
|
|
||||||
context.logger.error("${ErrorMessages.SERIALIZATION_FAILURE} $value", t)
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun deserialize(context: IdeaKpmSerializationContext, data: ByteArray): T? {
|
|
||||||
return try {
|
|
||||||
ObjectInputStream(ByteArrayInputStream(data)).use { stream -> clazz.java.cast(stream.readObject()) }
|
|
||||||
} catch (t: Throwable) {
|
|
||||||
context.logger.error("${ErrorMessages.DESERIALIZATION_FAILURE} ${clazz.java}", t)
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object ErrorMessages {
|
|
||||||
const val SERIALIZATION_FAILURE = "Failed to serialize"
|
|
||||||
const val DESERIALIZATION_FAILURE = "Failed to deserialize"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.gradle.kpm.idea.serialize
|
|
||||||
|
|
||||||
interface IdeaKpmSerializationContext {
|
|
||||||
val extrasSerializationExtension: IdeaKpmExtrasSerializationExtension
|
|
||||||
val logger: IdeaKpmSerializationLogger
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.gradle.kpm.idea.serialize
|
|
||||||
|
|
||||||
interface IdeaKpmSerializationLogger {
|
|
||||||
enum class Severity {
|
|
||||||
WARNING,
|
|
||||||
ERROR,
|
|
||||||
}
|
|
||||||
|
|
||||||
fun report(severity: Severity, message: String, cause: Throwable? = null)
|
|
||||||
fun warn(message: String, cause: Throwable? = null) = report(Severity.WARNING, message, cause)
|
|
||||||
fun error(message: String, cause: Throwable? = null) = report(Severity.ERROR, message, cause)
|
|
||||||
|
|
||||||
object None : IdeaKpmSerializationLogger {
|
|
||||||
override fun report(severity: Severity, message: String, cause: Throwable?) = Unit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-4
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.gradle.api.internal.project.ProjectInternal
|
import org.gradle.api.internal.project.ProjectInternal
|
||||||
import org.gradle.kotlin.dsl.create
|
import org.gradle.kotlin.dsl.create
|
||||||
@@ -13,9 +13,9 @@ import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmExtrasSerial
|
|||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.copy
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.copy
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.createProxyInstance
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.createProxyInstance
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.unwrapProxyInstance
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.unwrapProxyInstance
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testUtils.buildIdeaKpmProject
|
import org.jetbrains.kotlin.gradle.idea.testUtils.buildIdeaKpmProject
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testUtils.createKpmProject
|
import org.jetbrains.kotlin.gradle.idea.testUtils.createKpmProject
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testUtils.deserializeIdeaKpmProjectWithBackwardsCompatibleClasses
|
import org.jetbrains.kotlin.gradle.idea.testUtils.deserializeIdeaKpmProjectWithBackwardsCompatibleClasses
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPm20PluginWrapper
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPm20PluginWrapper
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmIosX64Variant
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmIosX64Variant
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmLinuxX64Variant
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmLinuxX64Variant
|
||||||
+2
-2
@@ -3,10 +3,10 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.*
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.*
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testUtils.deserializeIdeaKpmProjectWithBackwardsCompatibleClasses
|
import org.jetbrains.kotlin.gradle.idea.testUtils.deserializeIdeaKpmProjectWithBackwardsCompatibleClasses
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmInstances
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.kpm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.tooling.core.AbstractExtras
|
import org.jetbrains.kotlin.tooling.core.AbstractExtras
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
+12
-14
@@ -3,11 +3,9 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.idea.serialize
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializer
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaSerializationContext
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmJavaIoSerializableExtrasSerializer
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmSerializationContext
|
|
||||||
import org.jetbrains.kotlin.tooling.core.withLinearClosure
|
import org.jetbrains.kotlin.tooling.core.withLinearClosure
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
@@ -16,12 +14,12 @@ import kotlin.test.assertNotNull
|
|||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class IdeaKpmJavaIoSerializableExtrasSerializerTest {
|
class IdeaJavaIoSerializableExtrasSerializerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `serialize - deserialize - String`() {
|
fun `serialize - deserialize - String`() {
|
||||||
val context = TestIdeaKpmSerializationContext()
|
val context = TestIdeaSerializationContext()
|
||||||
val serializer = IdeaKpmExtrasSerializer.javaIoSerializable<String>()
|
val serializer = IdeaExtrasSerializer.javaIoSerializable<String>()
|
||||||
val binary = assertNotNull(
|
val binary = assertNotNull(
|
||||||
serializer.serialize(context, "Sunny Cash"),
|
serializer.serialize(context, "Sunny Cash"),
|
||||||
"Failed to serialize: ${context.logger.reports}"
|
"Failed to serialize: ${context.logger.reports}"
|
||||||
@@ -36,12 +34,12 @@ class IdeaKpmJavaIoSerializableExtrasSerializerTest {
|
|||||||
fun `serialize - deserialize - non serializable object`() {
|
fun `serialize - deserialize - non serializable object`() {
|
||||||
class ThisIsNotSerializable
|
class ThisIsNotSerializable
|
||||||
|
|
||||||
val context = TestIdeaKpmSerializationContext()
|
val context = TestIdeaSerializationContext()
|
||||||
val serializer = IdeaKpmExtrasSerializer.javaIoSerializable<ThisIsNotSerializable>()
|
val serializer = IdeaExtrasSerializer.javaIoSerializable<ThisIsNotSerializable>()
|
||||||
assertNull(serializer.serialize(context, ThisIsNotSerializable()), "Expected null return value for non serializable object")
|
assertNull(serializer.serialize(context, ThisIsNotSerializable()), "Expected null return value for non serializable object")
|
||||||
|
|
||||||
val serializationFailureReportsCount = context.logger.reports.count { report ->
|
val serializationFailureReportsCount = context.logger.reports.count { report ->
|
||||||
report.message.startsWith(IdeaKpmJavaIoSerializableExtrasSerializer.ErrorMessages.SERIALIZATION_FAILURE)
|
report.message.startsWith(IdeaJavaIoSerializableExtrasSerializer.ErrorMessages.SERIALIZATION_FAILURE)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@@ -60,8 +58,8 @@ class IdeaKpmJavaIoSerializableExtrasSerializerTest {
|
|||||||
fun readResolve(): Any = throw exception
|
fun readResolve(): Any = throw exception
|
||||||
}
|
}
|
||||||
|
|
||||||
val context = TestIdeaKpmSerializationContext()
|
val context = TestIdeaSerializationContext()
|
||||||
val serializer = IdeaKpmExtrasSerializer.javaIoSerializable<NotDeserializable>()
|
val serializer = IdeaExtrasSerializer.javaIoSerializable<NotDeserializable>()
|
||||||
val binary = assertNotNull(serializer.serialize(context, NotDeserializable()))
|
val binary = assertNotNull(serializer.serialize(context, NotDeserializable()))
|
||||||
assertNull(serializer.deserialize(context, binary))
|
assertNull(serializer.deserialize(context, binary))
|
||||||
|
|
||||||
@@ -74,8 +72,8 @@ class IdeaKpmJavaIoSerializableExtrasSerializerTest {
|
|||||||
val reportMessage = assertNotNull(report.message, "Expected message in issue report")
|
val reportMessage = assertNotNull(report.message, "Expected message in issue report")
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
reportMessage.startsWith(IdeaKpmJavaIoSerializableExtrasSerializer.ErrorMessages.DESERIALIZATION_FAILURE),
|
reportMessage.startsWith(IdeaJavaIoSerializableExtrasSerializer.ErrorMessages.DESERIALIZATION_FAILURE),
|
||||||
"Expected issue report to start with ${IdeaKpmJavaIoSerializableExtrasSerializer.ErrorMessages.DESERIALIZATION_FAILURE}"
|
"Expected issue report to start with ${IdeaJavaIoSerializableExtrasSerializer.ErrorMessages.DESERIALIZATION_FAILURE}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
+4
-4
@@ -3,10 +3,10 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea.testUtils
|
package org.jetbrains.kotlin.gradle.idea.testUtils
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProject
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProject
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationLogger
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationLogger
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmClassLoaderProjectSerializer
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.TestIdeaKpmClassLoaderProjectSerializer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URLClassLoader
|
import java.net.URLClassLoader
|
||||||
@@ -49,7 +49,7 @@ fun deserializeIdeaKpmProjectWithBackwardsCompatibleClasses(project: ByteArray):
|
|||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
0, serializer.reports.count { it.severity > IdeaKpmSerializationLogger.Severity.WARNING },
|
0, serializer.reports.count { it.severity > IdeaSerializationLogger.Severity.WARNING },
|
||||||
"Expected no severe deserialization reports. Found ${serializer.reports}"
|
"Expected no severe deserialization reports. Found ${serializer.reports}"
|
||||||
)
|
)
|
||||||
|
|
||||||
+4
-4
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.kpm.idea.testUtils
|
package org.jetbrains.kotlin.gradle.idea.testUtils
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.artifacts.verification.DependencyVerificationMode
|
import org.gradle.api.artifacts.verification.DependencyVerificationMode
|
||||||
@@ -11,9 +11,9 @@ import org.gradle.api.internal.project.ProjectInternal
|
|||||||
import org.gradle.configurationcache.extensions.serviceOf
|
import org.gradle.configurationcache.extensions.serviceOf
|
||||||
import org.gradle.testfixtures.ProjectBuilder
|
import org.gradle.testfixtures.ProjectBuilder
|
||||||
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProject
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProject
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectBinaryContainer
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProjectBinaryContainer
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectContainer
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProjectContainer
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPm20PluginWrapper
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPm20PluginWrapper
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
||||||
|
|
||||||
+12
-17
@@ -3,14 +3,12 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.gradle.ide
|
package org.jetbrains.kotlin.gradle.ide.testFixtures
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinSourceDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.ide.IdeDependency
|
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.ide.IdeSourceDependency
|
import kotlin.test.fail
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.internal
|
|
||||||
import org.junit.jupiter.api.fail
|
|
||||||
|
|
||||||
fun buildIdeDependencyMatchers(notation: Any?): List<IdeDependencyMatcher> {
|
fun buildIdeDependencyMatchers(notation: Any?): List<IdeDependencyMatcher> {
|
||||||
return when (notation) {
|
return when (notation) {
|
||||||
@@ -21,38 +19,35 @@ fun buildIdeDependencyMatchers(notation: Any?): List<IdeDependencyMatcher> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ideSourceDependency(type: IdeSourceDependency.Type, project: Project, sourceSetName: String): IdeDependencyMatcher {
|
fun ideSourceDependency(type: IdeaKotlinSourceDependency.Type, project: Project, sourceSetName: String): IdeDependencyMatcher {
|
||||||
return IdeSourceDependencyMatcher(type, project.path, sourceSetName)
|
return IdeSourceDependencyMatcher(type, project.path, sourceSetName)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dependsOnDependency(project: Project, sourceSetName: String) =
|
fun dependsOnDependency(project: Project, sourceSetName: String) =
|
||||||
ideSourceDependency(IdeSourceDependency.Type.DependsOn, project, sourceSetName)
|
ideSourceDependency(IdeaKotlinSourceDependency.Type.DependsOn, project, sourceSetName)
|
||||||
|
|
||||||
fun dependsOnDependency(sourceSet: KotlinSourceSet) =
|
|
||||||
dependsOnDependency(sourceSet.internal.project, sourceSet.name)
|
|
||||||
|
|
||||||
interface IdeDependencyMatcher {
|
interface IdeDependencyMatcher {
|
||||||
val description: String
|
val description: String
|
||||||
fun matches(dependency: IdeDependency): Boolean
|
fun matches(dependency: IdeaKotlinDependency): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
private class IdeSourceDependencyMatcher(
|
private class IdeSourceDependencyMatcher(
|
||||||
val type: IdeSourceDependency.Type,
|
val type: IdeaKotlinSourceDependency.Type,
|
||||||
val projectPath: String,
|
val projectPath: String,
|
||||||
val sourceSetName: String
|
val sourceSetName: String
|
||||||
) : IdeDependencyMatcher {
|
) : IdeDependencyMatcher {
|
||||||
override val description: String =
|
override val description: String =
|
||||||
"source($type)::$projectPath/$sourceSetName"
|
"source($type)::$projectPath/$sourceSetName"
|
||||||
|
|
||||||
override fun matches(dependency: IdeDependency): Boolean {
|
override fun matches(dependency: IdeaKotlinDependency): Boolean {
|
||||||
if (dependency !is IdeSourceDependency) return false
|
if (dependency !is IdeaKotlinSourceDependency) return false
|
||||||
return dependency.type == type &&
|
return dependency.type == type &&
|
||||||
dependency.coordinates.projectPath == projectPath &&
|
dependency.coordinates.projectPath == projectPath &&
|
||||||
dependency.coordinates.sourceSetName == sourceSetName
|
dependency.coordinates.sourceSetName == sourceSetName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Iterable<IdeDependency>.assertMatches(vararg notation: Any?) {
|
fun Iterable<IdeaKotlinDependency>.assertMatches(vararg notation: Any?) {
|
||||||
val thisList = toList()
|
val thisList = toList()
|
||||||
val matchers = notation.flatMap { buildIdeDependencyMatchers(it) }
|
val matchers = notation.flatMap { buildIdeDependencyMatchers(it) }
|
||||||
|
|
||||||
@@ -88,4 +83,4 @@ fun Iterable<IdeDependency>.assertMatches(vararg notation: Any?) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+5
-5
@@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializer
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializer
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
|
||||||
object TestIdeaKpmIntExtrasSerializer : IdeaKpmExtrasSerializer<Int> {
|
object TestIdeaIntExtrasSerializer : IdeaExtrasSerializer<Int> {
|
||||||
override fun serialize(context: IdeaKpmSerializationContext, value: Int): ByteArray {
|
override fun serialize(context: IdeaSerializationContext, value: Int): ByteArray {
|
||||||
return ByteBuffer.allocate(Int.SIZE_BYTES).putInt(value).array()
|
return ByteBuffer.allocate(Int.SIZE_BYTES).putInt(value).array()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deserialize(context: IdeaKpmSerializationContext, data: ByteArray): Int {
|
override fun deserialize(context: IdeaSerializationContext, data: ByteArray): Int {
|
||||||
return ByteBuffer.wrap(data).int
|
return ByteBuffer.wrap(data).int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmResolvedBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependency
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
fun buildIdeaKpmBinaryDependencyMatchers(notation: Any?): List<TestIdeaKpmBinaryDependencyMatcher> {
|
fun buildIdeaKpmBinaryDependencyMatchers(notation: Any?): List<TestIdeaKpmBinaryDependencyMatcher> {
|
||||||
|
|||||||
+5
-5
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProject
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProject
|
||||||
import org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmProject
|
import org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmProject
|
||||||
import org.jetbrains.kotlin.kpm.idea.proto.toByteArray
|
import org.jetbrains.kotlin.kpm.idea.proto.toByteArray
|
||||||
import org.jetbrains.kotlin.tooling.core.UnsafeApi
|
import org.jetbrains.kotlin.tooling.core.UnsafeApi
|
||||||
@@ -41,12 +41,12 @@ fun TestIdeaKpmClassLoaderProjectSerializer(classLoader: ClassLoader): TestIdeaK
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Util to serialize / deserialize [IdeaKpmProject] within a dedicated ClassLoader.
|
* Test Util to serialize / deserialize [IdeaKpmProject] within a dedicated ClassLoader.
|
||||||
* The serialization context used will be [TestIdeaKpmSerializationContext]. Note, that this context
|
* The serialization context used will be [TestIdeaSerializationContext]. Note, that this context
|
||||||
* might also depend on the version shipped by the specified [ClassLoader].
|
* might also depend on the version shipped by the specified [ClassLoader].
|
||||||
*/
|
*/
|
||||||
interface TestIdeaKpmClassLoaderProjectSerializer {
|
interface TestIdeaKpmClassLoaderProjectSerializer {
|
||||||
val classLoader: ClassLoader
|
val classLoader: ClassLoader
|
||||||
val reports: List<TestIdeaKpmSerializationLogger.Report>
|
val reports: List<TestIdeaSerializationLogger.Report>
|
||||||
fun serialize(project: Any): ByteArray
|
fun serialize(project: Any): ByteArray
|
||||||
fun deserialize(data: ByteArray): Any?
|
fun deserialize(data: ByteArray): Any?
|
||||||
}
|
}
|
||||||
@@ -55,9 +55,9 @@ interface TestIdeaKpmClassLoaderProjectSerializer {
|
|||||||
internal class TestIdeaKpmProtoClassLoaderProjectSerializer(
|
internal class TestIdeaKpmProtoClassLoaderProjectSerializer(
|
||||||
override val classLoader: ClassLoader
|
override val classLoader: ClassLoader
|
||||||
) : TestIdeaKpmClassLoaderProjectSerializer {
|
) : TestIdeaKpmClassLoaderProjectSerializer {
|
||||||
private val context = TestIdeaKpmSerializationContext()
|
private val context = TestIdeaSerializationContext()
|
||||||
|
|
||||||
override val reports: List<TestIdeaKpmSerializationLogger.Report>
|
override val reports: List<TestIdeaSerializationLogger.Report>
|
||||||
get() = context.logger.reports
|
get() = context.logger.reports
|
||||||
|
|
||||||
override fun serialize(project: Any): ByteArray {
|
override fun serialize(project: Any): ByteArray {
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
|
|
||||||
interface TestIdeaKpmDependencyMatcher<in T : IdeaKpmDependency> {
|
interface TestIdeaKpmDependencyMatcher<in T : IdeaKpmDependency> {
|
||||||
val description: String
|
val description: String
|
||||||
|
|||||||
+8
-8
@@ -5,23 +5,23 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializationExtension
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializationExtension
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializer
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializer
|
||||||
import org.jetbrains.kotlin.tooling.core.Extras
|
import org.jetbrains.kotlin.tooling.core.Extras
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasTypeOf
|
import org.jetbrains.kotlin.tooling.core.extrasTypeOf
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
object TestIdeaKpmExtrasSerializationExtension : IdeaKpmExtrasSerializationExtension {
|
object TestIdeaKpmExtrasSerializationExtension : IdeaExtrasSerializationExtension {
|
||||||
|
|
||||||
val ignoredStringKey = extrasKeyOf<String>("ignored")
|
val ignoredStringKey = extrasKeyOf<String>("ignored")
|
||||||
val anySerializableKey = extrasKeyOf<Any>("serializable")
|
val anySerializableKey = extrasKeyOf<Any>("serializable")
|
||||||
|
|
||||||
override fun <T : Any> serializer(key: Extras.Key<T>): IdeaKpmExtrasSerializer<T>? = when {
|
override fun <T : Any> serializer(key: Extras.Key<T>): IdeaExtrasSerializer<T>? = when {
|
||||||
key == ignoredStringKey -> null
|
key == ignoredStringKey -> null
|
||||||
key == anySerializableKey -> IdeaKpmExtrasSerializer.javaIoSerializable<Any>()
|
key == anySerializableKey -> IdeaExtrasSerializer.javaIoSerializable<Any>()
|
||||||
key.type == extrasTypeOf<String>() -> TestIdeaKpmStringExtrasSerializer
|
key.type == extrasTypeOf<String>() -> TestIdeaStringExtrasSerializer
|
||||||
key.type == extrasTypeOf<Int>() -> TestIdeaKpmIntExtrasSerializer
|
key.type == extrasTypeOf<Int>() -> TestIdeaIntExtrasSerializer
|
||||||
else -> null
|
else -> null
|
||||||
} as? IdeaKpmExtrasSerializer<T>
|
} as? IdeaExtrasSerializer<T>
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragmentDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragmentDependency
|
||||||
|
|
||||||
fun buildIdeaKpmFragmentDependencyMatchers(notation: Any?): List<TestIdeaKpmFragmentDependencyMatcher> {
|
fun buildIdeaKpmFragmentDependencyMatchers(notation: Any?): List<TestIdeaKpmFragmentDependencyMatcher> {
|
||||||
return when (notation) {
|
return when (notation) {
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
import org.jetbrains.kotlin.gradle.idea.kpm.*
|
||||||
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
import org.jetbrains.kotlin.tooling.core.emptyExtras
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
|
||||||
import org.jetbrains.kotlin.tooling.core.extrasOf
|
import org.jetbrains.kotlin.tooling.core.extrasOf
|
||||||
|
|||||||
+3
-3
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
class TestIdeaKpmSerializationContext : IdeaKpmSerializationContext {
|
class TestIdeaSerializationContext : IdeaSerializationContext {
|
||||||
override val logger = TestIdeaKpmSerializationLogger()
|
override val logger = TestIdeaSerializationLogger()
|
||||||
override val extrasSerializationExtension = TestIdeaKpmExtrasSerializationExtension
|
override val extrasSerializationExtension = TestIdeaKpmExtrasSerializationExtension
|
||||||
}
|
}
|
||||||
|
|||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.gradle.kpm.idea.testFixtures
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializer
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
|
||||||
import kotlin.text.decodeToString
|
|
||||||
import kotlin.text.encodeToByteArray
|
|
||||||
|
|
||||||
object TestIdeaKpmStringExtrasSerializer : IdeaKpmExtrasSerializer<String> {
|
|
||||||
override fun serialize(context: IdeaKpmSerializationContext, value: String): ByteArray = value.encodeToByteArray()
|
|
||||||
override fun deserialize(context: IdeaKpmSerializationContext, data: ByteArray) = data.decodeToString()
|
|
||||||
}
|
|
||||||
+3
-4
@@ -5,12 +5,11 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationLogger
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationLogger
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationLogger.Severity
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationLogger.Severity
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import kotlin.collections.toList
|
|
||||||
|
|
||||||
class TestIdeaKpmSerializationLogger : IdeaKpmSerializationLogger {
|
class TestIdeaSerializationLogger : IdeaSerializationLogger {
|
||||||
data class Report(
|
data class Report(
|
||||||
val severity: Severity,
|
val severity: Severity,
|
||||||
val message: String,
|
val message: String,
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* 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.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializer
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
|
|
||||||
|
object TestIdeaStringExtrasSerializer : IdeaExtrasSerializer<String> {
|
||||||
|
override fun serialize(context: IdeaSerializationContext, value: String): ByteArray = value.encodeToByteArray()
|
||||||
|
override fun deserialize(context: IdeaSerializationContext, data: ByteArray) = data.decodeToString()
|
||||||
|
}
|
||||||
+1
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.*
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
import org.jetbrains.kotlin.gradle.kpm.idea.*
|
||||||
import kotlin.test.fail
|
import kotlin.test.fail
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinates
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinates
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryCoordinatesImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmFragment
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmFragment
|
||||||
|
|
||||||
fun parseIdeaKpmBinaryCoordinates(coordinates: String): IdeaKpmBinaryCoordinates {
|
fun parseIdeaKpmBinaryCoordinates(coordinates: String): IdeaKpmBinaryCoordinates {
|
||||||
val parts = coordinates.split(":")
|
val parts = coordinates.split(":")
|
||||||
|
|||||||
+2
-2
@@ -11,11 +11,11 @@ package org.jetbrains.kotlin.gradle.android
|
|||||||
import com.android.build.gradle.AppExtension
|
import com.android.build.gradle.AppExtension
|
||||||
import com.android.build.gradle.LibraryExtension
|
import com.android.build.gradle.LibraryExtension
|
||||||
import org.gradle.kotlin.dsl.findByType
|
import org.gradle.kotlin.dsl.findByType
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializer
|
||||||
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
||||||
import org.jetbrains.kotlin.gradle.kpm.external.ideaKpmProjectModelBuilder
|
import org.jetbrains.kotlin.gradle.kpm.external.ideaKpmProjectModelBuilder
|
||||||
import org.jetbrains.kotlin.gradle.kpm.external.project
|
import org.jetbrains.kotlin.gradle.kpm.external.project
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.registerExtrasSerializationExtension
|
import org.jetbrains.kotlin.gradle.kpm.idea.registerExtrasSerializationExtension
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializer
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
||||||
|
|
||||||
fun KotlinPm20ProjectExtension.androidPrototype() {
|
fun KotlinPm20ProjectExtension.androidPrototype() {
|
||||||
@@ -34,6 +34,6 @@ fun KotlinPm20ProjectExtension.androidPrototype() {
|
|||||||
setupIdeaKpmFragmentDependencyResolver()
|
setupIdeaKpmFragmentDependencyResolver()
|
||||||
|
|
||||||
ideaKpmProjectModelBuilder.registerExtrasSerializationExtension {
|
ideaKpmProjectModelBuilder.registerExtrasSerializationExtension {
|
||||||
register(androidDslKey, IdeaKpmExtrasSerializer.javaIoSerializable())
|
register(androidDslKey, IdeaExtrasSerializer.javaIoSerializable())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,9 +10,9 @@ import org.gradle.api.attributes.Usage
|
|||||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
||||||
import org.jetbrains.kotlin.gradle.kpm.external.project
|
import org.jetbrains.kotlin.gradle.kpm.external.project
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmDependency.Companion.CLASSPATH_BINARY_TYPE
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency.Companion.CLASSPATH_BINARY_TYPE
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.FragmentConstraint
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.FragmentConstraint
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmResolvedBinaryDependencyImpl
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.configureIdeaKpmSpecialPlatformDependencyResolution
|
import org.jetbrains.kotlin.gradle.kpm.idea.configureIdeaKpmSpecialPlatformDependencyResolution
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
||||||
|
|||||||
+1
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmPlatformDependencyResolver.ArtifactResolution
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmPlatformDependencyResolver.ArtifactResolution
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.*
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.*
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.path
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.path
|
||||||
|
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
|
|
||||||
fun interface IdeaKpmDependencyResolver {
|
fun interface IdeaKpmDependencyResolver {
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
|
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets
|
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragmentGranularMetadataResolverFactory
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragmentGranularMetadataResolverFactory
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
|
|||||||
+3
@@ -6,6 +6,9 @@
|
|||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets
|
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets.MetadataProvider.ArtifactMetadataProvider
|
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets.MetadataProvider.ArtifactMetadataProvider
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets.MetadataProvider.ProjectMetadataProvider
|
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets.MetadataProvider.ProjectMetadataProvider
|
||||||
|
|||||||
+2
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.path
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.path
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||||
|
|||||||
+4
@@ -9,6 +9,10 @@ import org.gradle.api.Project
|
|||||||
import org.jetbrains.kotlin.commonizer.KonanDistribution
|
import org.jetbrains.kotlin.commonizer.KonanDistribution
|
||||||
import org.jetbrains.kotlin.commonizer.platformLibsDir
|
import org.jetbrains.kotlin.commonizer.platformLibsDir
|
||||||
import org.jetbrains.kotlin.compilerRunner.konanHome
|
import org.jetbrains.kotlin.compilerRunner.konanHome
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
|
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmNativeVariantInternal
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmNativeVariantInternal
|
||||||
|
|||||||
+3
@@ -8,6 +8,9 @@ package org.jetbrains.kotlin.gradle.kpm.idea
|
|||||||
import org.jetbrains.kotlin.commonizer.KonanDistribution
|
import org.jetbrains.kotlin.commonizer.KonanDistribution
|
||||||
import org.jetbrains.kotlin.commonizer.stdlib
|
import org.jetbrains.kotlin.commonizer.stdlib
|
||||||
import org.jetbrains.kotlin.compilerRunner.konanHome
|
import org.jetbrains.kotlin.compilerRunner.konanHome
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
|
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
|
|
||||||
|
|||||||
+3
@@ -6,6 +6,9 @@
|
|||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmBinaryCoordinatesImpl
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmDependency
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmResolvedBinaryDependencyImpl
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.KeepOriginalDependency
|
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.KeepOriginalDependency
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragmentGranularMetadataResolverFactory
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragmentGranularMetadataResolverFactory
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
|||||||
import org.gradle.api.artifacts.component.ModuleComponentSelector
|
import org.gradle.api.artifacts.component.ModuleComponentSelector
|
||||||
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
|
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
|
||||||
import org.gradle.internal.resolve.ModuleVersionResolveException
|
import org.gradle.internal.resolve.ModuleVersionResolveException
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.*
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmPlatformDependencyResolver.*
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmPlatformDependencyResolver.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmConfigurationAttributesSetup
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmConfigurationAttributesSetup
|
||||||
|
|||||||
+11
-7
@@ -3,11 +3,15 @@
|
|||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
import org.jetbrains.kotlin.compilerRunner.konanHome
|
import org.jetbrains.kotlin.compilerRunner.konanHome
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProject
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.kpm.IdeaKpmProjectImpl
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializationExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaExtrasSerializationExtensionBuilder
|
||||||
|
import org.jetbrains.kotlin.gradle.idea.serialize.IdeaSerializationContext
|
||||||
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
|
||||||
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.DependencyResolutionLevel.Default
|
||||||
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.DependencyResolutionLevel.Overwrite
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.FragmentConstraint
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmProjectModelBuilder.FragmentConstraint
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializationExtension
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmExtrasSerializationExtensionBuilder
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.serialize.IdeaKpmSerializationContext
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.native
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.native
|
||||||
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
|
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleKpmFragment
|
||||||
@@ -129,10 +133,10 @@ interface IdeaKpmProjectModelBuilder {
|
|||||||
|
|
||||||
@ExternalVariantApi
|
@ExternalVariantApi
|
||||||
fun registerExtrasSerializationExtension(
|
fun registerExtrasSerializationExtension(
|
||||||
extension: IdeaKpmExtrasSerializationExtension
|
extension: IdeaExtrasSerializationExtension
|
||||||
)
|
)
|
||||||
|
|
||||||
fun buildSerializationContext(): IdeaKpmSerializationContext
|
fun buildSerializationContext(): IdeaSerializationContext
|
||||||
|
|
||||||
fun buildIdeaKpmProject(): IdeaKpmProject
|
fun buildIdeaKpmProject(): IdeaKpmProject
|
||||||
|
|
||||||
@@ -167,7 +171,7 @@ operator fun FragmentConstraint.not() = FragmentConstraint { fragment ->
|
|||||||
|
|
||||||
@ExternalVariantApi
|
@ExternalVariantApi
|
||||||
fun IdeaKpmProjectModelBuilder.registerExtrasSerializationExtension(
|
fun IdeaKpmProjectModelBuilder.registerExtrasSerializationExtension(
|
||||||
builder: IdeaKpmExtrasSerializationExtensionBuilder.() -> Unit
|
builder: IdeaExtrasSerializationExtensionBuilder.() -> Unit
|
||||||
) {
|
) {
|
||||||
registerExtrasSerializationExtension(IdeaKpmExtrasSerializationExtension(builder))
|
registerExtrasSerializationExtension(IdeaExtrasSerializationExtension(builder))
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user