[Gradle][MPP] CompositeMetadataArtifact: Remove Int checksum (keep String)
^KT-48135 Verification Pending
This commit is contained in:
committed by
Space
parent
9f01217050
commit
59f4d76bcf
+1
-2
@@ -14,8 +14,7 @@ internal interface CompositeMetadataArtifact {
|
|||||||
val artifactContent: ArtifactContent
|
val artifactContent: ArtifactContent
|
||||||
val sourceSet: SourceSet
|
val sourceSet: SourceSet
|
||||||
val archiveExtension: String
|
val archiveExtension: String
|
||||||
val checksum: Int
|
val checksum: String
|
||||||
val checksumString: String
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The proposed file-output path.
|
* The proposed file-output path.
|
||||||
|
|||||||
+6
-16
@@ -108,12 +108,9 @@ internal class CompositeMetadataArtifactImpl(
|
|||||||
get() = kotlinProjectStructureMetadata.sourceSetBinaryLayout[sourceSet.sourceSetName]?.archiveExtension
|
get() = kotlinProjectStructureMetadata.sourceSetBinaryLayout[sourceSet.sourceSetName]?.archiveExtension
|
||||||
?: SourceSetMetadataLayout.METADATA.archiveExtension
|
?: SourceSetMetadataLayout.METADATA.archiveExtension
|
||||||
|
|
||||||
override val checksum: Int
|
override val checksum: String
|
||||||
get() = artifactFile.checksum
|
get() = artifactFile.checksum
|
||||||
|
|
||||||
override val checksumString: String
|
|
||||||
get() = artifactFile.checksumString
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example:
|
* Example:
|
||||||
* org.jetbrains.sample-sampleLibrary-1.0.0-SNAPSHOT-appleAndLinuxMain-Vk5pxQ.klib
|
* org.jetbrains.sample-sampleLibrary-1.0.0-SNAPSHOT-appleAndLinuxMain-Vk5pxQ.klib
|
||||||
@@ -125,7 +122,7 @@ internal class CompositeMetadataArtifactImpl(
|
|||||||
append("-")
|
append("-")
|
||||||
append(sourceSet.sourceSetName)
|
append(sourceSet.sourceSetName)
|
||||||
append("-")
|
append("-")
|
||||||
append(checksumString)
|
append(this@MetadataLibraryImpl.checksum)
|
||||||
append(".")
|
append(".")
|
||||||
append(archiveExtension)
|
append(archiveExtension)
|
||||||
})
|
})
|
||||||
@@ -154,12 +151,9 @@ internal class CompositeMetadataArtifactImpl(
|
|||||||
override val archiveExtension: String
|
override val archiveExtension: String
|
||||||
get() = SourceSetMetadataLayout.KLIB.archiveExtension
|
get() = SourceSetMetadataLayout.KLIB.archiveExtension
|
||||||
|
|
||||||
override val checksum: Int
|
override val checksum: String
|
||||||
get() = artifactFile.checksum
|
get() = artifactFile.checksum
|
||||||
|
|
||||||
override val checksumString: String
|
|
||||||
get() = artifactFile.checksumString
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example:
|
* Example:
|
||||||
* org.jetbrains.sample-sampleLibrary-1.0.0-SNAPSHOT-appleAndLinuxMain-cinterop/
|
* org.jetbrains.sample-sampleLibrary-1.0.0-SNAPSHOT-appleAndLinuxMain-cinterop/
|
||||||
@@ -172,7 +166,7 @@ internal class CompositeMetadataArtifactImpl(
|
|||||||
append("-")
|
append("-")
|
||||||
append(sourceSet.sourceSetName)
|
append(sourceSet.sourceSetName)
|
||||||
append("-cinterop")
|
append("-cinterop")
|
||||||
}).resolve("$cinteropLibraryName-${checksumString}.${archiveExtension}")
|
}).resolve("$cinteropLibraryName-${this.checksum}.${archiveExtension}")
|
||||||
|
|
||||||
override fun copyTo(file: File): Boolean {
|
override fun copyTo(file: File): Boolean {
|
||||||
require(file.extension == archiveExtension) {
|
require(file.extension == archiveExtension) {
|
||||||
@@ -216,14 +210,10 @@ internal class CompositeMetadataArtifactImpl(
|
|||||||
zip.entries().toList()
|
zip.entries().toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
val checksum: Int by lazy(LazyThreadSafetyMode.NONE) {
|
val checksum: String by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
val crc32 = CRC32()
|
val crc32 = CRC32()
|
||||||
entries.forEach { entry -> crc32.update(entry.crc.toInt()) }
|
entries.forEach { entry -> crc32.update(entry.crc.toInt()) }
|
||||||
crc32.value.toInt()
|
checksumStringEncoder.encodeToString(ByteBuffer.allocate(4).putInt(crc32.value.toInt()).array())
|
||||||
}
|
|
||||||
|
|
||||||
val checksumString: String by lazy(LazyThreadSafetyMode.NONE) {
|
|
||||||
checksumStringEncoder.encodeToString(ByteBuffer.allocate(4).putInt(checksum).array())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user