diff --git a/.idea/modules.xml b/.idea/modules.xml
index a07351810bbb..7213806c38d9 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -1082,7 +1082,6 @@
-
diff --git a/build/tasks/intellij.idea.community.build.tasks.iml b/build/tasks/intellij.idea.community.build.tasks.iml
index a73e45dde9e0..cba68c6aef2c 100644
--- a/build/tasks/intellij.idea.community.build.tasks.iml
+++ b/build/tasks/intellij.idea.community.build.tasks.iml
@@ -42,7 +42,6 @@
-
diff --git a/platform/util/immutable-key-value-store/src/org/jetbrains/ikv/builder/IkvIndexBuilder.kt b/build/tasks/src/org/jetbrains/intellij/build/io/IkvIndexBuilder.kt
similarity index 95%
rename from platform/util/immutable-key-value-store/src/org/jetbrains/ikv/builder/IkvIndexBuilder.kt
rename to build/tasks/src/org/jetbrains/intellij/build/io/IkvIndexBuilder.kt
index 989b12329475..dc96b8c052b2 100644
--- a/platform/util/immutable-key-value-store/src/org/jetbrains/ikv/builder/IkvIndexBuilder.kt
+++ b/build/tasks/src/org/jetbrains/intellij/build/io/IkvIndexBuilder.kt
@@ -1,5 +1,5 @@
-// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
-package org.jetbrains.ikv.builder
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package org.jetbrains.intellij.build.io
import com.intellij.util.lang.ByteBufferCleaner
import java.nio.ByteBuffer
@@ -9,6 +9,7 @@ import java.nio.ByteOrder
class IkvIndexBuilder(private val writeSize: Boolean = true) {
private val entries = LinkedHashSet()
+ @JvmField val names = mutableListOf()
fun entry(key: Long, offset: Long, size: Int): IkvIndexEntry {
val entry = LongKeyedEntry(longKey = key, offset = offset)
diff --git a/platform/util/immutable-key-value-store/src/org/jetbrains/ikv/builder/IkvWriter.kt b/build/tasks/src/org/jetbrains/intellij/build/io/IkvWriter.kt
similarity index 95%
rename from platform/util/immutable-key-value-store/src/org/jetbrains/ikv/builder/IkvWriter.kt
rename to build/tasks/src/org/jetbrains/intellij/build/io/IkvWriter.kt
index 8507c6f43f30..cd8b748fbf70 100644
--- a/platform/util/immutable-key-value-store/src/org/jetbrains/ikv/builder/IkvWriter.kt
+++ b/build/tasks/src/org/jetbrains/intellij/build/io/IkvWriter.kt
@@ -1,5 +1,5 @@
-// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
-package org.jetbrains.ikv.builder
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package org.jetbrains.intellij.build.io
import java.nio.ByteBuffer
import java.nio.channels.FileChannel
diff --git a/build/tasks/src/org/jetbrains/intellij/build/io/PackageIndexBuilder.kt b/build/tasks/src/org/jetbrains/intellij/build/io/PackageIndexBuilder.kt
index b07dde6fea22..8e7722cd33a7 100644
--- a/build/tasks/src/org/jetbrains/intellij/build/io/PackageIndexBuilder.kt
+++ b/build/tasks/src/org/jetbrains/intellij/build/io/PackageIndexBuilder.kt
@@ -1,7 +1,8 @@
-// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.io
import com.intellij.util.lang.Xx3UnencodedString
+import com.intellij.util.lang.Xxh3
import it.unimi.dsi.fastutil.longs.LongOpenHashSet
class PackageIndexBuilder {
@@ -13,6 +14,8 @@ class PackageIndexBuilder {
private val dirsToRegister = HashSet()
private var wasWritten = false
+ @JvmField val indexWriter = IkvIndexBuilder()
+
fun addFile(name: String, addClassDir: Boolean = false) {
val i = name.lastIndexOf('/')
val packageNameHash = if (i == -1) 0 else Xx3UnencodedString.hashUnencodedStringRange(name, i)
@@ -47,11 +50,15 @@ class PackageIndexBuilder {
val stream = zipCreator.resultStream
if (addDirEntriesMode == AddDirEntriesMode.NONE) {
- stream.addDirsToIndex(sortedDirsToRegister)
+ for (dirName in sortedDirsToRegister) {
+ val nameBytes = dirName.encodeToByteArray()
+ indexWriter.add(indexWriter.entry(key = Xxh3.hash(nameBytes), offset = 0, size = -1))
+ indexWriter.names.add(nameBytes)
+ }
}
else {
for (dir in sortedDirsToRegister) {
- stream.addDirEntry(dir)
+ stream.addDirEntry(dir, indexWriter)
}
}
diff --git a/build/tasks/src/org/jetbrains/intellij/build/io/ZipArchiveOutputStream.kt b/build/tasks/src/org/jetbrains/intellij/build/io/ZipArchiveOutputStream.kt
index 332fe6788a37..7a7b7b7c2ade 100644
--- a/build/tasks/src/org/jetbrains/intellij/build/io/ZipArchiveOutputStream.kt
+++ b/build/tasks/src/org/jetbrains/intellij/build/io/ZipArchiveOutputStream.kt
@@ -1,9 +1,8 @@
-// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.io
import com.intellij.util.lang.ImmutableZipFile
import com.intellij.util.lang.Xxh3
-import org.jetbrains.ikv.builder.IkvIndexBuilder
import java.io.IOException
import java.nio.ByteBuffer
import java.nio.ByteOrder
@@ -17,8 +16,9 @@ private const val INDEX_FORMAT_VERSION: Byte = 4
const val INDEX_FILENAME: String = "__index__"
-internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
- private val withOptimizedMetadataEnabled: Boolean) : AutoCloseable {
+internal class ZipArchiveOutputStream(
+ private val channel: WritableByteChannel,
+) : AutoCloseable {
private var classPackages: LongArray? = null
private var resourcePackages: LongArray? = null
@@ -26,17 +26,15 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
private var entryCount = 0
private var metadataBuffer = ByteBuffer.allocateDirect(2 * 1024 * 1024).order(ByteOrder.LITTLE_ENDIAN)
+
// 1 MB should be enough for the end of the central directory record
private val buffer = ByteBuffer.allocateDirect(1024 * 1024).order(ByteOrder.LITTLE_ENDIAN)
- private val names = mutableListOf()
- private val indexWriter = IkvIndexBuilder()
-
private var channelPosition = 0L
private val fileChannel = channel as? FileChannel
- fun addDirEntry(name: String) {
+ fun addDirEntry(name: String, indexWriter: IkvIndexBuilder?) {
if (finished) {
throw IOException("Stream has already been finished")
}
@@ -75,10 +73,19 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
buffer.flip()
writeBuffer(buffer)
- writeCentralFileHeader(0, 0, ZipEntry.STORED, 0, nameInArchive, offset, dataOffset = -1, normalName = key)
+ writeCentralFileHeader(0, 0, ZipEntry.STORED, 0, nameInArchive, offset, dataOffset = -1, normalName = key, indexWriter = indexWriter)
}
- fun writeRawEntry(header: ByteBuffer, content: ByteBuffer, name: ByteArray, size: Int, compressedSize: Int, method: Int, crc: Long) {
+ fun writeRawEntry(
+ header: ByteBuffer,
+ content: ByteBuffer,
+ name: ByteArray,
+ size: Int,
+ compressedSize: Int,
+ method: Int,
+ crc: Long,
+ indexWriter: IkvIndexBuilder?,
+ ) {
if (finished) {
throw IOException("Stream has already been finished")
}
@@ -91,10 +98,28 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
writeBuffer(header)
writeBuffer(content)
- writeCentralFileHeader(size, compressedSize, method, crc, name, offset, dataOffset = dataOffset)
+ writeCentralFileHeader(
+ size = size,
+ compressedSize = compressedSize,
+ method = method,
+ crc = crc,
+ name = name,
+ offset = offset,
+ dataOffset = dataOffset,
+ indexWriter = indexWriter,
+ )
}
- fun writeRawEntry(content: ByteBuffer, name: ByteArray, size: Int, compressedSize: Int, method: Int, crc: Long, headerSize: Int) {
+ fun writeRawEntry(
+ content: ByteBuffer,
+ name: ByteArray,
+ size: Int,
+ compressedSize: Int,
+ method: Int,
+ crc: Long,
+ headerSize: Int,
+ indexWriter: IkvIndexBuilder?,
+ ) {
if (finished) {
throw IOException("Stream has already been finished")
}
@@ -104,10 +129,19 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
assert(method != -1)
writeBuffer(content)
- writeCentralFileHeader(size, compressedSize, method, crc, name, offset, dataOffset = offset + headerSize)
+ writeCentralFileHeader(size, compressedSize, method, crc, name, offset, dataOffset = offset + headerSize, indexWriter = indexWriter)
}
- fun writeEntryHeaderAt(name: ByteArray, header: ByteBuffer, position: Long, size: Int, compressedSize: Int, crc: Long, method: Int) {
+ fun writeEntryHeaderAt(
+ name: ByteArray,
+ header: ByteBuffer,
+ position: Long,
+ size: Int,
+ compressedSize: Int,
+ crc: Long,
+ method: Int,
+ indexWriter: IkvIndexBuilder?,
+ ) {
if (finished) {
throw IOException("Stream has already been finished")
}
@@ -134,16 +168,19 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
entryCount++
assert(channelPosition == dataOffset + compressedSize)
- writeCentralFileHeader(size = size,
- compressedSize = compressedSize,
- method = method,
- crc = crc,
- name = name,
- offset = position,
- dataOffset = dataOffset)
+ writeCentralFileHeader(
+ size = size,
+ compressedSize = compressedSize,
+ method = method,
+ crc = crc,
+ name = name,
+ offset = position,
+ dataOffset = dataOffset,
+ indexWriter = indexWriter,
+ )
}
- private fun writeIndex(crc32: CRC32): Int {
+ private fun writeIndex(crc32: CRC32, indexWriter: IkvIndexBuilder): Int {
// write one by one to channel to avoid buffer overflow
indexWriter.write {
crc32.update(it)
@@ -182,7 +219,7 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
}
// write names
- for (list in names.asSequence().chunked(4096)) {
+ for (list in indexWriter.names.asSequence().chunked(4096)) {
writeData { buffer ->
val shortBuffer = buffer.asShortBuffer()
for (name in list) {
@@ -192,7 +229,7 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
}
}
- for (list in names.asSequence().chunked(1024)) {
+ for (list in indexWriter.names.asSequence().chunked(1024)) {
writeData { buffer ->
for (name in list) {
buffer.put(name)
@@ -203,13 +240,13 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
return indexDataEnd
}
- fun finish() {
+ fun finish(indexWriter: IkvIndexBuilder?) {
if (finished) {
throw IOException("This archive has already been finished")
}
val indexOffset: Int
- if (withOptimizedMetadataEnabled && entryCount != 0) {
+ if (indexWriter != null && entryCount != 0) {
// ditto on macOS doesn't like arbitrary data in zip file - wrap into zip entry
val name = INDEX_FILENAME.toByteArray(Charsets.UTF_8)
val headerSize = 30 + name.size
@@ -217,7 +254,7 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
val entryDataPosition = channelPosition
val crc32 = CRC32()
- indexOffset = writeIndex(crc32)
+ indexOffset = writeIndex(crc32, indexWriter)
val size = (channelPosition - entryDataPosition).toInt()
val crc = crc32.value
@@ -226,13 +263,16 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
writeLocalFileHeader(name = name, size = size, compressedSize = size, crc32 = crc, method = ZipEntry.STORED, buffer = buffer)
buffer.flip()
assert(buffer.remaining() == headerSize)
- writeEntryHeaderAt(name = name,
- header = buffer,
- position = headerPosition,
- size = size,
- compressedSize = size,
- crc = crc,
- method = ZipEntry.STORED)
+ writeEntryHeaderAt(
+ name = name,
+ header = buffer,
+ position = headerPosition,
+ size = size,
+ compressedSize = size,
+ crc = crc,
+ method = ZipEntry.STORED,
+ indexWriter = indexWriter,
+ )
}
else {
indexOffset = -1
@@ -262,7 +302,7 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
buffer.putInt((centralDirectoryOffset and 0xffffffffL).toInt())
// comment length
- if (withOptimizedMetadataEnabled) {
+ if (indexWriter != null) {
buffer.putShort((Byte.SIZE_BYTES + Integer.BYTES).toShort())
// version
buffer.put(INDEX_FORMAT_VERSION)
@@ -273,7 +313,11 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
}
}
else {
- writeZip64End(centralDirectoryLength, centralDirectoryOffset, indexOffset)
+ writeZip64End(
+ centralDirectoryLength = centralDirectoryLength,
+ centralDirectoryOffset = centralDirectoryOffset,
+ optimizedMetadataOffset = indexOffset,
+ )
}
buffer.flip()
writeBuffer(buffer)
@@ -306,7 +350,7 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
buffer.putLong(centralDirectoryOffset)
// comment length
- if (withOptimizedMetadataEnabled) {
+ if (optimizedMetadataOffset != -1) {
// version
buffer.put(INDEX_FORMAT_VERSION)
buffer.putInt(optimizedMetadataOffset)
@@ -375,7 +419,7 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
try {
if (!finished) {
channel.use {
- finish()
+ finish(indexWriter = null)
}
}
}
@@ -385,23 +429,17 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
}
}
- fun addDirsToIndex(dirNames: Collection) {
- assert(withOptimizedMetadataEnabled)
- for (dirName in dirNames) {
- val nameBytes = dirName.toByteArray(Charsets.UTF_8)
- indexWriter.add(indexWriter.entry(key = Xxh3.hash(nameBytes), offset = 0, size = -1))
- names.add(nameBytes)
- }
- }
-
- private fun writeCentralFileHeader(size: Int,
- compressedSize: Int,
- method: Int,
- crc: Long,
- name: ByteArray,
- offset: Long,
- dataOffset: Long,
- normalName: ByteArray = name) {
+ private fun writeCentralFileHeader(
+ size: Int,
+ compressedSize: Int,
+ method: Int,
+ crc: Long,
+ name: ByteArray,
+ offset: Long,
+ dataOffset: Long,
+ normalName: ByteArray = name,
+ indexWriter: IkvIndexBuilder?,
+ ) {
var buffer = metadataBuffer
if (buffer.remaining() < (46 + name.size)) {
metadataBuffer = ByteBuffer.allocateDirect(buffer.capacity() * 2).order(ByteOrder.LITTLE_ENDIAN)
@@ -422,9 +460,9 @@ internal class ZipArchiveOutputStream(private val channel: WritableByteChannel,
// uncompressed size
buffer.putInt(headerOffset + 24, size)
- if (withOptimizedMetadataEnabled) {
+ if (indexWriter != null) {
indexWriter.add(indexWriter.entry(offset = dataOffset, size = size, key = Xxh3.hash(normalName)))
- names.add(normalName)
+ indexWriter.names.add(normalName)
}
// file name length
diff --git a/build/tasks/src/org/jetbrains/intellij/build/io/ZipFileWriter.kt b/build/tasks/src/org/jetbrains/intellij/build/io/ZipFileWriter.kt
index fd7b918a932a..bba1eec7de27 100644
--- a/build/tasks/src/org/jetbrains/intellij/build/io/ZipFileWriter.kt
+++ b/build/tasks/src/org/jetbrains/intellij/build/io/ZipFileWriter.kt
@@ -1,4 +1,4 @@
-// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ConstPropertyName")
package org.jetbrains.intellij.build.io
@@ -36,25 +36,24 @@ fun transformZipUsingTempFile(file: Path, task: (ZipFileWriter) -> Unit) {
}
}
-
-inline fun writeNewZip(file: Path,
- compress: Boolean = false,
- withOptimizedMetadataEnabled: Boolean = !compress,
- task: (ZipFileWriter) -> Unit) {
+inline fun writeNewZipWithoutIndex(
+ file: Path,
+ compress: Boolean = false,
+ task: (ZipFileWriter) -> Unit,
+) {
Files.createDirectories(file.parent)
- ZipFileWriter(channel = FileChannel.open(file, W_CREATE_NEW),
- deflater = if (compress) Deflater(Deflater.DEFAULT_COMPRESSION, true) else null,
- withOptimizedMetadataEnabled = !compress && withOptimizedMetadataEnabled).use {
+ ZipFileWriter(
+ channel = FileChannel.open(file, W_CREATE_NEW),
+ deflater = if (compress) Deflater(Deflater.DEFAULT_COMPRESSION, true) else null,
+ ).use {
task(it)
}
}
// you must pass SeekableByteChannel if files are written (`file` method)
-class ZipFileWriter(channel: WritableByteChannel,
- private val deflater: Deflater? = null,
- withOptimizedMetadataEnabled: Boolean = deflater == null) : AutoCloseable {
+class ZipFileWriter(channel: WritableByteChannel, private val deflater: Deflater? = null) : AutoCloseable {
// size is written as part of optimized metadata - so, if compression is enabled, optimized metadata will be incorrect
- internal val resultStream = ZipArchiveOutputStream(channel, withOptimizedMetadataEnabled = withOptimizedMetadataEnabled)
+ internal val resultStream = ZipArchiveOutputStream(channel)
private val crc32 = CRC32()
private val bufferAllocator = ByteBufferAllocator()
@@ -64,7 +63,7 @@ class ZipFileWriter(channel: WritableByteChannel,
get() = resultStream.getChannelPosition()
@Suppress("DuplicatedCode")
- fun file(nameString: String, file: Path) {
+ fun file(nameString: String, file: Path, indexWriter: IkvIndexBuilder?) {
var isCompressed = deflater != null && !nameString.endsWith(".png")
val name = nameString.toByteArray()
@@ -77,7 +76,7 @@ class ZipFileWriter(channel: WritableByteChannel,
FileChannel.open(file, EnumSet.of(StandardOpenOption.READ)).use { channel ->
size = channel.size().toInt()
if (size == 0) {
- writeEmptyFile(name, headerSize)
+ writeEmptyFile(name, headerSize, indexWriter)
return
}
if (size < compressThreshold) {
@@ -100,13 +99,16 @@ class ZipFileWriter(channel: WritableByteChannel,
writeLocalFileHeader(name = name, size = size, compressedSize = compressedSize, crc32 = crc, method = method, buffer = buffer)
buffer.position(0)
assert(buffer.remaining() == headerSize)
- resultStream.writeEntryHeaderAt(name = name,
- header = buffer,
- position = headerPosition,
- size = size,
- compressedSize = compressedSize,
- crc = crc,
- method = method)
+ resultStream.writeEntryHeaderAt(
+ name = name,
+ header = buffer,
+ position = headerPosition,
+ size = size,
+ compressedSize = compressedSize,
+ crc = crc,
+ method = method,
+ indexWriter = indexWriter,
+ )
return
}
@@ -129,7 +131,7 @@ class ZipFileWriter(channel: WritableByteChannel,
writeLocalFileHeader(name, size, size, crc, ZipEntry.STORED, input)
input.position(0)
assert(input.remaining() == (size + headerSize))
- resultStream.writeRawEntry(input, name, size, size, ZipEntry.STORED, crc, headerSize)
+ resultStream.writeRawEntry(input, name, size, size, ZipEntry.STORED, crc, headerSize, indexWriter)
}
private fun writeLargeFile(fileSize: Long, channel: FileChannel, deflater: Deflater?): Long {
@@ -226,19 +228,28 @@ class ZipFileWriter(channel: WritableByteChannel,
writeLocalFileHeader(name, size, compressedSize, crc, ZipEntry.DEFLATED, output)
output.position(0)
assert(output.remaining() == (compressedSize + headerSize))
- resultStream.writeRawEntry(output, name, size, compressedSize, ZipEntry.DEFLATED, crc, headerSize)
+ resultStream.writeRawEntry(
+ content = output,
+ name = name,
+ size = size,
+ compressedSize = compressedSize,
+ method = ZipEntry.DEFLATED,
+ crc = crc,
+ headerSize = headerSize,
+ indexWriter = null,
+ )
}
- fun uncompressedData(nameString: String, data: String) {
- uncompressedData(nameString, ByteBuffer.wrap(data.toByteArray()))
+ fun uncompressedData(nameString: String, data: String, indexWriter: IkvIndexBuilder?) {
+ uncompressedData(nameString, ByteBuffer.wrap(data.toByteArray()), indexWriter)
}
- fun uncompressedData(nameString: String, data: ByteBuffer) {
+ fun uncompressedData(nameString: String, data: ByteBuffer, indexWriter: IkvIndexBuilder?) {
val name = nameString.toByteArray()
val headerSize = 30 + name.size
if (!data.hasRemaining()) {
- writeEmptyFile(name, headerSize)
+ writeEmptyFile(name, headerSize, indexWriter)
return
}
@@ -252,10 +263,10 @@ class ZipFileWriter(channel: WritableByteChannel,
val header = bufferAllocator.allocate(headerSize)
writeLocalFileHeader(name, size, size, crc, ZipEntry.STORED, header)
header.position(0)
- resultStream.writeRawEntry(header, data, name, size, size, ZipEntry.STORED, crc)
+ resultStream.writeRawEntry(header, data, name, size, size, ZipEntry.STORED, crc, indexWriter = indexWriter)
}
- fun uncompressedData(nameString: String, maxSize: Int, dataWriter: (ByteBuffer) -> Unit) {
+ fun uncompressedData(nameString: String, maxSize: Int, indexWriter: IkvIndexBuilder?, dataWriter: (ByteBuffer) -> Unit) {
val name = nameString.toByteArray()
val headerSize = 30 + name.size
@@ -274,19 +285,19 @@ class ZipFileWriter(channel: WritableByteChannel,
writeLocalFileHeader(name, size, size, crc, ZipEntry.STORED, output)
output.position(0)
assert(output.remaining() == (size + headerSize))
- resultStream.writeRawEntry(output, name, size, size, ZipEntry.STORED, crc, headerSize)
+ resultStream.writeRawEntry(output, name, size, size, ZipEntry.STORED, crc, headerSize, indexWriter = indexWriter)
}
- private fun writeEmptyFile(name: ByteArray, headerSize: Int) {
+ private fun writeEmptyFile(name: ByteArray, headerSize: Int, indexWriter: IkvIndexBuilder?) {
val input = bufferAllocator.allocate(headerSize)
writeLocalFileHeader(name, size = 0, compressedSize = 0, crc32 = 0, method = ZipEntry.STORED, buffer = input)
input.position(0)
input.limit(headerSize)
- resultStream.writeRawEntry(input, name, 0, 0, ZipEntry.STORED, 0, headerSize)
+ resultStream.writeRawEntry(input, name, 0, 0, ZipEntry.STORED, 0, headerSize, indexWriter)
}
- fun dir(name: String) {
- resultStream.addDirEntry(name)
+ fun dir(name: String, indexWriter: IkvIndexBuilder?) {
+ resultStream.addDirEntry(name, indexWriter)
}
override fun close() {
diff --git a/build/tasks/src/org/jetbrains/intellij/build/io/zip.kt b/build/tasks/src/org/jetbrains/intellij/build/io/zip.kt
index 2f3136a94a3e..9918cdf6dd04 100644
--- a/build/tasks/src/org/jetbrains/intellij/build/io/zip.kt
+++ b/build/tasks/src/org/jetbrains/intellij/build/io/zip.kt
@@ -1,4 +1,4 @@
-// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.io
import java.nio.channels.FileChannel
@@ -14,17 +14,19 @@ enum class AddDirEntriesMode {
ALL
}
-fun zipWithCompression(targetFile: Path,
- dirs: Map,
- compressionLevel: Int = Deflater.DEFAULT_COMPRESSION,
- addDirEntriesMode: AddDirEntriesMode = AddDirEntriesMode.NONE,
- overwrite: Boolean = false,
- fileFilter: ((name: String) -> Boolean)? = null) {
+fun zipWithCompression(
+ targetFile: Path,
+ dirs: Map,
+ compressionLevel: Int = Deflater.DEFAULT_COMPRESSION,
+ addDirEntriesMode: AddDirEntriesMode = AddDirEntriesMode.NONE,
+ overwrite: Boolean = false,
+ fileFilter: ((name: String) -> Boolean)? = null,
+) {
Files.createDirectories(targetFile.parent)
ZipFileWriter(channel = FileChannel.open(targetFile, if (overwrite) W_OVERWRITE else W_CREATE_NEW),
deflater = if (compressionLevel == Deflater.NO_COMPRESSION) null else Deflater(compressionLevel, true)).use { zipFileWriter ->
if (addDirEntriesMode == AddDirEntriesMode.NONE) {
- doArchive(zipFileWriter = zipFileWriter, fileAdded = fileFilter, dirs = dirs)
+ doArchive(zipFileWriter = zipFileWriter, fileAdded = fileFilter, dirs = dirs, indexWriter = null)
}
else {
val dirNameSetToAdd = LinkedHashSet()
@@ -42,48 +44,54 @@ fun zipWithCompression(targetFile: Path,
}
}
- doArchive(zipFileWriter = zipFileWriter, fileAdded = fileAdded, dirs = dirs)
+ doArchive(zipFileWriter = zipFileWriter, fileAdded = fileAdded, dirs = dirs, indexWriter = null)
for (dir in dirNameSetToAdd) {
- zipFileWriter.dir(dir)
+ zipFileWriter.dir(name = dir, indexWriter = null)
}
}
}
}
// symlinks are not supported but can be easily implemented - see CollectingVisitor.visitFile
-fun zip(targetFile: Path,
- dirs: Map,
- addDirEntriesMode: AddDirEntriesMode = AddDirEntriesMode.RESOURCE_ONLY,
- overwrite: Boolean = false,
- fileFilter: ((name: String) -> Boolean)? = null) {
+fun zip(
+ targetFile: Path,
+ dirs: Map,
+ addDirEntriesMode: AddDirEntriesMode = AddDirEntriesMode.RESOURCE_ONLY,
+ overwrite: Boolean = false,
+ fileFilter: ((name: String) -> Boolean)? = null,
+) {
Files.createDirectories(targetFile.parent)
ZipFileWriter(channel = FileChannel.open(targetFile, if (overwrite) W_OVERWRITE else W_CREATE_NEW)).use { zipFileWriter ->
if (addDirEntriesMode == AddDirEntriesMode.NONE) {
- doArchive(zipFileWriter = zipFileWriter, fileAdded = fileFilter, dirs = dirs)
+ doArchive(zipFileWriter = zipFileWriter, fileAdded = fileFilter, dirs = dirs, indexWriter = null)
}
else {
val packageIndexBuilder = PackageIndexBuilder()
- val fileAdded = { name: String ->
- if (fileFilter != null && !fileFilter(name)) {
- false
- }
- else {
- packageIndexBuilder.addFile(name, addClassDir = addDirEntriesMode == AddDirEntriesMode.ALL)
- true
- }
- }
- doArchive(zipFileWriter = zipFileWriter, fileAdded = fileAdded, dirs = dirs)
+ doArchive(
+ zipFileWriter = zipFileWriter,
+ fileAdded = { name ->
+ if (fileFilter != null && !fileFilter(name)) {
+ false
+ }
+ else {
+ packageIndexBuilder.addFile(name, addClassDir = addDirEntriesMode == AddDirEntriesMode.ALL)
+ true
+ }
+ },
+ dirs = dirs,
+ indexWriter = packageIndexBuilder.indexWriter,
+ )
packageIndexBuilder.writePackageIndex(zipFileWriter, addDirEntriesMode = addDirEntriesMode)
}
}
}
-private fun doArchive(zipFileWriter: ZipFileWriter, fileAdded: ((String) -> Boolean)?, dirs: Map) {
+private fun doArchive(zipFileWriter: ZipFileWriter, fileAdded: ((String) -> Boolean)?, dirs: Map, indexWriter: IkvIndexBuilder?) {
val archiver = ZipArchiver(zipFileWriter, fileAdded)
for ((dir, prefix) in dirs.entries) {
val normalizedDir = dir.toAbsolutePath().normalize()
archiver.setRootDir(normalizedDir, prefix)
- archiveDir(normalizedDir, archiver, excludes = null)
+ archiveDir(normalizedDir, archiver, excludes = null, indexWriter = indexWriter)
}
}
@@ -99,7 +107,7 @@ private fun addDirWithParents(name: String, dirNameSetToAdd: MutableSet)
}
}
-class ZipArchiver(private val zipCreator: ZipFileWriter, val fileAdded: ((String) -> Boolean)? = null) : AutoCloseable {
+class ZipArchiver(private val zipCreator: ZipFileWriter, @JvmField val fileAdded: ((String) -> Boolean)? = null) : AutoCloseable {
private var localPrefixLength = -1
private var archivePrefix = ""
@@ -114,10 +122,10 @@ class ZipArchiver(private val zipCreator: ZipFileWriter, val fileAdded: ((String
localPrefixLength = rootDir.toString().length + 1
}
- fun addFile(file: Path) {
+ fun addFile(file: Path, indexWriter: IkvIndexBuilder?) {
val name = archivePrefix + file.toString().substring(localPrefixLength).replace('\\', '/')
if (fileAdded == null || fileAdded.invoke(name)) {
- zipCreator.file(name, file)
+ zipCreator.file(name, file, indexWriter)
}
}
@@ -126,7 +134,7 @@ class ZipArchiver(private val zipCreator: ZipFileWriter, val fileAdded: ((String
}
}
-fun archiveDir(startDir: Path, archiver: ZipArchiver, excludes: List? = emptyList()) {
+fun archiveDir(startDir: Path, archiver: ZipArchiver, indexWriter: IkvIndexBuilder?, excludes: List? = emptyList()) {
val dirCandidates = ArrayDeque()
dirCandidates.add(startDir)
val tempList = ArrayList()
@@ -163,20 +171,8 @@ fun archiveDir(startDir: Path, archiver: ZipArchiver, excludes: List Boolean = { true }) {
- readZipFile(sourceFile) { name, data ->
- if (filter(name)) {
- packageIndexBuilder.addFile(name)
- zipCreator.uncompressedData(name, data())
- }
- }
}
\ No newline at end of file
diff --git a/platform/util/immutable-key-value-store/testSrc/com/intellij/util/lang/HashFunctionTest.java b/build/tasks/test/org/jetbrains/intellij/build/io/HashFunctionTest.java
similarity index 89%
rename from platform/util/immutable-key-value-store/testSrc/com/intellij/util/lang/HashFunctionTest.java
rename to build/tasks/test/org/jetbrains/intellij/build/io/HashFunctionTest.java
index eec36e8cd91c..09db944ff768 100644
--- a/platform/util/immutable-key-value-store/testSrc/com/intellij/util/lang/HashFunctionTest.java
+++ b/build/tasks/test/org/jetbrains/intellij/build/io/HashFunctionTest.java
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.intellij.util.lang;
+package org.jetbrains.intellij.build.io;
+
+import com.intellij.util.lang.Xxh3;
+import org.assertj.core.api.AssertionsForClassTypes;
import java.nio.Buffer;
import java.nio.ByteBuffer;
@@ -30,7 +33,7 @@ final class HashFunctionTest {
}
private static void testArrays(byte[] data, long eh, int len) {
- assertThat(Xxh3.hash(data)).isEqualTo(eh);
+ AssertionsForClassTypes.assertThat(Xxh3.hash(data)).isEqualTo(eh);
byte[] data2 = new byte[len + 2];
System.arraycopy(data, 0, data2, 1, len);
diff --git a/platform/util/immutable-key-value-store/testSrc/org/jetbrains/ikv/builder/IkvTest.kt b/build/tasks/test/org/jetbrains/intellij/build/io/IkvTest.kt
similarity index 96%
rename from platform/util/immutable-key-value-store/testSrc/org/jetbrains/ikv/builder/IkvTest.kt
rename to build/tasks/test/org/jetbrains/intellij/build/io/IkvTest.kt
index 0939ce5eca9a..33a3a813d27b 100644
--- a/platform/util/immutable-key-value-store/testSrc/org/jetbrains/ikv/builder/IkvTest.kt
+++ b/build/tasks/test/org/jetbrains/intellij/build/io/IkvTest.kt
@@ -1,5 +1,5 @@
-// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
-package org.jetbrains.ikv.builder
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package org.jetbrains.intellij.build.io
import com.intellij.util.lang.Ikv
import com.intellij.util.lang.Xxh3
diff --git a/platform/util/immutable-key-value-store/testSrc/com/intellij/util/lang/XxHash3Test.java b/build/tasks/test/org/jetbrains/intellij/build/io/XxHash3Test.java
similarity index 99%
rename from platform/util/immutable-key-value-store/testSrc/com/intellij/util/lang/XxHash3Test.java
rename to build/tasks/test/org/jetbrains/intellij/build/io/XxHash3Test.java
index f89f807e6fd2..f58225c800f1 100644
--- a/platform/util/immutable-key-value-store/testSrc/com/intellij/util/lang/XxHash3Test.java
+++ b/build/tasks/test/org/jetbrains/intellij/build/io/XxHash3Test.java
@@ -13,20 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.intellij.util.lang;
+package org.jetbrains.intellij.build.io;
+import com.intellij.util.lang.Xx3UnencodedString;
+import com.intellij.util.lang.Xxh3;
+import org.assertj.core.api.AssertionsForClassTypes;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
import java.util.Random;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
@@ -60,7 +59,7 @@ public class XxHash3Test {
case 10_000 -> -4959357597963000776L;
default -> throw new UnsupportedOperationException("Unknown size");
};
- assertThat(Xxh3.hashLongs(data)).isEqualTo(expected);
+ AssertionsForClassTypes.assertThat(Xxh3.hashLongs(data)).isEqualTo(expected);
}
@Test
@@ -100,7 +99,7 @@ public class XxHash3Test {
}
private static void checkPackage(String s, long expected) {
- assertThat(Xx3UnencodedString.hashUnencodedString(s.replace('.', '/'))).describedAs("Hash as string of: " + s).isEqualTo(expected);
+ AssertionsForClassTypes.assertThat(Xx3UnencodedString.hashUnencodedString(s.replace('.', '/'))).describedAs("Hash as string of: " + s).isEqualTo(expected);
}
private static void testUnencodedString(String s, long expected) {
diff --git a/platform/build-scripts/icons/intellij.platform.images.build.iml b/platform/build-scripts/icons/intellij.platform.images.build.iml
index ac77a545114d..79b2873347a1 100644
--- a/platform/build-scripts/icons/intellij.platform.images.build.iml
+++ b/platform/build-scripts/icons/intellij.platform.images.build.iml
@@ -25,7 +25,6 @@
-
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/classpath.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/classpath.kt
index 0c2c60faf171..e42c474e0c9b 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/classpath.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/classpath.kt
@@ -151,7 +151,11 @@ fun reorderJar(jarFile: Path, orderedNames: List) {
for (entry in entries) {
packageIndexBuilder.addFile(entry.name)
- zipCreator.uncompressedData(entry.name, entry.getByteBuffer(sourceZip))
+ zipCreator.uncompressedData(
+ nameString = entry.name,
+ data = entry.getByteBuffer(sourceZip),
+ indexWriter = packageIndexBuilder.indexWriter,
+ )
}
packageIndexBuilder.writePackageIndex(zipCreator)
}
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BaseLayout.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BaseLayout.kt
index 010bd2437fb0..7e4c24992035 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BaseLayout.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BaseLayout.kt
@@ -206,11 +206,10 @@ class ModuleItem(
}
override fun equals(other: Any?): Boolean {
- return this === other ||
- other is ModuleItem && moduleName == other.moduleName && relativeOutputFile == other.relativeOutputFile
+ return this === other || other is ModuleItem && moduleName == other.moduleName && relativeOutputFile == other.relativeOutputFile
}
override fun hashCode(): Int = 31 * moduleName.hashCode() + relativeOutputFile.hashCode()
- override fun toString(): String = "ModuleItem(moduleName=${moduleName}, relativeOutputFile=${relativeOutputFile}, reason=${reason})"
+ override fun toString(): String = "ModuleItem(moduleName=$moduleName, relativeOutputFile=$relativeOutputFile, reason=$reason)"
}
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BuiltInHelpPlugin.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BuiltInHelpPlugin.kt
index f4d074f4e4e5..06574f434f88 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BuiltInHelpPlugin.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/BuiltInHelpPlugin.kt
@@ -1,4 +1,4 @@
-// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.impl
import com.intellij.platform.diagnostic.telemetry.helpers.use
@@ -10,7 +10,7 @@ import org.jetbrains.intellij.build.CompilationContext
import org.jetbrains.intellij.build.TraceManager.spanBuilder
import org.jetbrains.intellij.build.io.ZipArchiver
import org.jetbrains.intellij.build.io.archiveDir
-import org.jetbrains.intellij.build.io.writeNewZip
+import org.jetbrains.intellij.build.io.writeNewZipWithoutIndex
import java.nio.file.Files
import java.nio.file.Path
@@ -96,12 +96,12 @@ private suspend fun buildResourcesForHelpPlugin(resourceRoot: Path, classPath: L
jvmArgs = emptyList(),
classPath = classPath)
}
- writeNewZip(assetJar, compress = true) { zipCreator ->
+ writeNewZipWithoutIndex(assetJar, compress = true) { zipCreator ->
val archiver = ZipArchiver(zipCreator)
archiver.setRootDir(resourceRoot)
- archiveDir(resourceRoot.resolve("topics"), archiver)
- archiveDir(resourceRoot.resolve("images"), archiver)
- archiveDir(resourceRoot.resolve("search"), archiver)
+ archiveDir(resourceRoot.resolve("topics"), archiver, null)
+ archiveDir(resourceRoot.resolve("images"), archiver, null)
+ archiveDir(resourceRoot.resolve("search"), archiver, null)
}
}
}
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt
index ef441b475e3c..7b9682eaf5eb 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt
@@ -1262,15 +1262,15 @@ private fun archivePlugin(optimized: Boolean,
source: Path,
context: BuildContext) {
if (optimized) {
- writeNewZip(target, compress = compress, withOptimizedMetadataEnabled = false) { zipCreator ->
+ writeNewZipWithoutIndex(target, compress = compress) { zipCreator ->
ZipArchiver(zipCreator).use { archiver ->
if (Files.isDirectory(source)) {
archiver.setRootDir(source, source.fileName.toString())
- archiveDir(startDir = source, archiver = archiver, excludes = null)
+ archiveDir(startDir = source, archiver = archiver, excludes = null, indexWriter = null)
}
else {
archiver.setRootDir(source.parent)
- archiver.addFile(source)
+ archiver.addFile(source, indexWriter = null)
}
}
}
@@ -1300,7 +1300,7 @@ private fun buildBlockMap(file: Path, json: JSON) {
val fileParent = file.parent
val fileName = file.fileName.toString()
- writeNewZip(fileParent.resolve("$fileName.blockmap.zip"), compress = true) {
+ writeNewZipWithoutIndex(fileParent.resolve("$fileName.blockmap.zip"), compress = true) {
it.compressedData("blockmap.json", ByteBuffer.wrap(bytes))
}
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/keymapPlugin.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/keymapPlugin.kt
index 2c60305c1976..fa5bd6539d68 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/keymapPlugin.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/keymapPlugin.kt
@@ -2,8 +2,9 @@
package org.jetbrains.intellij.build.impl
+import org.jetbrains.intellij.build.io.PackageIndexBuilder
import org.jetbrains.intellij.build.io.ZipFileWriter
-import org.jetbrains.intellij.build.io.writeNewZip
+import org.jetbrains.intellij.build.io.writeNewZipWithoutIndex
import java.nio.ByteBuffer
import java.nio.channels.SeekableByteChannel
import java.nio.channels.WritableByteChannel
@@ -23,8 +24,11 @@ internal fun buildKeymapPlugin(keymaps: Array, buildNumber: String, targ
val buffer = ByteBuffer.allocate(128 * 1024)
ZipFileWriter(WritableByteChannelBackedByByteBuffer(buffer)).use { zipCreator ->
- zipCreator.uncompressedData("META-INF/plugin.xml", ByteBuffer.wrap(pluginXmlData))
+ val packageIndexBuilder = PackageIndexBuilder()
+ zipCreator.uncompressedData("META-INF/plugin.xml", ByteBuffer.wrap(pluginXmlData), packageIndexBuilder.indexWriter)
+ packageIndexBuilder.addFile("META-INF/plugin.xml")
+ packageIndexBuilder.addFile("META-INF/pluginIcon.svg")
@Suppress("SpellCheckingInspection")
zipCreator.uncompressedData("META-INF/pluginIcon.svg",
"\n")
+ "\n", packageIndexBuilder.indexWriter)
+
+ packageIndexBuilder.addFile("META-INF/pluginIcon_dark.svg")
@Suppress("SpellCheckingInspection")
zipCreator.uncompressedData("META-INF/pluginIcon_dark.svg",
"\n")
+ "\n", packageIndexBuilder.indexWriter)
for (name in keymaps) {
- zipCreator.file("keymaps/$name.xml", keymapDir.resolve("$name.xml"))
+ val keymapFile = "keymaps/$name.xml"
+ packageIndexBuilder.addFile(keymapFile)
+ zipCreator.file(keymapFile, keymapDir.resolve("$name.xml"), packageIndexBuilder.indexWriter)
}
+
+ packageIndexBuilder.writePackageIndex(zipCreator)
}
buffer.flip()
val resultFile = targetDir.resolve("${shortName}Keymap.zip")
- writeNewZip(resultFile, compress = true) {
- it.uncompressedData("${shortName}Keymap/lib/${shortName}Keymap.jar", buffer)
+ writeNewZipWithoutIndex(resultFile, compress = true) {
+ it.uncompressedData("${shortName}Keymap/lib/${shortName}Keymap.jar", buffer, null)
}
return Pair(resultFile, pluginXmlData)
}
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/sign.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/sign.kt
index 633706a41a2b..439dd287be7b 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/sign.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/sign.kt
@@ -1,10 +1,10 @@
-// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplacePutWithAssignment")
package org.jetbrains.intellij.build.impl
import com.intellij.openapi.util.SystemInfoRt
-import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
import com.intellij.platform.diagnostic.telemetry.helpers.use
+import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
import com.jetbrains.signatureverifier.ILogger
import com.jetbrains.signatureverifier.InvalidDataException
import com.jetbrains.signatureverifier.crypt.SignatureVerificationParams
@@ -123,17 +123,17 @@ private fun copyZipReplacing(origin: Path, entries: Map, context:
.setAttribute(AttributeKey.stringArrayKey("unsigned"), entries.keys.toList())
.use {
transformZipUsingTempFile(origin) { zipWriter ->
- val index = PackageIndexBuilder()
+ val packageIndexBuilder = PackageIndexBuilder()
readZipFile(origin) { name, dataSupplier ->
- index.addFile(name)
+ packageIndexBuilder.addFile(name)
if (entries.containsKey(name)) {
- zipWriter.file(name, entries.getValue(name))
+ zipWriter.file(name, entries.getValue(name), packageIndexBuilder.indexWriter)
}
else {
- zipWriter.uncompressedData(name, dataSupplier())
+ zipWriter.uncompressedData(name, dataSupplier(), packageIndexBuilder.indexWriter)
}
}
- index.writePackageIndex(zipWriter)
+ packageIndexBuilder.writePackageIndex(zipWriter)
}
Files.setLastModifiedTime(origin, FileTime.from(context.options.buildDateInSeconds, TimeUnit.SECONDS))
}
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/mergeJars.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/mergeJars.kt
index 9baadc753325..d0e68ff6c7e0 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/mergeJars.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/mergeJars.kt
@@ -180,7 +180,14 @@ internal suspend fun buildJar(
})
val normalizedDir = source.dir.toAbsolutePath().normalize()
archiver.setRootDir(normalizedDir, source.prefix)
- archiveDir(startDir = normalizedDir, archiver = archiver, excludes = source.excludes.takeIf(List::isNotEmpty))
+ archiveDir(
+ startDir = normalizedDir,
+ archiver = archiver,
+ indexWriter = packageIndexBuilder?.indexWriter,
+ excludes = source.excludes.takeIf(
+ List::isNotEmpty,
+ )
+ )
}
is InMemoryContentSource -> {
@@ -192,9 +199,14 @@ internal suspend fun buildJar(
}
packageIndexBuilder?.addFile(source.relativePath)
- zipCreator.uncompressedData(source.relativePath, source.data.size) {
- it.put(source.data)
- }
+ zipCreator.uncompressedData(
+ nameString = source.relativePath,
+ maxSize = source.data.size,
+ indexWriter = packageIndexBuilder?.indexWriter,
+ dataWriter = {
+ it.put(source.data)
+ },
+ )
}
is ZipSource -> {
@@ -276,11 +288,11 @@ private suspend fun handleZipSource(source: ZipSource,
zipCreator.compressedData(name, dataSupplier())
}
else {
- zipCreator.uncompressedData(name, dataSupplier())
+ zipCreator.uncompressedData(name, dataSupplier(), indexWriter = packageIndexBuilder?.indexWriter)
}
}
else {
- zipCreator.file(name, file)
+ zipCreator.file(name, file, indexWriter = packageIndexBuilder?.indexWriter)
Files.delete(file)
}
}
@@ -293,7 +305,7 @@ private suspend fun handleZipSource(source: ZipSource,
zipCreator.compressedData(name, data)
}
else {
- zipCreator.uncompressedData(name, data)
+ zipCreator.uncompressedData(name, data, indexWriter = packageIndexBuilder?.indexWriter)
}
}
}
diff --git a/platform/util/immutable-key-value-store/benchmark/intellij.platform.util.immutableKeyValueStore.benchmark.iml b/platform/util/immutable-key-value-store/benchmark/intellij.platform.util.immutableKeyValueStore.benchmark.iml
index 335a178ce624..eeb0301b29e3 100644
--- a/platform/util/immutable-key-value-store/benchmark/intellij.platform.util.immutableKeyValueStore.benchmark.iml
+++ b/platform/util/immutable-key-value-store/benchmark/intellij.platform.util.immutableKeyValueStore.benchmark.iml
@@ -10,8 +10,8 @@
-
+
\ No newline at end of file
diff --git a/platform/util/immutable-key-value-store/benchmark/test/BenchmarkHelper.kt b/platform/util/immutable-key-value-store/benchmark/test/BenchmarkHelper.kt
index 390968df4842..4610e2367c19 100644
--- a/platform/util/immutable-key-value-store/benchmark/test/BenchmarkHelper.kt
+++ b/platform/util/immutable-key-value-store/benchmark/test/BenchmarkHelper.kt
@@ -2,7 +2,7 @@
package com.intellij.platform.util.immutableKeyValueStore.benchmark
import com.intellij.util.lang.Xxh3
-import org.jetbrains.ikv.builder.IkvWriter
+import org.jetbrains.intellij.build.io.IkvWriter
import java.nio.channels.FileChannel
import java.nio.file.Files
import java.nio.file.Path