mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
IJPL-172978 a current UUID of a binary as an argument
(cherry picked from commit aab92c882b3a4e4e8e0c2040efc41eb17352fe35) IJ-CR-151551 GitOrigin-RevId: 5d7e319582ed313a27a355f4b93b19a81950819a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a67918cd97
commit
2040d4ee18
@@ -171,7 +171,7 @@ open class MacDistributionCustomizer {
|
||||
* @see org.jetbrains.intellij.build.NativeBinaryDownloader.getLauncher
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
open fun getDistributionUUID(context: BuildContext): UUID {
|
||||
open fun getDistributionUUID(context: BuildContext, currentUuid: UUID?): UUID {
|
||||
return UUID.nameUUIDFromBytes("${context.fullBuildNumber}-${context.options.buildDateInSeconds}".toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.StandardCopyOption
|
||||
import java.time.LocalDate
|
||||
import java.util.UUID
|
||||
import java.util.zip.Deflater
|
||||
import kotlin.io.path.*
|
||||
|
||||
@@ -216,7 +215,7 @@ class MacDistributionBuilder(
|
||||
val (execPath, licensePath) = NativeBinaryDownloader.getLauncher(context, OsFamily.MACOS, arch)
|
||||
val copy = macDistDir.resolve("MacOS/$executable")
|
||||
copyFile(execPath, copy)
|
||||
MachOUuid(copy, customizer.getDistributionUUID(context), context).patch()
|
||||
MachOUuid(copy, customizer, context).patch()
|
||||
copyFile(licensePath, macDistDir.resolve("license/launcher-third-party-libraries.html"))
|
||||
|
||||
val icnsPath = Path.of((if (context.applicationInfo.isEAP) customizer.icnsPathForEAP else null) ?: customizer.icnsPath)
|
||||
|
||||
@@ -4,6 +4,7 @@ package org.jetbrains.intellij.build.impl.macOS
|
||||
import com.intellij.openapi.util.SystemInfoRt
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.intellij.build.BuildContext
|
||||
import org.jetbrains.intellij.build.MacDistributionCustomizer
|
||||
import org.jetbrains.intellij.build.io.runProcess
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
@@ -13,10 +14,10 @@ import java.nio.file.StandardOpenOption
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Patches UUID value in the Mach-O [executable] with the [newUuid].
|
||||
* Patches UUID value in the Mach-O [executable] with the [MacDistributionCustomizer.getDistributionUUID].
|
||||
* Only single-arch 64-bit files are supported.
|
||||
*/
|
||||
internal class MachOUuid(private val executable: Path, private val newUuid: UUID, private val context: BuildContext) {
|
||||
internal class MachOUuid(private val executable: Path, private val customizer: MacDistributionCustomizer, private val context: BuildContext) {
|
||||
private companion object {
|
||||
const val LC_UUID = 0x1b
|
||||
}
|
||||
@@ -47,8 +48,10 @@ internal class MachOUuid(private val executable: Path, private val newUuid: UUID
|
||||
buffer.flip()
|
||||
val msb = buffer.getLong()
|
||||
val lsb = buffer.getLong()
|
||||
context.messages.info("current UUID of $executable: ${UUID(msb, lsb)}")
|
||||
val currentUuid = UUID(msb, lsb)
|
||||
context.messages.info("current UUID of $executable: $currentUuid")
|
||||
buffer.clear()
|
||||
val newUuid = customizer.getDistributionUUID(context, currentUuid)
|
||||
buffer.putLong(newUuid.mostSignificantBits)
|
||||
buffer.putLong(newUuid.leastSignificantBits)
|
||||
buffer.flip()
|
||||
|
||||
Reference in New Issue
Block a user