fix windows installer (#8)

This commit is contained in:
Sampo Kivistö 2026-03-11 20:16:20 +02:00 • committed by GitHub
parent dba350659b
commit 0ed109eb39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 181 additions and 11 deletions

View file

@ -122,7 +122,7 @@ jobs:
- name: Build release binary
shell: pwsh
run: |
cargo build -p gitcomet-app --release --locked --features ui-gpui,gix
cargo build -p gitcomet-app --release --locked --features ui-gpui,gix --bins
- name: Package portable ZIP
shell: pwsh
@ -144,7 +144,7 @@ jobs:
$ErrorActionPreference = "Stop"
choco install wixtoolset --version "${env:WIXTOOLSET_VERSION}" --yes --no-progress
cargo install cargo-wix --version "${env:CARGO_WIX_VERSION}" --locked
if (!(Test-Path "wix\main.wxs")) {
if (!(Test-Path "crates\gitcomet-app\wix\main.wxs")) {
cargo wix init --package gitcomet-app
}
$msiName = "gitcomet-v${env:VERSION}-windows-x86_64.msi"

1
.gitignore vendored
View file

@ -12,3 +12,4 @@ local_*.sh
tmp/*
feat/*
.autoresearch/*
dist/

View file

@ -0,0 +1,33 @@
#![cfg_attr(target_os = "windows", windows_subsystem = "windows")]
#[cfg(target_os = "windows")]
fn main() {
use std::env;
use std::os::windows::process::CommandExt;
use std::process::Command;
// Prevent the console-subsystem app from creating a visible terminal window
// when launched from Start Menu shortcuts.
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
let Ok(current_exe) = env::current_exe() else {
return;
};
let Some(install_dir) = current_exe.parent() else {
return;
};
let app_exe = install_dir.join("gitcomet-app.exe");
let mut cmd = Command::new(app_exe);
cmd.current_dir(install_dir);
cmd.creation_flags(CREATE_NO_WINDOW);
cmd.args(env::args_os().skip(1));
let _ = cmd.spawn();
}
#[cfg(not(target_os = "windows"))]
fn main() {
eprintln!("gitcomet-launcher is only supported on Windows");
std::process::exit(1);
}

View file

@ -0,0 +1,144 @@
<?xml version='1.0' encoding='windows-1252'?>
<?if $(sys.BUILDARCH) = x64 or $(sys.BUILDARCH) = arm64 ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Id='*'
Name='GitComet'
UpgradeCode='{3A9166E5-EB30-45B6-8128-C19FEA3A26DF}'
Manufacturer='AutoExplore Oy'
Language='1033'
Codepage='1252'
Version='$(var.Version)'>
<Package
Id='*'
Keywords='Installer'
Description='GitComet desktop application'
Manufacturer='AutoExplore Oy'
InstallerVersion='450'
Languages='1033'
Compressed='yes'
InstallScope='perMachine'
SummaryCodepage='1252'/>
<MajorUpgrade
Schedule='afterInstallInitialize'
DowngradeErrorMessage='A newer version of [ProductName] is already installed. Setup will now exit.'/>
<Media Id='1' Cabinet='media1.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1'/>
<Property Id='DiskPrompt' Value='GitComet Installation'/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='$(var.PlatformProgramFilesFolder)' Name='PFiles'>
<Directory Id='APPLICATIONFOLDER' Name='GitComet'>
<Component Id='License' Guid='*'>
<File
Id='LicenseFile'
Name='LICENSE-AGPL-3.0'
DiskId='1'
Source='LICENSE-AGPL-3.0'
KeyPath='yes'/>
</Component>
<Directory Id='Bin' Name='bin'>
<Component Id='Path' Guid='{206A9CFD-BF69-4386-851B-D88EECA93314}' KeyPath='yes'>
<Environment
Id='PATH'
Name='PATH'
Value='[Bin]'
Permanent='no'
Part='last'
Action='set'
System='yes'/>
</Component>
<Component Id='MainBinary' Guid='*'>
<File
Id='MainExeFile'
Name='gitcomet-app.exe'
DiskId='1'
Source='$(var.CargoTargetBinDir)\gitcomet-app.exe'
KeyPath='yes'/>
</Component>
<Component Id='LauncherBinary' Guid='*'>
<File
Id='LauncherExeFile'
Name='GitComet.exe'
DiskId='1'
Source='$(var.CargoTargetBinDir)\gitcomet-launcher.exe'
KeyPath='yes'/>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id='ProgramMenuFolder'>
<Directory Id='GitCometProgramMenuDir' Name='GitComet'>
<Component Id='StartMenuShortcut' Guid='*'>
<Shortcut
Id='GitCometStartMenuShortcut'
Directory='GitCometProgramMenuDir'
Name='GitComet'
Description='Git GUI built with GPUI'
Target='[Bin]GitComet.exe'
WorkingDirectory='APPLICATIONFOLDER'
Icon='ProductICO'
IconIndex='0'
Advertise='no'/>
<RemoveFolder Id='RemoveGitCometProgramMenuDir' Directory='GitCometProgramMenuDir' On='uninstall'/>
<RegistryValue
Root='HKCU'
Key='Software\AutoExplore\GitComet'
Name='StartMenuShortcut'
Type='integer'
Value='1'
KeyPath='yes'/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature
Id='Binaries'
Title='Application'
Description='Installs all binaries and the license.'
Level='1'
ConfigurableDirectory='APPLICATIONFOLDER'
AllowAdvertise='no'
Display='expand'
Absent='disallow'>
<ComponentRef Id='License'/>
<ComponentRef Id='MainBinary'/>
<ComponentRef Id='LauncherBinary'/>
<ComponentRef Id='StartMenuShortcut'/>
<Feature
Id='Environment'
Title='PATH Environment Variable'
Description='Add the install location of the [ProductName] executable to the PATH system environment variable.'
Level='1'
Absent='allow'>
<ComponentRef Id='Path'/>
</Feature>
</Feature>
<SetProperty Id='ARPINSTALLLOCATION' Value='[APPLICATIONFOLDER]' After='CostFinalize'/>
<Icon Id='ProductICO' SourceFile='assets\\gitcomet.ico'/>
<Property Id='ARPPRODUCTICON' Value='ProductICO'/>
<Property Id='ARPHELPLINK' Value='https://github.com/Auto-Explore/GitComet'/>
<UI>
<UIRef Id='WixUI_FeatureTree'/>
<Publish Dialog='WelcomeDlg' Control='Next' Event='NewDialog' Value='CustomizeDlg' Order='99'>1</Publish>
<Publish Dialog='CustomizeDlg' Control='Back' Event='NewDialog' Value='WelcomeDlg' Order='99'>1</Publish>
</UI>
</Product>
</Wix>

View file

@ -1,9 +0,0 @@
[Desktop Entry]
Type=Application
Name=GitComet
Comment=GitComet - Git UI
Exec=gitcomet-app
Icon=gitcomet
StartupWMClass=gitcomet
Terminal=false
Categories=Development;RevisionControl;

View file

@ -0,0 +1 @@
cargo wix crates\gitcomet-app\Cargo.toml -p gitcomet-app --profile release --nocapture --output dist\gitcomet-local-test.msi