From c3a30e655cab1e362b138c5c8cd6c2dee9c6567a Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 13 Dec 2024 21:02:19 +0100 Subject: [PATCH] [build scripts] restoring macOS signature after patching UUID in local update mode (cherry picked from commit ddd7c20ea56e3c71056a90afae516bc0a2d0638f) IJ-CR-151551 GitOrigin-RevId: fec860a79cc4490e70601ed9bf18f629601ec80a --- .../intellij/build/impl/macOS/MachOUuid.kt | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/macOS/MachOUuid.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/macOS/MachOUuid.kt index 59d301fa04bd..75eb486c1e69 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/macOS/MachOUuid.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/macOS/MachOUuid.kt @@ -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())) + } + } } -} \ No newline at end of file +}