diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/mapping/Coordinates.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/mapping/Coordinates.kt index 1e9998f7..95bbfac9 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/mapping/Coordinates.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/mapping/Coordinates.kt @@ -1,11 +1,9 @@ package io.github.sgtsilvio.gradle.oci.mapping -import java.io.Serializable - /** * @author Silvio Giebl */ -internal data class Coordinates(val group: String, val name: String) : Comparable, Serializable { +internal data class Coordinates(val group: String, val name: String) : Comparable { override fun compareTo(other: Coordinates): Int { group.compareTo(other.group).also { if (it != 0) return it } return name.compareTo(other.name) @@ -17,7 +15,7 @@ internal data class Coordinates(val group: String, val name: String) : Comparabl internal data class VersionedCoordinates( val coordinates: Coordinates, val version: String, -) : Comparable, Serializable { +) : Comparable { val group get() = coordinates.group val name get() = coordinates.name diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDigest.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDigest.kt index 659bb1b9..30286db8 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDigest.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDigest.kt @@ -3,7 +3,6 @@ package io.github.sgtsilvio.gradle.oci.metadata import io.github.sgtsilvio.gradle.oci.internal.json.JsonObject import org.apache.commons.codec.binary.Hex import java.io.OutputStream -import java.io.Serializable import java.security.DigestOutputStream import java.security.MessageDigest import kotlin.contracts.ExperimentalContracts @@ -33,7 +32,7 @@ enum class OciDigestAlgorithm(val id: String, val standardName: String, private internal fun createMessageDigest(): MessageDigest = MessageDigest.getInstance(standardName) } -data class OciDigest(val algorithm: OciDigestAlgorithm, val hash: ByteArray) : Serializable { +data class OciDigest(val algorithm: OciDigestAlgorithm, val hash: ByteArray) { val encodedHash get() = algorithm.encode(hash) init { diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadata.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadata.kt index c1a0ba61..f79ebc8b 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadata.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadata.kt @@ -1,6 +1,5 @@ package io.github.sgtsilvio.gradle.oci.metadata -import java.io.Serializable import java.time.Instant import java.util.* @@ -25,7 +24,7 @@ class OciMetadata( val manifestDescriptorAnnotations: SortedMap, val indexAnnotations: SortedMap, val layers: List, -) : Serializable +) class OciLayerMetadata( val descriptor: OciLayerDescriptor?, @@ -33,7 +32,7 @@ class OciLayerMetadata( val author: String?, val createdBy: String?, val comment: String?, -) : Serializable +) class OciLayerDescriptor( override val mediaType: String, @@ -41,4 +40,4 @@ class OciLayerDescriptor( override val size: Long, val diffId: OciDigest, override val annotations: SortedMap, -) : OciDescriptor, Serializable +) : OciDescriptor diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataBuilder.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataBuilder.kt index 6df6398c..eeadce07 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataBuilder.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataBuilder.kt @@ -1,12 +1,11 @@ package io.github.sgtsilvio.gradle.oci.metadata -import java.io.Serializable import java.time.Instant /** * @author Silvio Giebl */ -internal class OciMetadataBuilder : Serializable { +internal class OciMetadataBuilder { private var imageReference: OciImageReference? = null private var creationTime: SerializableInstant? = null private var author: String? = null @@ -64,7 +63,7 @@ internal class OciMetadataBuilder : Serializable { ) } -internal class OciLayerMetadataBuilder : Serializable { +internal class OciLayerMetadataBuilder { private var descriptor: OciLayerDescriptor? = null private var creationTime: SerializableInstant? = null private var author: String? = null @@ -80,7 +79,7 @@ internal class OciLayerMetadataBuilder : Serializable { fun build() = OciLayerMetadata(descriptor, creationTime?.toInstant(), author, createdBy, comment) } -internal class OciLayerDescriptorBuilder : Serializable { +internal class OciLayerDescriptorBuilder { private var mediaType: String? = null private var digest: OciDigest? = null private var size: Long? = null @@ -105,7 +104,7 @@ internal class OciLayerDescriptorBuilder : Serializable { } } -private class SerializableInstant(val epochSecond: Long, val nano: Int) : Serializable +private class SerializableInstant(val epochSecond: Long, val nano: Int) private fun Instant.toSerializableInstant() = SerializableInstant(epochSecond, nano)