From 9b6b8d44426fc79ee0badeca59d3de8d0cddc957 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Mon, 30 Mar 2026 21:20:13 -0700 Subject: [PATCH] refactor(build): rename core binary to openhuman-core and update workflows - Changed the default binary name from "openhuman" to "openhuman-core" in Cargo.toml and related scripts. - Updated build and test workflows to reference the new binary name, ensuring consistency across the project. - Adjusted paths and executable checks in the codebase to accommodate the renamed binary, improving clarity and maintainability. --- .github/workflows/build.yml | 6 +++--- .github/workflows/release.yml | 17 +++++++++++++---- .github/workflows/test.yml | 6 +++--- Cargo.toml | 6 +++++- app/src-tauri/src/core_process.rs | 22 +++++++++++----------- app/src-tauri/src/lib.rs | 2 +- app/src-tauri/tauri.conf.json | 2 +- scripts/build-macos-signed.sh | 17 +++++++++++++---- scripts/stage-core-sidecar.mjs | 10 +++++----- src/openhuman/service/common.rs | 4 ++-- 10 files changed, 57 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7d133325..3b0f646b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,13 +70,13 @@ jobs: run: yarn install --frozen-lockfile - name: Build sidecar core binary - run: cargo build --manifest-path Cargo.toml --release --target x86_64-unknown-linux-gnu --bin openhuman + run: cargo build --manifest-path Cargo.toml --release --target x86_64-unknown-linux-gnu --bin openhuman-core - name: Stage sidecar for Tauri bundler run: | mkdir -p app/src-tauri/binaries - cp target/x86_64-unknown-linux-gnu/release/openhuman app/src-tauri/binaries/openhuman-x86_64-unknown-linux-gnu - chmod +x app/src-tauri/binaries/openhuman-x86_64-unknown-linux-gnu + cp target/x86_64-unknown-linux-gnu/release/openhuman-core app/src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu + chmod +x app/src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu - name: Build Tauri app working-directory: app diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f78adaced..e21d3bdc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -351,7 +351,7 @@ jobs: exit 1 fi - SIDE_CAR_BASE="$(node -e "const fs=require('fs');const c=JSON.parse(fs.readFileSync('app/src-tauri/tauri.conf.json','utf8'));const b=(c.bundle&&Array.isArray(c.bundle.externalBin)&&c.bundle.externalBin[0])||'binaries/openhuman';process.stdout.write(String(b).split('/').pop());")" + SIDE_CAR_BASE="$(node -e "const fs=require('fs');const c=JSON.parse(fs.readFileSync('app/src-tauri/tauri.conf.json','utf8'));const b=(c.bundle&&Array.isArray(c.bundle.externalBin)&&c.bundle.externalBin[0])||'binaries/openhuman-core';process.stdout.write(String(b).split('/').pop());")" CORE_BIN_NAME="${SIDE_CAR_BASE}" echo "core_dir=$CORE_DIR" >> "$GITHUB_OUTPUT" @@ -522,13 +522,22 @@ jobs: rm -f "$CERT_FILE" echo "Signing identity imported into $KEYCHAIN" - echo "=== Re-signing binaries inside the .app with hardened runtime ===" + echo "=== Fixing executable name and signing ===" + + # Tauri/Cargo may produce the binary as lowercase "openhuman" but + # Info.plist sets CFBundleExecutable to "OpenHuman". codesign + # verification fails when these don't match. Rename to match plist. + EXPECTED_EXE="$(defaults read "$APP_PATH/Contents/Info.plist" CFBundleExecutable 2>/dev/null || echo "OpenHuman")" + ACTUAL_EXE="$(ls "$APP_PATH/Contents/MacOS/" | head -1)" - # The .app contains only the main Tauri binary (openhuman) — no - # separate sidecar. Just sign the whole bundle with hardened runtime. echo "Bundle contents:" ls -la "$APP_PATH/Contents/MacOS/" + if [ "$ACTUAL_EXE" != "$EXPECTED_EXE" ]; then + echo "Fixing executable name: $ACTUAL_EXE -> $EXPECTED_EXE" + mv "$APP_PATH/Contents/MacOS/$ACTUAL_EXE" "$APP_PATH/Contents/MacOS/$EXPECTED_EXE" + fi + echo "Signing .app bundle with hardened runtime..." codesign --force --options runtime \ --entitlements "$ENTITLEMENTS" \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da7001aaa..81404a710 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -102,13 +102,13 @@ jobs: run: cargo test -p openhuman - name: Build sidecar core binary - run: cargo build --manifest-path Cargo.toml --release --target x86_64-unknown-linux-gnu --bin openhuman + run: cargo build --manifest-path Cargo.toml --release --target x86_64-unknown-linux-gnu --bin openhuman-core - name: Stage sidecar for Tauri shell tests run: | mkdir -p app/src-tauri/binaries - cp target/x86_64-unknown-linux-gnu/release/openhuman app/src-tauri/binaries/openhuman-x86_64-unknown-linux-gnu - chmod +x app/src-tauri/binaries/openhuman-x86_64-unknown-linux-gnu + cp target/x86_64-unknown-linux-gnu/release/openhuman-core app/src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu + chmod +x app/src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu - name: Test Tauri shell (OpenHuman) run: cargo test --manifest-path app/src-tauri/Cargo.toml diff --git a/Cargo.toml b/Cargo.toml index 841b7deda..cc81b3a32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,11 @@ name = "openhuman" version = "0.49.17" edition = "2021" description = "OpenHuman core business logic and RPC server" -autobins = true +autobins = false + +[[bin]] +name = "openhuman-core" +path = "src/main.rs" [lib] name = "openhuman_core" diff --git a/app/src-tauri/src/core_process.rs b/app/src-tauri/src/core_process.rs index 5f0e71e21..6a1fd1204 100644 --- a/app/src-tauri/src/core_process.rs +++ b/app/src-tauri/src/core_process.rs @@ -258,9 +258,9 @@ pub fn default_core_bin() -> Option { continue; }; #[cfg(windows)] - let matches = file_name.starts_with("openhuman-") && file_name.ends_with(".exe"); + let matches = file_name.starts_with("openhuman-core-") && file_name.ends_with(".exe"); #[cfg(not(windows))] - let matches = file_name.starts_with("openhuman-"); + let matches = file_name.starts_with("openhuman-core-"); if matches { return Some(path); } @@ -274,25 +274,25 @@ pub fn default_core_bin() -> Option { let exe_dir = exe.parent()?; #[cfg(windows)] - let standalone = exe_dir.join("openhuman.exe"); + let standalone = exe_dir.join("openhuman-core.exe"); #[cfg(not(windows))] - let standalone = exe_dir.join("openhuman"); + let standalone = exe_dir.join("openhuman-core"); if standalone.exists() && !same_executable_path(&standalone, &exe) { return Some(standalone); } #[cfg(windows)] - let legacy_standalone = exe_dir.join("openhuman.exe"); + let legacy_standalone = exe_dir.join("openhuman-core.exe"); #[cfg(not(windows))] - let legacy_standalone = exe_dir.join("openhuman"); + let legacy_standalone = exe_dir.join("openhuman-core"); if legacy_standalone.exists() && !same_executable_path(&legacy_standalone, &exe) { return Some(legacy_standalone); } - // Sidecar layout: bundle.externalBin("binaries/openhuman") is emitted as - // openhuman-(.exe) under app resources. + // Sidecar layout: bundle.externalBin("binaries/openhuman-core") is emitted as + // openhuman-core-(.exe) under app resources. let search_dirs = { let mut dirs = vec![exe_dir.to_path_buf()]; #[cfg(target_os = "macos")] @@ -318,11 +318,11 @@ pub fn default_core_bin() -> Option { }; #[cfg(windows)] - let matches = (file_name.starts_with("openhuman-") && file_name.ends_with(".exe")) - || (file_name.starts_with("openhuman-") && file_name.ends_with(".exe")); + let matches = (file_name.starts_with("openhuman-core-") && file_name.ends_with(".exe")) + || (file_name.starts_with("openhuman-core-") && file_name.ends_with(".exe")); #[cfg(not(windows))] let matches = - file_name.starts_with("openhuman-") || file_name.starts_with("openhuman-"); + file_name.starts_with("openhuman-core-") || file_name.starts_with("openhuman-core-"); if matches && !same_executable_path(&path, &exe) { return Some(path); diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rs index 96837113a..18d230ebc 100644 --- a/app/src-tauri/src/lib.rs +++ b/app/src-tauri/src/lib.rs @@ -98,7 +98,7 @@ pub fn run() { pub fn run_core_from_args(args: &[String]) -> Result<(), String> { let core_bin = crate::core_process::default_core_bin() - .ok_or_else(|| "openhuman core binary not found".to_string())?; + .ok_or_else(|| "openhuman-core binary not found".to_string())?; let status = std::process::Command::new(core_bin) .args(args) .status() diff --git a/app/src-tauri/tauri.conf.json b/app/src-tauri/tauri.conf.json index be475e65f..787bdfdf5 100644 --- a/app/src-tauri/tauri.conf.json +++ b/app/src-tauri/tauri.conf.json @@ -48,7 +48,7 @@ "../../src/openhuman/agent/prompts" ], "externalBin": [ - "binaries/openhuman" + "binaries/openhuman-core" ], "createUpdaterArtifacts": false, "macOS": { diff --git a/scripts/build-macos-signed.sh b/scripts/build-macos-signed.sh index 5f8b3834c..f0aa0b04a 100755 --- a/scripts/build-macos-signed.sh +++ b/scripts/build-macos-signed.sh @@ -155,16 +155,25 @@ fi echo echo "App bundle: $APP_PATH" -# ── Sign the .app bundle with hardened runtime ─────────────────────── -# The .app contains only the main Tauri binary (openhuman) — no separate -# sidecar binary. We just need to sign the whole bundle with hardened -# runtime + entitlements for notarization. +# ── Fix CFBundleExecutable case mismatch ────────────────────────────── +# Tauri/Cargo produces the binary as lowercase "openhuman" but Info.plist +# sets CFBundleExecutable to "OpenHuman". codesign verification fails +# when these don't match exactly. Rename to match the plist. ENTITLEMENTS="app/src-tauri/entitlements.sidecar.plist" +EXPECTED_EXE="$(defaults read "$APP_PATH/Contents/Info.plist" CFBundleExecutable 2>/dev/null || echo "OpenHuman")" +ACTUAL_EXE="$(ls "$APP_PATH/Contents/MacOS/" | head -1)" echo echo "Bundle contents:" ls -la "$APP_PATH/Contents/MacOS/" +if [[ "$ACTUAL_EXE" != "$EXPECTED_EXE" ]]; then + echo + echo "Fixing executable name: $ACTUAL_EXE -> $EXPECTED_EXE" + mv "$APP_PATH/Contents/MacOS/$ACTUAL_EXE" "$APP_PATH/Contents/MacOS/$EXPECTED_EXE" +fi + +# ── Sign the .app bundle with hardened runtime ─────────────────────── echo echo "Signing .app bundle with hardened runtime..." codesign --force --options runtime \ diff --git a/scripts/stage-core-sidecar.mjs b/scripts/stage-core-sidecar.mjs index b7c044b69..e39cafb8a 100644 --- a/scripts/stage-core-sidecar.mjs +++ b/scripts/stage-core-sidecar.mjs @@ -34,12 +34,12 @@ function rustHostTriple() { const triple = rustHostTriple(); const isWindows = process.platform === "win32"; -const binName = isWindows ? "openhuman.exe" : "openhuman"; +const binName = isWindows ? "openhuman-core.exe" : "openhuman-core"; console.log( - `[core:stage] Building openhuman standalone binary for ${triple}...`, + `[core:stage] Building openhuman-core standalone binary for ${triple}...`, ); -run("cargo", ["build", "--manifest-path", "Cargo.toml", "--bin", "openhuman"]); +run("cargo", ["build", "--manifest-path", "Cargo.toml", "--bin", "openhuman-core"]); const targetDir = process.env.CARGO_TARGET_DIR ? resolve(process.env.CARGO_TARGET_DIR) @@ -53,8 +53,8 @@ if (!existsSync(source)) { const outputDir = join(root, "app", "src-tauri", "binaries"); mkdirSync(outputDir, { recursive: true }); const sidecarName = isWindows - ? `openhuman-${triple}.exe` - : `openhuman-${triple}`; + ? `openhuman-core-${triple}.exe` + : `openhuman-core-${triple}`; const dest = join(outputDir, sidecarName); copyFileSync(source, dest); if (!isWindows) { diff --git a/src/openhuman/service/common.rs b/src/openhuman/service/common.rs index 2dc8bf6a7..5c254bfc7 100644 --- a/src/openhuman/service/common.rs +++ b/src/openhuman/service/common.rs @@ -49,9 +49,9 @@ pub(crate) fn resolve_daemon_executable() -> Result { #[cfg(windows)] let matches = - name.starts_with("openhuman-") || name.eq_ignore_ascii_case("openhuman.exe"); + name.starts_with("openhuman-core-") || name.eq_ignore_ascii_case("openhuman-core.exe"); #[cfg(not(windows))] - let matches = name.starts_with("openhuman-") || name == "openhuman"; + let matches = name.starts_with("openhuman-core-") || name == "openhuman-core"; if matches { return Ok(path);