From 5bd76609f7f3116b2804f1be24320d11bc45e151 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Wed, 31 Jul 2024 21:15:13 -0700 Subject: feat: codesign for deno compile binaries (#24604) Uses [sui](https://github.com/littledivy/sui) to inject metadata as a custom section in the denort binary. Metadata is stored as a Mach-O segment on macOS and PE `RT_RCDATA` resource on Windows. Fixes #11154 Fixes https://github.com/denoland/deno/issues/17753 ```cpp deno compile app.tsx # on macOS codesign --sign - ./app # on Windows signtool sign /fd SHA256 .\app.exe ``` --------- Signed-off-by: Divy Srivastava --- cli/tools/compile.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cli/tools') diff --git a/cli/tools/compile.rs b/cli/tools/compile.rs index bb03f03d2..f0534abc3 100644 --- a/cli/tools/compile.rs +++ b/cli/tools/compile.rs @@ -124,12 +124,13 @@ pub async fn compile( )); let temp_path = output_path.with_file_name(temp_filename); - let mut file = std::fs::File::create(&temp_path).with_context(|| { + let file = std::fs::File::create(&temp_path).with_context(|| { format!("Opening temporary file '{}'", temp_path.display()) })?; + let write_result = binary_writer .write_bin( - &mut file, + file, eszip, root_dir_url, &module_specifier, @@ -140,7 +141,6 @@ pub async fn compile( .with_context(|| { format!("Writing temporary file '{}'", temp_path.display()) }); - drop(file); // set it as executable #[cfg(unix)] -- cgit v1.2.3