Skip to content

Instantly share code, notes, and snippets.

@arebee
Last active February 3, 2025 04:07
Show Gist options
  • Save arebee/72df0f0b168412f117feec9e1acd69b5 to your computer and use it in GitHub Desktop.
Save arebee/72df0f0b168412f117feec9e1acd69b5 to your computer and use it in GitHub Desktop.
Helper PowerShell script to build imessage-exporter on Windows
#
# Execute from the root of the repo.
#
$cargo_toml = Get-Content -Path ./imessage-exporter/Cargo.toml
$cargo_toml = $cargo_toml.Replace('version = "0.0.0"', "version = `"$version`"")
Out-File -FilePath ./imessage-exporter/Cargo.toml -InputObject $cargo_toml
$cargo_toml = Get-Content -Path ./imessage-database/Cargo.toml
$cargo_toml = $cargo_toml.Replace('version = "0.0.0"', "version = `"$version`"")
Out-File -FilePath ./imessage-database/Cargo.toml -InputObject $cargo_toml
# Build targetting your version of Windows
switch ($env:PROCESSOR_ARCHITECTURE) {
'AMD64' {
Write-Verbose "AMD64 Build"
cargo build --target x86_64-pc-windows-msvc --release
}
'ARM64' {
Write-Verbose "ARM64 Build"
cargo build --target aarch64-pc-windows-msvc --release
}
'IA64' {
Write-Verbose "IA64 Build"
cargo build --target i686-pc-windows-msvc --release
}
Default {}
}
#Restore the version
$cargo_toml = Get-Content -Path ./imessage-exporter/Cargo.toml
$cargo_toml = $cargo_toml.Replace("version = `"$version`"", 'version = "0.0.0"')
Out-File -FilePath ./imessage-exporter/Cargo.toml -InputObject $cargo_toml
$cargo_toml = Get-Content -Path ./imessage-database/Cargo.toml
$cargo_toml = $cargo_toml.Replace("version = `"$version`"", 'version = "0.0.0"')
Out-File -FilePath ./imessage-database/Cargo.toml -InputObject $cargo_toml
# Validate that the build succeeded and that the version is what you expect/
./target/x86_64-pc-windows-msvc/release/imessage-exporter.exe -V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment