[build scripts] restoring macOS signature after patching UUID in local update mode

(cherry picked from commit ddd7c20ea56e3c71056a90afae516bc0a2d0638f)

IJ-CR-151551

GitOrigin-RevId: fec860a79cc4490e70601ed9bf18f629601ec80a
This commit is contained in:
Roman Shevchenko
2024-12-13 21:02:19 +01:00
committed by intellij-monorepo-bot
parent 7ed345c4ba
commit c3a30e655c

View File

@@ -1,7 +1,9 @@
// 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.macOS
import kotlinx.coroutines.runBlocking
import org.jetbrains.intellij.build.BuildContext
import org.jetbrains.intellij.build.io.runProcess
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.nio.file.Files
@@ -49,12 +51,10 @@ internal class MachOUuid(private val executable: Path, private val newUuid: UUID
buffer.putLong(newUuid.mostSignificantBits)
buffer.putLong(newUuid.leastSignificantBits)
buffer.flip()
if (!context.options.isInDevelopmentMode) {
channel.position(channel.position() - 16)
channel.write(buffer)
context.messages.info("new UUID of $executable: $newUuid")
}
return
channel.position(channel.position() - 16)
channel.write(buffer)
context.messages.info("new UUID of $executable: $newUuid")
return@use
}
else {
channel.position(channel.position() + cmdSize - 8)
@@ -62,5 +62,11 @@ internal class MachOUuid(private val executable: Path, private val newUuid: UUID
}
context.messages.error("LC_UUID not found in $executable")
}
if (context.options.isInDevelopmentMode) {
runBlocking {
runProcess(listOf("codesign", "-s", "-", "--force", executable.toString()))
}
}
}
}
}