Skip to content

Commit 39c7039

Browse files
Fix multi-pwsh release naming and Windows metadata (#16)
## Summary - rename release artifacts from `pwsh-multi-*` to `multi-pwsh-*` - add Windows version resource metadata for `multi-pwsh.exe` and `pwsh-host.exe` - set company/copyright metadata to Devolutions Inc (2021-2026) - silence non-Windows dead code warnings in named pipe command handling ## Validation - `PwshExePath="$HOME/.pwsh/bin/pwsh-7.4" cargo check -p multi-pwsh -p pwsh-host-cli`
1 parent 60714fd commit 39c7039

7 files changed

Lines changed: 138 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,47 @@ jobs:
2424
target: x86_64-unknown-linux-gnu
2525
host_archive: pwsh-host-linux-x64.zip
2626
host_binary: pwsh-host
27-
multi_archive: pwsh-multi-linux-x64.zip
27+
multi_archive: multi-pwsh-linux-x64.zip
2828
multi_binary: multi-pwsh
2929

3030
- name: linux-arm64
3131
os: ubuntu-latest
3232
target: aarch64-unknown-linux-gnu
3333
host_archive: pwsh-host-linux-arm64.zip
3434
host_binary: pwsh-host
35-
multi_archive: pwsh-multi-linux-arm64.zip
35+
multi_archive: multi-pwsh-linux-arm64.zip
3636
multi_binary: multi-pwsh
3737

3838
- name: windows-x64
3939
os: windows-latest
4040
target: x86_64-pc-windows-msvc
4141
host_archive: pwsh-host-windows-x64.zip
4242
host_binary: pwsh-host.exe
43-
multi_archive: pwsh-multi-windows-x64.zip
43+
multi_archive: multi-pwsh-windows-x64.zip
4444
multi_binary: multi-pwsh.exe
4545

4646
- name: windows-arm64
4747
os: windows-latest
4848
target: aarch64-pc-windows-msvc
4949
host_archive: pwsh-host-windows-arm64.zip
5050
host_binary: pwsh-host.exe
51-
multi_archive: pwsh-multi-windows-arm64.zip
51+
multi_archive: multi-pwsh-windows-arm64.zip
5252
multi_binary: multi-pwsh.exe
5353

5454
- name: macos-x64
5555
os: macos-14
5656
target: x86_64-apple-darwin
5757
host_archive: pwsh-host-macos-x64.zip
5858
host_binary: pwsh-host
59-
multi_archive: pwsh-multi-macos-x64.zip
59+
multi_archive: multi-pwsh-macos-x64.zip
6060
multi_binary: multi-pwsh
6161

6262
- name: macos-arm64
6363
os: macos-14
6464
target: aarch64-apple-darwin
6565
host_archive: pwsh-host-macos-arm64.zip
6666
host_binary: pwsh-host
67-
multi_archive: pwsh-multi-macos-arm64.zip
67+
multi_archive: multi-pwsh-macos-arm64.zip
6868
multi_binary: multi-pwsh
6969

7070
steps:
@@ -163,7 +163,7 @@ jobs:
163163
path: ${{ matrix.host_archive }}
164164
if-no-files-found: error
165165

166-
- name: Upload pwsh-multi artifact
166+
- name: Upload multi-pwsh artifact
167167
uses: actions/upload-artifact@v4
168168
with:
169169
name: ${{ matrix.multi_archive }}
@@ -196,7 +196,7 @@ jobs:
196196
working-directory: dist
197197
run: |
198198
$zipFiles = Get-ChildItem -Recurse -File |
199-
Where-Object { $_.Name -like 'pwsh-host-*.zip' -or $_.Name -like 'pwsh-multi-*.zip' } |
199+
Where-Object { $_.Name -like 'pwsh-host-*.zip' -or $_.Name -like 'multi-pwsh-*.zip' } |
200200
Sort-Object Name
201201
202202
if (-not $zipFiles) {
@@ -222,7 +222,7 @@ jobs:
222222
RELEASE_TARGET: ${{ github.sha }}
223223
run: |
224224
$zipFiles = Get-ChildItem -Path dist -Recurse -File |
225-
Where-Object { $_.Name -like 'pwsh-host-*.zip' -or $_.Name -like 'pwsh-multi-*.zip' } |
225+
Where-Object { $_.Name -like 'pwsh-host-*.zip' -or $_.Name -like 'multi-pwsh-*.zip' } |
226226
Sort-Object Name |
227227
ForEach-Object { $_.FullName }
228228

Cargo.lock

Lines changed: 74 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/multi-pwsh/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ flate2 = "1.0"
1919
tar = "0.4"
2020
zip = { version = "0.6", default-features = false, features = ["deflate"] }
2121
home = "0.5"
22-
tempfile = "3.12"
22+
tempfile = "3.12"
23+
24+
[build-dependencies]
25+
winresource = "0.1"

crates/multi-pwsh/build.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
fn main() {
2+
println!("cargo:rerun-if-env-changed=CARGO_PKG_VERSION");
3+
4+
if std::env::var_os("CARGO_CFG_WINDOWS").is_none() {
5+
return;
6+
}
7+
8+
let version = std::env::var("CARGO_PKG_VERSION").expect("missing CARGO_PKG_VERSION");
9+
10+
let mut resource = winresource::WindowsResource::new();
11+
resource
12+
.set("FileDescription", "Install and update side-by-side PowerShell versions")
13+
.set("ProductName", "multi-pwsh")
14+
.set("InternalName", "multi-pwsh")
15+
.set("CompanyName", "Devolutions Inc")
16+
.set("LegalCopyright", "Copyright 2021-2026 Devolutions Inc.")
17+
.set("OriginalFilename", "multi-pwsh.exe")
18+
.set("FileVersion", &version)
19+
.set("ProductVersion", &version);
20+
21+
resource.compile().expect("failed to compile Windows resources");
22+
}

crates/pwsh-host-cli/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ path = "src/main.rs"
1212
[dependencies]
1313
pwsh-host = { path = "../pwsh-host" }
1414
base64 = "0.22"
15+
16+
[build-dependencies]
17+
winresource = "0.1"

crates/pwsh-host-cli/build.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
fn main() {
2+
println!("cargo:rerun-if-env-changed=CARGO_PKG_VERSION");
3+
4+
if std::env::var_os("CARGO_CFG_WINDOWS").is_none() {
5+
return;
6+
}
7+
8+
let version = std::env::var("CARGO_PKG_VERSION").expect("missing CARGO_PKG_VERSION");
9+
10+
let mut resource = winresource::WindowsResource::new();
11+
resource
12+
.set("FileDescription", "pwsh-compatible CLI backed by pwsh-host and hostfxr")
13+
.set("ProductName", "pwsh-host")
14+
.set("InternalName", "pwsh-host")
15+
.set("CompanyName", "Devolutions Inc")
16+
.set("LegalCopyright", "Copyright 2021-2026 Devolutions Inc.")
17+
.set("OriginalFilename", "pwsh-host.exe")
18+
.set("FileVersion", &version)
19+
.set("ProductVersion", &version);
20+
21+
resource.compile().expect("failed to compile Windows resources");
22+
}

crates/pwsh-host-cli/src/named_pipe_command.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
use std::error::Error;
22
use std::ffi::{OsStr, OsString};
33
use std::fmt::{Display, Formatter};
4-
use std::time::Duration;
54

65
use base64::{engine::general_purpose::STANDARD as BASE64_STANDARD, Engine as _};
76

87
const NAMED_PIPE_COMMAND_FLAG: &str = "-namedpipecommand";
98
const ENCODED_COMMAND_FLAG: &str = "-EncodedCommand";
10-
const PIPE_CONNECT_TIMEOUT: Duration = Duration::from_secs(3);
9+
#[cfg(windows)]
10+
const PIPE_CONNECT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(3);
11+
#[cfg(windows)]
1112
const MAX_COMMAND_BYTES: usize = 1024 * 1024;
1213

1314
#[derive(Debug)]
@@ -126,7 +127,7 @@ fn read_named_pipe_command(pipe_name: &OsStr) -> Result<String, NamedPipeCommand
126127
use std::fs::OpenOptions;
127128
use std::io::Read;
128129
use std::thread::sleep;
129-
use std::time::Instant;
130+
use std::time::{Duration, Instant};
130131

131132
let pipe_name = pipe_name.to_string_lossy();
132133
if pipe_name.trim().is_empty() {

0 commit comments

Comments
 (0)