Skip to content

Commit 41bdf71

Browse files
Stage launcher under its public filename
1 parent 1d2e6b5 commit 41bdf71

8 files changed

Lines changed: 32 additions & 13 deletions

‎scripts/prepare-launcher.mjs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,16 @@ if (profile === "release") {
9999
run("cargo", cargoArguments, { stdio: "inherit" });
100100

101101
const metadata = JSON.parse(run("cargo", ["metadata", "--format-version", "1", "--no-deps"]));
102-
const executableName = `procnote-launcher${target.executableSuffix}`;
103-
const builtLauncher = join(metadata.target_directory, target.triple, profile, executableName);
102+
const cargoExecutableName = `procnote-launcher${target.executableSuffix}`;
103+
const builtLauncher = join(metadata.target_directory, target.triple, profile, cargoExecutableName);
104104
if (!existsSync(builtLauncher)) {
105105
throw new Error(`Cargo did not produce the launcher at ${builtLauncher}`);
106106
}
107107

108108
rmSync(stagedDirectory, { recursive: true, force: true });
109109
mkdirSync(stagedDirectory, { recursive: true });
110-
const stagedLauncher = join(stagedDirectory, executableName);
110+
const stagedExecutableName = `procnote${target.executableSuffix}`;
111+
const stagedLauncher = join(stagedDirectory, stagedExecutableName);
111112
copyFileSync(builtLauncher, stagedLauncher);
112113
if (target.executableSuffix.length === 0) {
113114
chmodSync(stagedLauncher, 0o755);

‎scripts/validate-linux-package.sh‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ "$#" -ne 1 ]; then
77
fi
88

99
deb=$1
10-
source_launcher=src-tauri/launchers/bin/procnote-launcher
10+
source_launcher=src-tauri/launchers/bin/procnote
1111
extract_dir=$(mktemp -d)
1212
trap 'rm -rf "$extract_dir"' EXIT HUP INT TERM
1313

@@ -53,6 +53,11 @@ if ldd "$launcher" | grep -F 'libwebkit' >/dev/null || ldd "$launcher" | grep -F
5353
exit 1
5454
fi
5555

56+
if [ -n "$(find "$extract_dir" -type f -name 'procnote-launcher' -print -quit)" ]; then
57+
printf 'internal launcher filename is still packaged in the Debian package\n' >&2
58+
exit 1
59+
fi
60+
5661
desktop_file=$(find "$extract_dir/usr/share/applications" -type f -name '*.desktop' -print -quit)
5762
if [ -z "$desktop_file" ] || ! grep -F 'Exec=procnote-gui' "$desktop_file" >/dev/null; then
5863
printf 'desktop entry does not launch procnote-gui\n' >&2

‎scripts/validate-macos-package.sh‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ case $expected_arch in
1515
exit 2
1616
;;
1717
esac
18-
source_launcher=src-tauri/launchers/bin/procnote-launcher
18+
source_launcher=src-tauri/launchers/bin/procnote
1919
mount_dir=$(mktemp -d)
2020
attached=false
2121

@@ -78,5 +78,9 @@ if [ -e "$app/Contents/Resources/cli/procnote" ] || [ -e "$app/Contents/Resource
7878
printf 'legacy CLI executable is still packaged in the DMG\n' >&2
7979
exit 1
8080
fi
81+
if [ -n "$(find "$app" -type f -name 'procnote-launcher' -print -quit)" ]; then
82+
printf 'internal launcher filename is still packaged in the DMG\n' >&2
83+
exit 1
84+
fi
8185

8286
printf 'Validated macOS package: %s\n' "$dmg"

‎scripts/validate-windows-package.ps1‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ if ($LASTEXITCODE -ne 0) {
212212
$gui = Join-Path $extractDir "procnote.exe"
213213
$launcher = Join-Path $extractDir "bin\procnote.exe"
214214
$pathUpdater = Join-Path $extractDir "installer\update-user-path.ps1"
215-
$sourceLauncher = Join-Path $PWD "src-tauri\launchers\bin\procnote-launcher.exe"
215+
$sourceLauncher = Join-Path $PWD "src-tauri\launchers\bin\procnote.exe"
216216
$sourcePathUpdater = Join-Path $PWD "src-tauri\nsis\update-user-path.ps1"
217217

218218
$metadataJson = & cargo metadata --no-deps --format-version 1 | Out-String
@@ -245,6 +245,9 @@ if (Test-Path (Join-Path $extractDir "cli")) {
245245
if (Get-ChildItem $extractDir -Recurse -Filter "procnote.cmd" -File) {
246246
throw "Obsolete command-script launcher is still packaged"
247247
}
248+
if (Get-ChildItem $extractDir -Recurse -Filter "procnote-launcher.exe" -File) {
249+
throw "NSIS still contains the internal launcher filename"
250+
}
248251
if ((Get-FileHash $sourceLauncher).Hash -ne (Get-FileHash $launcher).Hash) {
249252
throw "Packaged launcher differs from its freshly built source file"
250253
}
@@ -276,6 +279,9 @@ if ($msiLauncherMatches.Count -ne 1) {
276279
if (Get-ChildItem $msiExtractDir -Recurse -Filter "procnote.cmd" -File) {
277280
throw "MSI still contains the obsolete command-script launcher"
278281
}
282+
if (Get-ChildItem $msiExtractDir -Recurse -Filter "procnote-launcher.exe" -File) {
283+
throw "MSI still contains the internal launcher filename"
284+
}
279285
if ($msiPathUpdaterMatches.Count -ne 1 -or
280286
-not $msiPathUpdaterMatches[0].FullName.EndsWith("\installer\update-user-path.ps1", [System.StringComparison]::OrdinalIgnoreCase)) {
281287
throw "MSI does not contain the packaged PATH updater under its installer directory"

‎src-tauri/launchers/README.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ The launcher resolves symlinks and locates the GUI from the package layout:
2020
- Linux packages name the GUI `procnote-gui` and install the launcher as
2121
`/usr/bin/procnote`.
2222

23-
`scripts/prepare-launcher.mjs` builds the launcher for Tauri's target and stages
24-
it under the ignored `src-tauri/launchers/bin/` directory before Tauri compiles
25-
and bundles the app. `scripts/tauri.mjs` injects the matching
23+
`scripts/prepare-launcher.mjs` builds the launcher for Tauri's target and copies
24+
Cargo's `procnote-launcher[.exe]` artifact into the ignored
25+
`src-tauri/launchers/bin/` directory as the public `procnote[.exe]` filename.
26+
Bundle mappings preserve that basename instead of requesting a rename because
27+
the Tauri WiX bundler preserves a resource's source filename. `scripts/tauri.mjs`
28+
injects the matching
2629
`tauri.bundle.*.conf.json` extension for desktop builds, which places the staged
2730
binary at the paths above. Keeping generated-resource paths out of Tauri's
2831
automatically loaded platform configuration allows direct `cargo check` and

‎src-tauri/tauri.bundle.linux.conf.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"linux": {
44
"deb": {
55
"files": {
6-
"/usr/bin/procnote": "launchers/bin/procnote-launcher"
6+
"/usr/bin/procnote": "launchers/bin/procnote"
77
}
88
},
99
"rpm": {
1010
"files": {
11-
"/usr/bin/procnote": "launchers/bin/procnote-launcher"
11+
"/usr/bin/procnote": "launchers/bin/procnote"
1212
}
1313
}
1414
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"bundle": {
33
"resources": {
4-
"launchers/bin/procnote-launcher": "bin/procnote"
4+
"launchers/bin/procnote": "bin/procnote"
55
}
66
}
77
}

‎src-tauri/tauri.bundle.windows.conf.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"bundle": {
33
"resources": {
4-
"launchers/bin/procnote-launcher.exe": "bin/procnote.exe",
4+
"launchers/bin/procnote.exe": "bin/procnote.exe",
55
"nsis/update-user-path.ps1": "installer/update-user-path.ps1"
66
}
77
}

0 commit comments

Comments
 (0)