
The installer, uninstaller, and the Zed binary files are all signed using Microsoft’s newly launched Trusted Signing service. For demonstration purposes, I have used my own account for the signing process. For more information about Trusted Signing, you can refer to the following links: - [Microsoft Security Blog: Trusted Signing is in Public Preview](https://techcommunity.microsoft.com/blog/microsoft-security-blog/trusted-signing-is-in-public-preview/4103457) - [Overview of Azure Trusted Signing](https://learn.microsoft.com/en-us/azure/trusted-signing/overview) **TODO:** - [x] `InnoSetup` script to setup an installer - [x] Signing process - [x] `Open with Zed` in right click context menu (by using sparse package) - [x] Integrate with `cli` - [x] Implement `cli` (#25412) - [x] Pack `cli.exe` into installer - [x] Implement auto updating (#25734) - [x] Pack autoupdater helper into installer - [x] Implement dock menus - [x] Add `Recent Documents` entries (#26369) - [x] Make `zed.exe` aware of sigle instance (#25412) - [x] Properly handle dock menu events (#26010) - [x] Handle `zed://***` uri **Materials needed:** - [ ] Icons - [ ] App icon for all channels (#9571) - [ ] Associated file icons, at minimum a default icon ([example](https://github.com/microsoft/vscode/tree/main/resources/win32)) - [ ] Logos for installer wizard - [ ] Icons for appx - [x] Code signing - [x] Secrets: AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, ACCOUNT_NAME, CERT_PROFILE_NAME - [x] Other constants: ENDPOINT, Identity Signature (i.e. `CN=Junkui Zhang, O=Junkui Zhang, L=Wuhan, S=Hubei, C=CN`)  https://github.com/user-attachments/assets/4f1092b4-90fc-4a47-a868-8f2f1a5d8ad8 Release Notes: - N/A --------- Co-authored-by: Kate <kate@zed.dev> Co-authored-by: localcc <work@localcc.cc> Co-authored-by: Peter Tripp <peter@zed.dev> Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
83 lines
3.1 KiB
Rust
83 lines
3.1 KiB
Rust
use std::process::Command;
|
|
|
|
fn main() {
|
|
if cfg!(target_os = "macos") {
|
|
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.15.7");
|
|
|
|
// Weakly link ReplayKit to ensure Zed can be used on macOS 10.15+.
|
|
println!("cargo:rustc-link-arg=-Wl,-weak_framework,ReplayKit");
|
|
|
|
// Seems to be required to enable Swift concurrency
|
|
println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
|
|
|
|
// Register exported Objective-C selectors, protocols, etc
|
|
println!("cargo:rustc-link-arg=-Wl,-ObjC");
|
|
|
|
// weak link to support Catalina
|
|
println!("cargo:rustc-link-arg=-Wl,-weak_framework,ScreenCaptureKit");
|
|
}
|
|
|
|
// Populate git sha environment variable if git is available
|
|
println!("cargo:rerun-if-changed=../../.git/logs/HEAD");
|
|
println!(
|
|
"cargo:rustc-env=TARGET={}",
|
|
std::env::var("TARGET").unwrap()
|
|
);
|
|
if let Ok(output) = Command::new("git").args(["rev-parse", "HEAD"]).output() {
|
|
if output.status.success() {
|
|
let git_sha = String::from_utf8_lossy(&output.stdout);
|
|
let git_sha = git_sha.trim();
|
|
|
|
println!("cargo:rustc-env=ZED_COMMIT_SHA={git_sha}");
|
|
|
|
if let Ok(build_profile) = std::env::var("PROFILE") {
|
|
if build_profile == "release" {
|
|
// This is currently the best way to make `cargo build ...`'s build script
|
|
// to print something to stdout without extra verbosity.
|
|
println!(
|
|
"cargo:warning=Info: using '{git_sha}' hash for ZED_COMMIT_SHA env var"
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(target_os = "windows")]
|
|
{
|
|
#[cfg(target_env = "msvc")]
|
|
{
|
|
// todo(windows): This is to avoid stack overflow. Remove it when solved.
|
|
println!("cargo:rustc-link-arg=/stack:{}", 8 * 1024 * 1024);
|
|
}
|
|
|
|
let release_channel = option_env!("RELEASE_CHANNEL").unwrap_or("nightly");
|
|
|
|
let icon = match release_channel {
|
|
"stable" => "resources/windows/app-icon.ico",
|
|
"preview" => "resources/windows/app-icon-preview.ico",
|
|
"nightly" => "resources/windows/app-icon-nightly.ico",
|
|
_ => "resources/windows/app-icon-dev.ico",
|
|
};
|
|
let icon = std::path::Path::new(icon);
|
|
|
|
println!("cargo:rerun-if-env-changed=RELEASE_CHANNEL");
|
|
println!("cargo:rerun-if-changed={}", icon.display());
|
|
|
|
let mut res = winresource::WindowsResource::new();
|
|
|
|
// Depending on the security applied to the computer, winresource might fail
|
|
// fetching the RC path. Therefore, we add a way to explicitly specify the
|
|
// toolkit path, allowing winresource to use a valid RC path.
|
|
if let Some(explicit_rc_toolkit_path) = std::env::var("ZED_RC_TOOLKIT_PATH").ok() {
|
|
res.set_toolkit_path(explicit_rc_toolkit_path.as_str());
|
|
}
|
|
res.set_icon(icon.to_str().unwrap());
|
|
res.set("FileDescription", "Zed");
|
|
res.set("ProductName", "Zed");
|
|
|
|
if let Err(e) = res.compile() {
|
|
eprintln!("{}", e);
|
|
std::process::exit(1);
|
|
}
|
|
}
|
|
}
|