Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
build: release only the GPUI app
Cursor Agentf22ff3212f12
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex b6b2f9f0e..258bee48b 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -52,7 +52,9 @@ jobs:- 'scripts/finalize-linux-*'- 'scripts/linux-bundle-config*'- 'scripts/prepare-gpui-dependency*'+ - 'scripts/run-gpui-build*'- 'scripts/sync-desktop-versions.mjs'+ - 'scripts/verify-gpui-release-inputs.mjs'- 'Cargo.toml'- 'Cargo.lock'- 'bun.lock'diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex 46802059b..11142a366 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -5,9 +5,8 @@ name: "desktop-release"# - publish-nightly.yml -> channel: nightly, generated prerelease version, auto CN publish# - promote-nightly.yml -> channel: stable, rebuilds a nightly's commit as a plain x.y.z#-# Every release carries two apps from one commit: Cap (the GPUI app) under the-# platform names existing installs update from, and Cap Classic (the Tauri-# app) under `-classic` platform names, so neither ever updates into the other.+# Cap ships as the GPUI app only, under the platform names existing installs+# update from, so 0.6.0 and earlier Tauri installs update straight into it.## Stable releases get a cap-v{version} git tag + draft GitHub release and are# published on CrabNebula manually (Discord bot / dashboard), exactly as before.@@ -43,8 +42,6 @@ on:env:CN_APPLICATION: cap/cap- SENTRY_ORG: cap-s2- SENTRY_PROJECT: cap-desktopjobs:draft:@@ -219,11 +216,9 @@ jobs:TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}TURBO_TEAM: ${{ secrets.TURBO_TEAM }}CN_CHANNEL_FLAG: ${{ inputs.channel == 'nightly' && '--channel nightly' || '' }}- # Cap is the GPUI app and keeps the platform names every existing- # install updates from; Cap Classic is the Tauri app, built from the- # same commit and published beside it under `-classic` platforms.+ # Cap ships as the GPUI app only, under the platform names every+ # existing install already updates from.CAP_BUNDLE: apps/desktop-gpui/target/${{ matrix.settings.target }}/release/bundle- CLASSIC_BUNDLE: target/${{ matrix.settings.target }}/release/bundleruns-on: ${{ matrix.settings.runner }}steps:- name: Checkout repository@@ -317,7 +312,6 @@ jobs:{echo "appVersion=${{ inputs.version }}"echo "VITE_ENVIRONMENT=production"- echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568"echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}"echo 'NEXTAUTH_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}'echo 'VITE_OPENPANEL_CLIENT_ID=${{ secrets.VITE_OPENPANEL_CLIENT_ID }}'@@ -334,13 +328,15 @@ jobs:APPLE_SIGNING_IDENTITY: ${{ runner.os == 'macOS' && secrets.APPLE_SIGNING_IDENTITY || '' }}APPLE_KEYCHAIN: ${{ runner.os == 'macOS' && format('{0}/build.keychain', runner.temp) || '' }}+ # The sidecars ship inside Cap, which is itself stripped, and nothing+ # symbolicates them, so their symbol tables are dead weight in every+ # download.- name: Build desktop binariesshell: bash- run: |- if [[ "$RUNNER_OS" == "Linux" ]]; then- export CARGO_PROFILE_RELEASE_DEBUG=0- fi- ./scripts/build-desktop-binaries.sh ${{ matrix.settings.target }}+ env:+ CARGO_PROFILE_RELEASE_DEBUG: "0"+ CARGO_PROFILE_RELEASE_STRIP: symbols+ run: ./scripts/build-desktop-binaries.sh ${{ matrix.settings.target }}# The final link used to peak well above the 16GB stock Linux runner and# get OOM-killed ("runner received a shutdown signal") under fat LTO +@@ -374,40 +370,6 @@ jobs:maximum-size: 24GBdisk-root: "D:"- - name: Build Cap Classic- working-directory: apps/desktop- shell: bash- run: |- case "$RUNNER_OS" in- Linux)- CARGO_PROFILE_RELEASE_DEBUG=0 node ../../scripts/build-linux-packages.mjs "$TARGET" classic --config src-tauri/tauri.prod.conf.json --verbose- ;;- macOS)- node ../../scripts/build-macos-packages.mjs "$TARGET" --config src-tauri/tauri.prod.conf.json- ;;- Windows)- bun run build:tauri --target "$TARGET" --config src-tauri/tauri.prod.conf.json --bundles nsis- ;;- esac- env:- TARGET: ${{ matrix.settings.target }}- # https://github.com/tauri-apps/tauri-action/issues/740- CI: false- LD_LIBRARY_PATH: ${{ runner.os == 'Linux' && format('{0}/target/{1}/release:{0}/target/native-deps/lib', github.workspace, matrix.settings.target) || '' }}- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- # codesigning- APPLE_CERTIFICATE: ${{ runner.os == 'macOS' && secrets.APPLE_CERTIFICATE || '' }}- APPLE_CERTIFICATE_PASSWORD: ${{ runner.os == 'macOS' && secrets.APPLE_CERTIFICATE_PASSWORD || '' }}- APPLE_SIGNING_IDENTITY: ${{ runner.os == 'macOS' && secrets.APPLE_SIGNING_IDENTITY || '' }}- # notarization- APPLE_API_ISSUER: ${{ runner.os == 'macOS' && secrets.APPLE_API_ISSUER || '' }}- APPLE_API_KEY: ${{ runner.os == 'macOS' && secrets.APPLE_API_KEY || '' }}- APPLE_API_KEY_PATH: ${{ runner.os == 'macOS' && format('{0}/api.p8', github.workspace) || '' }}- APPLE_KEYCHAIN: ${{ runner.os == 'macOS' && format('{0}/build.keychain', runner.temp) || '' }}- TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}- TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}- RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}-# The Tauri bundler is only the packager here: it lays the prebuilt GPUI# binary out in the same app bundle, installer and package formats the# Tauri updater already installs, so existing installs update into Cap.@@ -416,7 +378,7 @@ jobs:run: |case "$RUNNER_OS" inLinux)- CARGO_PROFILE_RELEASE_DEBUG=0 node scripts/build-linux-packages.mjs "$TARGET" cap --verbose+ node scripts/build-linux-packages.mjs "$TARGET" --verbose;;macOS)node scripts/bundle-gpui.mjs "$TARGET" --bundles app,dmg@@ -440,9 +402,8 @@ jobs:TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}- # Tauri patches Cap Classic.exe with the NSIS marker during the first- # bundle. Sign those patched bytes and Cap's prebuilt binary in one- # request, then bundle both installers from the signed payload.+ # Sign Cap's prebuilt binary and its sidecars in one request, then bundle+ # the installer from the signed payload.- name: Stage Windows payload for Authenticode signingif: ${{ runner.os == 'Windows' }}shell: pwsh@@ -481,12 +442,10 @@ jobs:run: |./scripts/windows-release-signing.ps1 -Operation Restore -Target "${{ matrix.settings.target }}" -WorkspaceRoot "$env:GITHUB_WORKSPACE"- - name: Bundle Windows installers+ - name: Bundle Windows installerif: ${{ runner.os == 'Windows' }}shell: bash- run: |- (cd apps/desktop && bun run tauri bundle --target "$TARGET" --bundles nsis --config src-tauri/tauri.prod.conf.json)- node scripts/bundle-gpui.mjs "$TARGET" --skip-build --bundles nsis+ run: node scripts/bundle-gpui.mjs "$TARGET" --skip-build --bundles nsisenv:TARGET: ${{ matrix.settings.target }}TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}@@ -551,7 +510,6 @@ jobs:echo "::error::Cap still bundles the duplicate cap-exporter sidecar."exit 1fi- verify_app "$CLASSIC_BUNDLE/macos/Cap Classic.app" "Cap Classic" cap-muxer cap-exporter cap-cli- name: Notarize and verify macOS disk imagesif: ${{ runner.os == 'macOS' }}@@ -564,9 +522,9 @@ jobs:run: |set -euo pipefailshopt -s nullglob- DMGS=("$CAP_BUNDLE"/dmg/*.dmg "$CLASSIC_BUNDLE"/dmg/*.dmg)- if [[ ${#DMGS[@]} -ne 2 ]]; then- echo "::error::Expected the Cap and Cap Classic disk images, found ${#DMGS[@]}."+ DMGS=("$CAP_BUNDLE"/dmg/*.dmg)+ if [[ ${#DMGS[@]} -ne 1 ]]; then+ echo "::error::Expected one Cap disk image, found ${#DMGS[@]}."exit 1fi[[ -n "$APPLE_API_KEY" && -n "$APPLE_API_ISSUER" && -s "$APPLE_API_KEY_PATH" ]]@@ -596,15 +554,11 @@ jobs:done# Guards against the Linux packaging regressions:- # 1. Frontend missing: vinxi must produce apps/desktop/.output/public,- # which Tauri EMBEDS into Cap Classic. A blank webview ships if- # turbo's cache restores an empty .output/public (see- # @cap/desktop#build outputs in turbo.json).- # 2. FFmpeg soname mismatch: every libav*/libsw* a binary lists as+ # 1. FFmpeg soname mismatch: every libav*/libsw* a binary lists as# NEEDED must be bundled under /usr/lib/cap/ with the exact same soname.# The bundled libs come from native-deps (FFmpeg 7); if a binary# linked system FFmpeg 6 the loader fails at launch.- # 3. Undeclared runtime dependency: a system lib a binary NEEDs that is+ # 2. Undeclared runtime dependency: a system lib a binary NEEDs that is# neither bundled nor part of the declared stack must appear in the# .deb Depends, or the loader aborts at launch. This is the# libpipewire-0.3.so.0 crash that shipped in 0.5.2.@@ -647,7 +601,7 @@ jobs:exit 1fi- # (2) every FFmpeg soname the binaries NEED is bundled+ # (1) every FFmpeg soname the binaries NEED is bundledNEEDED="$(for executable in "${EXECUTABLES[@]}"; do objdump -p "$executable"; done | awk '/NEEDED/{print $2}' | grep -E '^lib(av|sw|postproc)' | sort -u || true)"echo "Binaries NEED FFmpeg sonames:"; echo "${NEEDED:-(none)}"echo "Bundled FFmpeg libs:"; ls -1 "$WORK/usr/lib/cap" 2>/dev/null || true@@ -664,7 +618,7 @@ jobs:fiecho "FFmpeg soname bundle OK"- # (3) runtime libs that are NOT bundled must be declared in the .deb+ # (2) runtime libs that are NOT bundled must be declared in the .deb# Depends, or the dynamic loader aborts at launch.DEPENDS="$(dpkg-deb -f "$DEB" Depends || true)"echo "Declared Depends: ${DEPENDS:-(none)}"@@ -714,16 +668,12 @@ jobs:set -euo pipefailRPM="$CAP_BUNDLE/rpm/Cap-$CAP_RELEASE_VERSION-1.x86_64.rpm"APPIMAGE="$CAP_BUNDLE/appimage/Cap_${CAP_RELEASE_VERSION}_amd64.AppImage"- CLASSIC_APPIMAGE="$CLASSIC_BUNDLE/appimage/Cap Classic_${CAP_RELEASE_VERSION}_amd64.AppImage"test -s "$APPIMAGE.sig"- test -s "$CLASSIC_APPIMAGE.sig"WORK="$(mktemp -d)"trap 'rm -rf "$WORK"' EXIT- mkdir "$WORK/rpm" "$WORK/appimage" "$WORK/classic"+ mkdir "$WORK/rpm" "$WORK/appimage"(cd "$WORK/appimage" && "$(realpath "$APPIMAGE")" --appimage-extract > /dev/null)- (cd "$WORK/classic" && "$(realpath "$CLASSIC_APPIMAGE")" --appimage-extract > /dev/null)APPROOT="$WORK/appimage/squashfs-root"- CLASSIC_APPROOT="$WORK/classic/squashfs-root"verify_root() {local root="$1"shift@@ -736,7 +686,6 @@ jobs:test ! -e "$root/usr/bin/cap-gpui"}verify_root "$APPROOT" Cap cap-muxer cap-cli- verify_root "$CLASSIC_APPROOT" "Cap Classic" cap-muxer cap-exporter cap-cliif [[ -n "$(find "$APPROOT" \( -name 'libwebkit2gtk-*' -o -name 'libgtk-3.so*' -o -name 'WebKitWebProcess' \) -print -quit)" || -e "$APPROOT/apprun-hooks" ]]; thenecho "::error::The Cap AppImage still bundles the Tauri webview runtime"exit 1@@ -753,33 +702,17 @@ jobs:test "$(cat "$WORK/rpm/usr/lib/cap/package-format")" = rpmverify_root "$WORK/rpm" Cap cap-muxer cap-clifi- for root in "$APPROOT" "$CLASSIC_APPROOT"; do- test "$(cat "$root/usr/lib/cap/package-format")" = appimage- test -x "$root/usr/bin/pactl"- test -s "$root/usr/lib/alsa-lib/libasound_module_pcm_pulse.so"- test -s "$root/usr/lib/cap/alsa-pulse.conf"- if [[ -n "$(find "$root" -name 'libwayland-client.so*' -print -quit)" ]]; then- echo "::error::$root bundles a Wayland client that can conflict with host Mesa drivers"- exit 1- fi- if [[ -n "$(find "$root/usr/lib" -maxdepth 1 -name 'libpipewire-0.3.so*' -print -quit)" ]]; then- echo "::error::$root bundles PipeWire that can conflict with host ALSA plugins"- exit 1- fi- done-- # Tauri embeds .output/public into Cap Classic, so an empty or- # missing directory means a blank webview.- FE="apps/desktop/.output/public/index.html"- if [[ ! -s "$FE" ]]; then- echo "::error::Frontend build output missing/empty ($FE) - Cap Classic's webview would be blank."- ls -la apps/desktop/.output/public 2>/dev/null || echo "(no .output/public dir)"+ test "$(cat "$APPROOT/usr/lib/cap/package-format")" = appimage+ test -x "$APPROOT/usr/bin/pactl"+ test -s "$APPROOT/usr/lib/alsa-lib/libasound_module_pcm_pulse.so"+ test -s "$APPROOT/usr/lib/cap/alsa-pulse.conf"+ if [[ -n "$(find "$APPROOT" -name 'libwayland-client.so*' -print -quit)" ]]; then+ echo "::error::The Cap AppImage bundles a Wayland client that can conflict with host Mesa drivers"exit 1fi- if strings "$CLASSIC_APPROOT/usr/bin/Cap Classic" 2>/dev/null | grep -q "index.html"; then- echo "Cap Classic appears to embed the frontend (index.html key present)"- else- echo "::warning::Could not confirm the embedded frontend key in Cap Classic (asset format may differ)"+ if [[ -n "$(find "$APPROOT/usr/lib" -maxdepth 1 -name 'libpipewire-0.3.so*' -print -quit)" ]]; then+ echo "::error::The Cap AppImage bundles PipeWire that can conflict with host ALSA plugins"+ exit 1fi- name: Build Arch Linux package@@ -805,60 +738,42 @@ jobs:if: ${{ runner.os == 'Windows' }}shell: pwshrun: |+ $installers = @(Get-ChildItem -Path "$env:CAP_BUNDLE/nsis" -Filter *.exe)+ if ($installers.Count -ne 1) {+ throw "Expected one Windows NSIS installer, found $($installers.Count)."+ }$sevenZip = Get-Command 7z -ErrorAction Stop- $libraries = @(+ $requiredFiles = @(+ "Cap.exe", "cap-muxer.exe", "cap-cli.exe","avcodec-61.dll", "avdevice-61.dll", "avfilter-10.dll", "avformat-61.dll","avutil-59.dll", "postproc-58.dll", "swresample-5.dll", "swscale-8.dll","dxcompiler.dll", "dxil.dll", "onnxruntime.dll", "onnxruntime_providers_shared.dll")- $apps = @(- [pscustomobject]@{- Bundle = "$env:CAP_BUNDLE/nsis"- Required = @("Cap.exe", "cap-muxer.exe", "cap-cli.exe") + $libraries- Forbidden = @("cap-gpui.exe", "cap-exporter.exe", "Cap Classic.exe")- },- [pscustomobject]@{- Bundle = "$env:CLASSIC_BUNDLE/nsis"- Required = @("Cap Classic.exe", "cap-muxer.exe", "cap-exporter.exe", "cap-cli.exe") + $libraries- Forbidden = @("cap-gpui.exe", "Cap.exe")- }- )- foreach ($app in $apps) {- $installers = @(Get-ChildItem -Path $app.Bundle -Filter *.exe)- if ($installers.Count -ne 1) {- throw "Expected one Windows NSIS installer in '$($app.Bundle)', found $($installers.Count)."+ $forbiddenFiles = @("cap-gpui.exe", "cap-exporter.exe")+ foreach ($installer in $installers) {+ $contents = & $sevenZip.Source l -slt $installer.FullName+ if ($LASTEXITCODE -ne 0) {+ throw "Could not inspect Windows installer '$($installer.Name)'."}- foreach ($installer in $installers) {- $contents = & $sevenZip.Source l -slt $installer.FullName- if ($LASTEXITCODE -ne 0) {- throw "Could not inspect Windows installer '$($installer.Name)'."+ foreach ($file in $requiredFiles) {+ if ($contents -notcontains "Path = $file") {+ throw "Windows installer '$($installer.Name)' is missing bundled '$file'."}- foreach ($file in $app.Required) {- if ($contents -notcontains "Path = $file") {- throw "Windows installer '$($installer.Name)' is missing bundled '$file'."- }- }- foreach ($file in $app.Forbidden) {- if ($contents -contains "Path = $file") {- throw "Windows installer '$($installer.Name)' unexpectedly bundles '$file'."- }+ }+ foreach ($file in $forbiddenFiles) {+ if ($contents -contains "Path = $file") {+ throw "Windows installer '$($installer.Name)' unexpectedly bundles '$file'."}}}- - name: Stage Windows installers for Authenticode signing- if: ${{ runner.os == 'Windows' }}- shell: pwsh- run: |- ./scripts/windows-release-signing.ps1 -Operation StageInstallers -Target "${{ matrix.settings.target }}" -WorkspaceRoot "$env:GITHUB_WORKSPACE"-- - name: Upload unsigned Windows installers+ - name: Upload unsigned Windows installerif: ${{ runner.os == 'Windows' }}id: upload_unsigned_windows_installeruses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2with:name: unsigned-windows-installer- path: target/${{ matrix.settings.target }}/release/windows-signing/installers/*.exe+ path: ${{ env.CAP_BUNDLE }}/nsis/*.exeif-no-files-found: error- name: Submit SignPath signing request@@ -881,33 +796,62 @@ jobs:service-unavailable-timeout-in-seconds: 5400output-artifact-directory: signed-windows-installer- - name: Restore and verify signed Windows installers+ - name: Restore signed Windows installerif: ${{ runner.os == 'Windows' }}shell: pwshrun: |- ./scripts/windows-release-signing.ps1 -Operation RestoreInstallers -Target "${{ matrix.settings.target }}" -WorkspaceRoot "$env:GITHUB_WORKSPACE"+ $signedDir = "signed-windows-installer"+ $bundleDir = "$env:CAP_BUNDLE/nsis"- - name: Verify extracted Windows payload signatures and hashes+ if (-not (Test-Path $signedDir)) {+ throw "Signed artifact directory '$signedDir' not found."+ }++ $executables = Get-ChildItem -Path $signedDir -Filter *.exe -Recurse+ if (-not $executables) {+ throw "No signed executables found in '$signedDir'."+ }++ Write-Host "Copying signed executables to: $bundleDir"+ Copy-Item -Path (Join-Path $signedDir '*.exe') -Destination $bundleDir -Force++ Write-Host "Files in bundle directory after signing:"+ Get-ChildItem -Path $bundleDir -Filter *.exe | ForEach-Object { Write-Host " - $($_.Name)" }++ - name: Verify Windows installer Authenticode signatureif: ${{ runner.os == 'Windows' }}shell: pwshrun: |- foreach ($app in @(- [pscustomobject]@{ Name = "cap"; Bundle = "$env:CAP_BUNDLE/nsis" },- [pscustomobject]@{ Name = "classic"; Bundle = "$env:CLASSIC_BUNDLE/nsis" }- )) {- $installers = @(Get-ChildItem -Path $app.Bundle -Filter *.exe)- if ($installers.Count -ne 1) {- throw "Expected one signed installer in '$($app.Bundle)', found $($installers.Count)."+ $installers = Get-ChildItem -Path "$env:CAP_BUNDLE/nsis" -Filter *.exe+ if (-not $installers) {+ throw "No Windows installer exists after SignPath signing."+ }+ foreach ($installer in $installers) {+ $signature = Get-AuthenticodeSignature -FilePath $installer.FullName+ if ($signature.Status -ne "Valid") {+ throw "Windows installer '$($installer.Name)' has invalid Authenticode status: $($signature.Status)."}- ./scripts/windows-release-signing.ps1 -Operation VerifyInstaller -App $app.Name -Target "${{ matrix.settings.target }}" -WorkspaceRoot "$env:GITHUB_WORKSPACE" -InstallerPath $installers[0].FullName}- - name: Re-sign Windows installers for the updater+ - name: Verify extracted Windows payload signatures and hashes+ if: ${{ runner.os == 'Windows' }}+ shell: pwsh+ run: |+ $installers = Get-ChildItem -Path "$env:CAP_BUNDLE/nsis" -Filter *.exe+ if (-not $installers) {+ throw "No Windows installer exists for extracted payload verification."+ }+ foreach ($installer in $installers) {+ ./scripts/windows-release-signing.ps1 -Operation VerifyInstaller -Target "${{ matrix.settings.target }}" -WorkspaceRoot "$env:GITHUB_WORKSPACE" -InstallerPath $installer.FullName+ }++ - name: Re-sign Windows installer for the updaterif: ${{ runner.os == 'Windows' }}shell: bashworking-directory: apps/desktoprun: |- for exe in "../../$CAP_BUNDLE"/nsis/*.exe "../../$CLASSIC_BUNDLE"/nsis/*.exe; do+ BUNDLE_DIR="../../$CAP_BUNDLE/nsis"+ for exe in "$BUNDLE_DIR"/*.exe; doecho "Re-signing $(basename "$exe") for the updater..."rm -f "${exe}.sig"bun run tauri signer sign -k "$TAURI_SIGNING_PRIVATE_KEY" -p "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" "$exe"@@ -916,7 +860,8 @@ jobs:exit 1fidone- ls -la "../../$CAP_BUNDLE"/nsis/*.sig "../../$CLASSIC_BUNDLE"/nsis/*.sig+ echo "Signature files after re-signing:"+ ls -la "$BUNDLE_DIR"/*.sigenv:TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}@@ -935,13 +880,7 @@ jobs:${{ env.CAP_BUNDLE }}/deb/*.sig${{ env.CAP_BUNDLE }}/appimage/*.AppImage${{ env.CAP_BUNDLE }}/appimage/*.sig- ${{ env.CLASSIC_BUNDLE }}/dmg/*.dmg- ${{ env.CLASSIC_BUNDLE }}/macos/*.tar.gz- ${{ env.CLASSIC_BUNDLE }}/macos/*.sig- ${{ env.CLASSIC_BUNDLE }}/nsis/*.exe- ${{ env.CLASSIC_BUNDLE }}/nsis/*.sig- ${{ env.CLASSIC_BUNDLE }}/appimage/*.AppImage- ${{ env.CLASSIC_BUNDLE }}/appimage/*.sig+ ${{ env.CAP_BUNDLE }}/rpm/*.rpmtarget/${{ matrix.settings.target }}/release/windows-signing/payload-manifest.jsonif-no-files-found: errorretention-days: 3@@ -965,18 +904,14 @@ jobs:macOS)echo "cap_dmg=$(one "$CAP_BUNDLE"/dmg/*.dmg)"echo "cap_update=$(one "$CAP_BUNDLE"/macos/*.app.tar.gz)"- echo "classic_dmg=$(one "$CLASSIC_BUNDLE"/dmg/*.dmg)"- echo "classic_update=$(one "$CLASSIC_BUNDLE"/macos/*.app.tar.gz)";;Windows)echo "cap_installer=$(one "$CAP_BUNDLE"/nsis/*.exe)"- echo "classic_installer=$(one "$CLASSIC_BUNDLE"/nsis/*.exe)";;Linux)echo "cap_deb=$(one "$CAP_BUNDLE"/deb/*.deb)"echo "cap_appimage=$(one "$CAP_BUNDLE"/appimage/*.AppImage)"echo "cap_arch=$(one "$CAP_BUNDLE"/arch/*.pkg.tar.zst)"- echo "classic_appimage=$(one "$CLASSIC_BUNDLE"/appimage/*.AppImage)"if [[ "$VERSION" != *-* ]]; thenecho "cap_rpm=$(one "$CAP_BUNDLE"/rpm/*.rpm)"fi@@ -1000,20 +935,6 @@ jobs:command: release upload ${{ env.CN_APPLICATION }} "${{ inputs.version }}" --file "${{ steps.assets.outputs.cap_update }}" --signature "${{ steps.assets.outputs.cap_update }}.sig" --update-platform darwin-${{ matrix.settings.arch }} ${{ env.CN_CHANNEL_FLAG }}api-key: ${{ secrets.CN_API_KEY }}- - name: Upload Cap Classic macOS disk image- if: ${{ runner.os == 'macOS' }}- uses: crabnebula-dev/cloud-release@v0- with:- command: release upload ${{ env.CN_APPLICATION }} "${{ inputs.version }}" --file "${{ steps.assets.outputs.classic_dmg }}" --public-platform dmg-${{ matrix.settings.arch }}-classic ${{ env.CN_CHANNEL_FLAG }}- api-key: ${{ secrets.CN_API_KEY }}-- - name: Upload Cap Classic macOS update- if: ${{ runner.os == 'macOS' }}- uses: crabnebula-dev/cloud-release@v0- with:- command: release upload ${{ env.CN_APPLICATION }} "${{ inputs.version }}" --file "${{ steps.assets.outputs.classic_update }}" --signature "${{ steps.assets.outputs.classic_update }}.sig" --update-platform darwin-${{ matrix.settings.arch }}-classic ${{ env.CN_CHANNEL_FLAG }}- api-key: ${{ secrets.CN_API_KEY }}-- name: Upload Cap Windows installerif: ${{ runner.os == 'Windows' }}uses: crabnebula-dev/cloud-release@v0@@ -1021,13 +942,6 @@ jobs:command: release upload ${{ env.CN_APPLICATION }} "${{ inputs.version }}" --file "${{ steps.assets.outputs.cap_installer }}" --signature "${{ steps.assets.outputs.cap_installer }}.sig" --public-platform nsis-${{ matrix.settings.arch }} --update-platform windows-${{ matrix.settings.arch }} ${{ env.CN_CHANNEL_FLAG }}api-key: ${{ secrets.CN_API_KEY }}- - name: Upload Cap Classic Windows installer- if: ${{ runner.os == 'Windows' }}- uses: crabnebula-dev/cloud-release@v0- with:- command: release upload ${{ env.CN_APPLICATION }} "${{ inputs.version }}" --file "${{ steps.assets.outputs.classic_installer }}" --signature "${{ steps.assets.outputs.classic_installer }}.sig" --public-platform nsis-${{ matrix.settings.arch }}-classic --update-platform windows-${{ matrix.settings.arch }}-classic ${{ env.CN_CHANNEL_FLAG }}- api-key: ${{ secrets.CN_API_KEY }}-- name: Upload Cap Linux debif: ${{ runner.os == 'Linux' }}uses: crabnebula-dev/cloud-release@v0@@ -1056,31 +970,6 @@ jobs:command: release upload ${{ env.CN_APPLICATION }} "${{ inputs.version }}" --file "${{ steps.assets.outputs.cap_arch }}" --public-platform pacman-x86_64 ${{ env.CN_CHANNEL_FLAG }}api-key: ${{ secrets.CN_API_KEY }}- - name: Upload Cap Classic Linux AppImage- if: ${{ runner.os == 'Linux' }}- uses: crabnebula-dev/cloud-release@v0- with:- command: release upload ${{ env.CN_APPLICATION }} "${{ inputs.version }}" --file "${{ steps.assets.outputs.classic_appimage }}" --signature "${{ steps.assets.outputs.classic_appimage }}.sig" --public-platform appimage-x86_64-classic --update-platform linux-x86_64-appimage-classic ${{ env.CN_CHANNEL_FLAG }}- api-key: ${{ secrets.CN_API_KEY }}-- - uses: matbour/setup-sentry-cli@8ef22a4ff03bcd1ebbcaa3a36a81482ca8e3872e-- - name: Upload debug symbols to Sentry- if: ${{ runner.os == 'macOS' }}- shell: bash- env:- SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}- run: |- sentry-cli debug-files upload -o ${{ env.SENTRY_ORG }} -p ${{ env.SENTRY_PROJECT }} "target/Cap Classic.dSYM"-- - name: Upload debug symbols to Sentry- if: ${{ runner.os == 'Windows' }}- shell: bash- env:- SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}- run: |- sentry-cli debug-files upload -o ${{ env.SENTRY_ORG }} -p ${{ env.SENTRY_PROJECT }} target/${{ matrix.settings.target }}/release/cap_desktop.pdb-done:needs: [draft, build]runs-on: ubuntu-latestdiff --git a/scripts/build-gpui-binary.sh b/scripts/build-gpui-binary.shindex e185a01e1..8c696a764 100755--- a/scripts/build-gpui-binary.sh+++ b/scripts/build-gpui-binary.sh@@ -6,6 +6,7 @@ requested_target="${2:-${RUST_TARGET_TRIPLE:-}}"toolchain="${CAP_GPUI_RUST_TOOLCHAIN:-1.95.0}"repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"gpui_dir="$repo_root/apps/desktop-gpui"+binaries_dir="$repo_root/apps/desktop/src-tauri/binaries"case "$profile" indebug)@@ -60,6 +61,7 @@ node "$repo_root/scripts/sync-desktop-versions.mjs")source_binary="$artifact_dir/cap-gpui$extension"+staged_binary="$binaries_dir/cap-gpui-$target$extension"if [[ ! -f "$source_binary" ]]; thenecho "error: built GPUI binary not found at $source_binary" >&2exit 1@@ -73,4 +75,9 @@ if [[ "$target" == *linux* ]]; thenpatchelf --set-rpath '$ORIGIN:$ORIGIN/../lib/cap' "$source_binary"fi-echo "Built $source_binary"+mkdir -p "$binaries_dir"+cp "$source_binary" "$staged_binary"+if [[ "$extension" != ".exe" ]]; then+ chmod +x "$staged_binary"+fi+echo "Staged $source_binary -> $staged_binary"diff --git a/scripts/build-linux-packages.mjs b/scripts/build-linux-packages.mjsindex 812600f6c..055964d0e 100644--- a/scripts/build-linux-packages.mjs+++ b/scripts/build-linux-packages.mjs@@ -10,23 +10,18 @@ import {finalizeGpuiDeb,finalizeGpuiRpm,} from "./finalize-linux-gpui-packages.mjs";-import {- supportedLinuxBundles,- supportedLinuxClassicBundles,-} from "./linux-bundle-config.mjs";+import { supportedLinuxBundles } from "./linux-bundle-config.mjs";const repoRoot = fileURLToPath(new URL("..", import.meta.url));-const desktopDirectory = path.join(repoRoot, "apps", "desktop");-const [target, app, ...args] = process.argv.slice(2);+const [target, ...args] = process.argv.slice(2);if (process.platform !== "linux" ||!/^\w+-unknown-linux-gnu$/.test(target ?? "") ||- (app !== "cap" && app !== "classic") ||args.some((arg) => /^--(?:target|bundles|debug|profile)(?:=|$)/.test(arg))) {throw new Error(- "Run on Linux: node scripts/build-linux-packages.mjs <target> <cap|classic> [tauri options]",+ "Run on Linux: node scripts/build-linux-packages.mjs <target> [--skip-build] [tauri bundle options]",);}if (!process.env.TAURI_SIGNING_PRIVATE_KEY) {@@ -35,57 +30,31 @@ if (!process.env.TAURI_SIGNING_PRIVATE_KEY) {);}-function cargoMetadata(cwd) {- return JSON.parse(- runCommand("cargo", ["metadata", "--no-deps", "--format-version", "1"], {- cwd,- encoding: "utf8",- stdio: ["ignore", "pipe", "inherit"],- }).stdout,- );-}--const classic = cargoMetadata(path.join(desktopDirectory, "src-tauri"));-const version = classic.packages.find(+const metadata = JSON.parse(+ runCommand("cargo", ["metadata", "--no-deps", "--format-version", "1"], {+ cwd: path.join(repoRoot, "apps", "desktop", "src-tauri"),+ encoding: "utf8",+ stdio: ["ignore", "pipe", "inherit"],+ }).stdout,+);+const version = metadata.packages.find((pkg) => pkg.name === "cap-desktop",)?.version;if (!version) throw new Error("Desktop version is missing from Cargo metadata");-let targetDirectory;-if (app === "classic") {- targetDirectory = classic.target_directory;- runCommand(- "bun",- [- "run",- "build:tauri",- "--target",- target,- "--bundles",- supportedLinuxClassicBundles().join(","),- ...args,- ],- {- cwd: desktopDirectory,- env: { ...process.env, RUST_TARGET_TRIPLE: target },- },- );-} else {- targetDirectory = path.join(gpuiDirectory, "target");- runCommand(- "node",- [- path.join(repoRoot, "scripts", "bundle-gpui.mjs"),- target,- "--bundles",- supportedLinuxBundles(version).join(","),- ...args,- ],- { env: { ...process.env, RUST_TARGET_TRIPLE: target } },- );-}+runCommand(+ "node",+ [+ path.join(repoRoot, "scripts", "bundle-gpui.mjs"),+ target,+ "--bundles",+ supportedLinuxBundles(version).join(","),+ ...args,+ ],+ { env: { ...process.env, RUST_TARGET_TRIPLE: target } },+);-const bundleRoot = path.join(targetDirectory, target, "release/bundle");+const bundleRoot = path.join(gpuiDirectory, "target", target, "release/bundle");async function bundledArtifacts(format, extension) {const directory = path.join(bundleRoot, format);@@ -101,12 +70,10 @@ if (images.length !== 1) {`Expected one AppImage in ${bundleRoot}/appimage, found ${images.length}`,);}-if (app === "cap") {- for (const deb of await bundledArtifacts("deb", ".deb")) {- await finalizeGpuiDeb(deb);- }- for (const rpm of await bundledArtifacts("rpm", ".rpm")) {- await finalizeGpuiRpm(rpm);- }+for (const deb of await bundledArtifacts("deb", ".deb")) {+ await finalizeGpuiDeb(deb);+}+for (const rpm of await bundledArtifacts("rpm", ".rpm")) {+ await finalizeGpuiRpm(rpm);}-await finalizeLinuxAppImage(images[0], { webview: app === "classic" });+await finalizeLinuxAppImage(images[0], { webview: false });diff --git a/scripts/build-macos-packages.mjs b/scripts/build-macos-packages.mjsindex 27d6e5026..966a1d2dc 100644--- a/scripts/build-macos-packages.mjs+++ b/scripts/build-macos-packages.mjs@@ -152,7 +152,7 @@ export async function buildMacosPackages(target,args = [],{- app = "classic",+ bundleOnly = false,platform = process.platform,env = process.env,signal,@@ -163,9 +163,6 @@ export async function buildMacosPackages(} = {},) {validateArguments(target, args, platform);- if (app !== "classic" && app !== "cap") {- throw new Error(`Unknown macOS app to package: ${app}`);- }const commandArguments = ["--target", target, ...args];const environment = {...env,@@ -188,7 +185,7 @@ export async function buildMacosPackages(signal?.throwIfAborted();let outputTail = "";const command =- attempt === 0 && app === "classic"+ attempt === 0 && !bundleOnly? ["build:tauri", ...commandArguments]: ["dotenv",diff --git a/scripts/build-macos-packages.test.mjs b/scripts/build-macos-packages.test.mjsindex 6c9190617..e64f11da3 100644--- a/scripts/build-macos-packages.test.mjs+++ b/scripts/build-macos-packages.test.mjs@@ -84,7 +84,7 @@ test("the GPUI app is packaged by rebundling its prebuilt binary on every attemp["--bundles", "app,dmg", "--verbose"],{...fixture.options,- app: "cap",+ bundleOnly: true,},);assert.equal(result.code, 0);@@ -112,10 +112,6 @@ test("the GPUI app is packaged by rebundling its prebuilt binary on every attempfor (const call of fixture.calls) {assert.equal(call.env.TAURI_APP_PATH, "/repo/apps/desktop-gpui");}- await assert.rejects(- buildMacosPackages(target, [], { ...fixture.options, app: "other" }),- /Unknown macOS app/,- );});test("macOS deployment targets preserve compatible overrides and reject unsafe versions", () => {diff --git a/scripts/bundle-gpui.mjs b/scripts/bundle-gpui.mjsindex 8d2bb50c0..ffa92a6ad 100644--- a/scripts/bundle-gpui.mjs+++ b/scripts/bundle-gpui.mjs@@ -164,7 +164,7 @@ export async function bundleGpui(target, args, { env = process.env } = {}) {if (platform === "darwin") {const result = await buildMacosPackages(target, bundleArgs, {- app: "cap",+ bundleOnly: true,env: bundleEnvironment(env),});if (result.signal || result.code !== 0) {diff --git a/scripts/bundle-gpui.test.mjs b/scripts/bundle-gpui.test.mjsindex ca6aea55b..a7acc0ad3 100644--- a/scripts/bundle-gpui.test.mjs+++ b/scripts/bundle-gpui.test.mjs@@ -17,8 +17,8 @@ const readJson = (relative) =>JSON.parse(readFileSync(new URL(relative, import.meta.url), "utf8"));const gpuiConfig = readJson("../apps/desktop-gpui/tauri.conf.json");-const classicConfig = readJson("../apps/desktop/src-tauri/tauri.conf.json");-const classicProduction = readJson(+const tauriConfig = readJson("../apps/desktop/src-tauri/tauri.conf.json");+const tauriProduction = readJson("../apps/desktop/src-tauri/tauri.prod.conf.json",);@@ -44,7 +44,7 @@ test("the GPUI app keeps the identity every existing install updates into", () =assert.equal(gpuiConfig.identifier, "so.cap.desktop");assert.equal(gpuiConfig.plugins.updater.pubkey,- classicProduction.plugins.updater.pubkey,+ tauriProduction.plugins.updater.pubkey,);assert.deepEqual(gpuiConfig.plugins.updater.endpoints, ["https://cdn.crabnebula.app/update/cap/cap/{{target}}/{{current_version}}",@@ -61,23 +61,17 @@ test("the GPUI app keeps the identity every existing install updates into", () =);assert.deepEqual(gpuiConfig.plugins["deep-link"],- classicConfig.plugins["deep-link"],+ tauriConfig.plugins["deep-link"],);assert.equal(gpuiConfig.bundle.createUpdaterArtifacts, true);});-test("Cap Classic is a separate app that shares Cap's data identity", () => {- assert.equal(classicProduction.productName, "Cap Classic");- assert.equal(classicProduction.mainBinaryName, "Cap Classic");- assert.equal(classicProduction.identifier, gpuiConfig.identifier);- assert.ok(- !classicConfig.bundle.externalBin.some((binary) =>- binary.includes("cap-gpui"),- ),- );- assert.notEqual(- classicProduction.bundle.fileAssociations[0].name,- gpuiConfig.bundle.fileAssociations[0].name,+test("the GPUI bundle takes over the identity the Tauri app shipped with", () => {+ assert.equal(tauriProduction.productName, gpuiConfig.productName);+ assert.equal(tauriProduction.identifier, gpuiConfig.identifier);+ assert.deepEqual(+ tauriProduction.plugins.updater.endpoints,+ gpuiConfig.plugins.updater.endpoints,);});diff --git a/scripts/linux-bundle-config.mjs b/scripts/linux-bundle-config.mjsindex f258fd4d0..b9ce7665d 100644--- a/scripts/linux-bundle-config.mjs+++ b/scripts/linux-bundle-config.mjs@@ -4,11 +4,7 @@ export function supportedLinuxBundles(version) {: ["deb", "rpm", "appimage"];}-export function supportedLinuxClassicBundles() {- return ["appimage"];-}--export const CLASSIC_RPM_DEPENDS = [+export const TAURI_RPM_DEPENDS = ["webkit2gtk4.1","gtk3","libayatana-appindicator-gtk3",@@ -44,7 +40,7 @@ export function createLinuxBundleConfig(debDependencies = [],{root = "../../..",- rpmDependencies = CLASSIC_RPM_DEPENDS,+ rpmDependencies = TAURI_RPM_DEPENDS,mediaFramework = true,} = {},) {diff --git a/scripts/linux-bundle-config.test.mjs b/scripts/linux-bundle-config.test.mjsindex 9778ff7a8..48d357562 100644--- a/scripts/linux-bundle-config.test.mjs+++ b/scripts/linux-bundle-config.test.mjs@@ -1,11 +1,10 @@import assert from "node:assert/strict";import { test } from "node:test";import {- CLASSIC_RPM_DEPENDS,createLinuxBundleConfig,GPUI_RPM_DEPENDS,supportedLinuxBundles,- supportedLinuxClassicBundles,+ TAURI_RPM_DEPENDS,} from "./linux-bundle-config.mjs";test("nightly builds retain DEB and AppImage without passing invalid hyphenated versions to RPM", () => {@@ -112,10 +111,9 @@ test("the GPUI app maps native libraries from its own crate directory without weassert.notEqual(rpm.depends, GPUI_RPM_DEPENDS);});-test("Cap Classic ships on Linux as a self-contained AppImage", () => {- assert.deepEqual(supportedLinuxClassicBundles(), ["appimage"]);+test("the Tauri dev app keeps its webview RPM dependencies by default", () => {assert.deepEqual(createLinuxBundleConfig([]).bundle.linux.rpm.depends,- CLASSIC_RPM_DEPENDS,+ TAURI_RPM_DEPENDS,);});diff --git a/scripts/run-gpui-build.mjs b/scripts/run-gpui-build.mjsnew file mode 100644index 000000000..ac751cc65--- /dev/null+++ b/scripts/run-gpui-build.mjs@@ -0,0 +1,91 @@+import { spawnSync } from "node:child_process";+import { existsSync } from "node:fs";+import * as path from "node:path";+import { fileURLToPath } from "node:url";++export function shouldBuildGpui(+ platform,+ environment,+ profile,+ developmentWorkspaceAvailable = true,+) {+ if (!["darwin", "win32", "linux"].includes(platform)) return false;+ if (profile === "release") return true;+ return (+ platform === "darwin" &&+ environment.CAP_GPUI_DEV !== "0" &&+ developmentWorkspaceAvailable+ );+}++export function shouldBundleGpui(+ platform,+ environment,+ profile,+ stagedSidecarAvailable,+ developmentWorkspaceAvailable = true,+) {+ return (+ shouldBuildGpui(+ platform,+ environment,+ profile,+ developmentWorkspaceAvailable,+ ) &&+ (profile === "release" || stagedSidecarAvailable)+ );+}++function main() {+ const profile = process.argv[2];+ if (profile !== "debug" && profile !== "release") {+ console.error("The Cap GPUI build profile must be debug or release.");+ process.exitCode = 1;+ return;+ }++ const scriptsDir = path.dirname(fileURLToPath(import.meta.url));+ const gpuiDevScript = path.join(+ scriptsDir,+ "..",+ "apps",+ "desktop-gpui",+ "dev.sh",+ );++ if (+ !shouldBuildGpui(+ process.platform,+ process.env,+ profile,+ profile !== "debug" || existsSync(gpuiDevScript),+ )+ ) {+ console.log(+ `Skipping Cap GPUI ${profile} build on ${process.platform}${+ process.env.CAP_GPUI_DEV === "0" ? " because CAP_GPUI_DEV=0" : ""+ }.`,+ );+ return;+ }++ const result = spawnSync(+ "bash",+ [path.join(scriptsDir, "build-gpui-binary.sh"), profile],+ { stdio: "inherit" },+ );++ if (result.error) {+ console.error(`Failed to build Cap GPUI: ${result.error.message}`);+ process.exitCode = 1;+ } else if (result.status !== 0) {+ process.exitCode = result.status ?? 1;+ }+}++if (+ process.argv[1] &&+ path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)+) {+ main();+}diff --git a/scripts/run-gpui-build.test.mjs b/scripts/run-gpui-build.test.mjsnew file mode 100644index 000000000..2121a395d--- /dev/null+++ b/scripts/run-gpui-build.test.mjs@@ -0,0 +1,50 @@+import assert from "node:assert/strict";+import test from "node:test";+import { shouldBuildGpui, shouldBundleGpui } from "./run-gpui-build.mjs";++test("GPUI release builds run on every supported desktop platform", () => {+ assert.equal(shouldBuildGpui("darwin", {}, "release"), true);+ assert.equal(shouldBuildGpui("win32", {}, "release"), true);+ assert.equal(shouldBuildGpui("linux", {}, "release"), true);+ assert.equal(shouldBuildGpui("freebsd", {}, "release"), false);+});++test("GPUI development builds honor their platform and opt-out guards", () => {+ assert.equal(shouldBuildGpui("darwin", {}, "debug"), true);+ assert.equal(+ shouldBuildGpui("darwin", { CAP_GPUI_DEV: "0" }, "debug"),+ false,+ );+ assert.equal(shouldBuildGpui("darwin", {}, "debug", false), false);+ assert.equal(shouldBuildGpui("win32", {}, "debug"), false);+ assert.equal(shouldBuildGpui("linux", {}, "debug"), false);+});++test("the development opt-out never suppresses supported release builds", () => {+ for (const platform of ["darwin", "win32", "linux"]) {+ assert.equal(+ shouldBuildGpui(platform, { CAP_GPUI_DEV: "0" }, "release"),+ true,+ );+ }+});++test("macOS development only bundles an enabled and available GPUI sidecar", () => {+ assert.equal(shouldBundleGpui("darwin", {}, "debug", true), true);+ assert.equal(shouldBundleGpui("darwin", {}, "debug", false), false);+ assert.equal(shouldBundleGpui("darwin", {}, "debug", true, false), false);+ assert.equal(+ shouldBundleGpui("darwin", { CAP_GPUI_DEV: "0" }, "debug", true),+ false,+ );+});++test("release bundling is mandatory on every supported desktop platform", () => {+ for (const platform of ["darwin", "win32", "linux"]) {+ assert.equal(+ shouldBundleGpui(platform, { CAP_GPUI_DEV: "0" }, "release", false),+ true,+ );+ }+ assert.equal(shouldBundleGpui("freebsd", {}, "release", true), false);+});diff --git a/scripts/setup.js b/scripts/setup.jsindex 72ff88910..d61d0898c 100644--- a/scripts/setup.js+++ b/scripts/setup.js@@ -740,17 +740,17 @@ async function writeLinuxTauriConfig(sonameLibs) {await fs.mkdir(appimageLibDir, { recursive: true });await fs.copyFile(pulsePlugin, path.join(appimageLibDir, pluginName));- const classicDirectory = path.join(__root, "apps", "desktop", "src-tauri");- const classicConfig = JSON.parse(- await fs.readFile(path.join(classicDirectory, "tauri.conf.json"), "utf8"),+ const tauriDirectory = path.join(__root, "apps", "desktop", "src-tauri");+ const tauriConfig = JSON.parse(+ await fs.readFile(path.join(tauriDirectory, "tauri.conf.json"), "utf8"),);await writeFileIfChanged(- path.join(classicDirectory, "tauri.linux.conf.json"),+ path.join(tauriDirectory, "tauri.linux.conf.json"),`${JSON.stringify(createLinuxBundleConfig(sonameLibs,- classicConfig.bundle.linux.deb.files,- classicConfig.bundle.linux.deb.depends,+ tauriConfig.bundle.linux.deb.files,+ tauriConfig.bundle.linux.deb.depends,),null,"\t",diff --git a/scripts/verify-gpui-release-inputs.mjs b/scripts/verify-gpui-release-inputs.mjsnew file mode 100644index 000000000..8db35f432--- /dev/null+++ b/scripts/verify-gpui-release-inputs.mjs@@ -0,0 +1,78 @@+import { execFileSync } from "node:child_process";+import { createHash } from "node:crypto";+import * as fs from "node:fs/promises";+import * as path from "node:path";+import { fileURLToPath } from "node:url";++const repoRoot = path.resolve(+ path.dirname(fileURLToPath(import.meta.url)),+ "..",+);++const configNames = {+ darwin: "tauri.macos.conf.json",+ win32: "tauri.windows.conf.json",+ linux: "tauri.linux.conf.json",+};+const configName = configNames[process.platform];++if (!configName) {+ console.log(`Skipping Cap GPUI release validation on ${process.platform}.`);+} else {+ const srcTauri = path.join(repoRoot, "apps/desktop/src-tauri");+ const configPath = path.join(srcTauri, configName);+ const productionConfigPath = path.join(srcTauri, "tauri.prod.conf.json");+ const [config, productionConfig] = await Promise.all([+ fs.readFile(configPath, "utf8").then(JSON.parse),+ fs.readFile(productionConfigPath, "utf8").then(JSON.parse),+ ]);+ const externalBin =+ productionConfig.bundle?.externalBin ?? config.bundle?.externalBin;+ if (+ !Array.isArray(externalBin) ||+ !externalBin.includes("binaries/cap-gpui")+ ) {+ throw new Error(+ `The effective ${process.platform} release config does not bundle Cap GPUI.`,+ );+ }++ const binariesDir = path.join(srcTauri, "binaries");+ const requestedTarget = process.env.RUST_TARGET_TRIPLE;+ const host = execFileSync("rustc", ["-vV"], { encoding: "utf8" }).match(+ /^host:\s*(.+)$/m,+ )?.[1];+ const target = requestedTarget ?? host;+ if (!target) throw new Error("Could not determine the Rust target triple");++ const extension = process.platform === "win32" ? ".exe" : "";+ const fileName = `cap-gpui-${target}${extension}`;+ const binaryPath = path.join(binariesDir, fileName);+ const releaseBinaryPath = path.join(+ repoRoot,+ "apps",+ "desktop-gpui",+ "target",+ ...(requestedTarget ? [target] : []),+ "release",+ `cap-gpui${extension}`,+ );+ const [stagedBinary, releaseBinary] = await Promise.all([+ fs.readFile(binaryPath),+ fs.readFile(releaseBinaryPath),+ ]);++ if (stagedBinary.length === 0 || releaseBinary.length === 0) {+ throw new Error("The staged Cap GPUI release binary is empty");+ }++ const sha256 = (contents) =>+ createHash("sha256").update(contents).digest("hex");+ if (sha256(stagedBinary) !== sha256(releaseBinary)) {+ throw new Error(`${binaryPath} does not match ${releaseBinaryPath}`);+ }++ console.log(+ `Verified effective ${process.platform} release configuration and ${fileName} for GPUI packaging.`,+ );+}diff --git a/scripts/windows-release-signing.ps1 b/scripts/windows-release-signing.ps1index 3d712412b..297ea043f 100644--- a/scripts/windows-release-signing.ps1+++ b/scripts/windows-release-signing.ps1@@ -1,13 +1,11 @@[CmdletBinding()]param([Parameter(Mandatory = $true)]- [ValidateSet("Stage", "Restore", "StageInstallers", "RestoreInstallers", "VerifyInstaller")]+ [ValidateSet("Stage", "Restore", "VerifyInstaller")][string] $Operation,[string] $Target = $env:RUST_TARGET_TRIPLE,[string] $WorkspaceRoot = $env:GITHUB_WORKSPACE,- [string] $InstallerPath,- [ValidateSet("cap", "classic")]- [string] $App+ [string] $InstallerPath)Set-StrictMode -Version Latest@@ -23,43 +21,23 @@ if ([string]::IsNullOrWhiteSpace($Target)) {}$releaseRoot = Join-Path $WorkspaceRoot "target/$Target/release"-$gpuiReleaseRoot = Join-Path $WorkspaceRoot "apps/desktop-gpui/target/$Target/release"-$sidecarRoot = Join-Path $WorkspaceRoot "apps/desktop/src-tauri/binaries"$signingRoot = Join-Path $releaseRoot "windows-signing"$payloadRoot = Join-Path $signingRoot "payload"-$installerRoot = Join-Path $signingRoot "installers"$manifestPath = Join-Path $signingRoot "payload-manifest.json"-$installerBundleRoots = @(- (Join-Path $gpuiReleaseRoot "bundle/nsis"),- (Join-Path $releaseRoot "bundle/nsis")-)function Get-PayloadDefinitions {return @([pscustomobject]@{Name = "Cap.exe"- Path = Join-Path $gpuiReleaseRoot "cap-gpui.exe"- Apps = @("cap")- },- [pscustomobject]@{- Name = "Cap Classic.exe"- Path = Join-Path $releaseRoot "Cap Classic.exe"- Apps = @("classic")+ Path = Join-Path $WorkspaceRoot "apps/desktop-gpui/target/$Target/release/cap-gpui.exe"},[pscustomobject]@{Name = "cap-cli.exe"- Path = Join-Path $sidecarRoot "cap-cli-$Target.exe"- Apps = @("cap", "classic")- },- [pscustomobject]@{- Name = "cap-exporter.exe"- Path = Join-Path $sidecarRoot "cap-exporter-$Target.exe"- Apps = @("classic")+ Path = Join-Path $WorkspaceRoot "apps/desktop/src-tauri/binaries/cap-cli-$Target.exe"},[pscustomobject]@{Name = "cap-muxer.exe"- Path = Join-Path $sidecarRoot "cap-muxer-$Target.exe"- Apps = @("cap", "classic")+ Path = Join-Path $WorkspaceRoot "apps/desktop/src-tauri/binaries/cap-muxer-$Target.exe"})}@@ -91,7 +69,7 @@ function Read-Manifest {}$manifest = Get-Content -LiteralPath $manifestPath -Raw | ConvertFrom-Json$expectedNames = @(Get-PayloadDefinitions | ForEach-Object Name | Sort-Object)- if ($manifest.schemaVersion -ne 2 -or $manifest.target -ne $Target -or @($manifest.entries).Count -ne $expectedNames.Count) {+ if ($manifest.schemaVersion -ne 1 -or $manifest.target -ne $Target -or @($manifest.entries).Count -ne $expectedNames.Count) {throw "Payload manifest '$manifestPath' has an unexpected schema."}$actualNames = @($manifest.entries | ForEach-Object name | Sort-Object)@@ -117,15 +95,6 @@ function Assert-Authenticode([string] $Path) {return $signature}-function Get-BundledInstallers {- $installers = @(foreach ($root in $installerBundleRoots) {- if (Test-Path -LiteralPath $root -PathType Container) {- Get-ChildItem -LiteralPath $root -Filter *.exe -File- }- })- return $installers-}-function Stage-Payload {if (Test-Path -LiteralPath $signingRoot) {Remove-Item -LiteralPath $signingRoot -Recurse -Force@@ -139,7 +108,6 @@ function Stage-Payload {$null = Copy-Item -LiteralPath $definition.Path -Destination $destination -Force -PassThru[ordered]@{name = $definition.Name- apps = @($definition.Apps)bytes = (Get-Item -LiteralPath $definition.Path).LengthpreSignSha256 = Get-Sha256 $definition.PathsignedSha256 = $null@@ -149,10 +117,9 @@ function Stage-Payload {}}Write-Manifest ([ordered]@{- schemaVersion = 2+ schemaVersion = 1target = $Targetentries = @($entries)- installers = @()verifiedInstallers = @()})Write-Host "Staged $($entries.Count) first-party Windows payload executables."@@ -183,57 +150,9 @@ function Restore-Payload {Write-Host "Restored and Authenticode-verified signed Windows payload executables."}-function Stage-Installers {- $manifest = Read-Manifest- if (Test-Path -LiteralPath $installerRoot) {- Remove-Item -LiteralPath $installerRoot -Recurse -Force- }- $null = New-Item -ItemType Directory -Path $installerRoot -Force- $installers = @(Get-BundledInstallers)- if ($installers.Count -ne 2) {- throw "Expected the Cap and Cap Classic installers, found $($installers.Count)."- }- $staged = foreach ($installer in $installers) {- $destination = Join-Path $installerRoot $installer.Name- if (Test-Path -LiteralPath $destination) {- throw "Two installers are both named '$($installer.Name)'."- }- $null = Copy-Item -LiteralPath $installer.FullName -Destination $destination -PassThru- [ordered]@{- name = $installer.Name- path = $installer.FullName- preSignSha256 = Get-Sha256 $installer.FullName- }- }- $manifest.installers = @($staged)- Write-Manifest $manifest- Write-Host "Staged $($staged.Count) Windows installers for Authenticode signing."-}--function Restore-Installers {- $manifest = Read-Manifest- $signedRoot = Join-Path $WorkspaceRoot "signed-windows-installer"- if (-not (Test-Path -LiteralPath $signedRoot -PathType Container)) {- throw "Signed installer directory '$signedRoot' does not exist."- }- if (@($manifest.installers).Count -ne 2) {- throw "No staged installers are recorded in '$manifestPath'."- }- foreach ($installer in $manifest.installers) {- if ((Get-Sha256 $installer.path) -ne $installer.preSignSha256) {- throw "Unsigned installer '$($installer.name)' changed after staging."- }- $signedFile = Find-UniqueFile $signedRoot $installer.name- $null = Assert-Authenticode $signedFile.FullName- $null = Copy-Item -LiteralPath $signedFile.FullName -Destination $installer.path -Force -PassThru- $null = Assert-Authenticode $installer.path- }- Write-Host "Restored and Authenticode-verified the signed Windows installers."-}-function Verify-Installer {- if ([string]::IsNullOrWhiteSpace($InstallerPath) -or [string]::IsNullOrWhiteSpace($App)) {- throw "-InstallerPath and -App are required for VerifyInstaller."+ if ([string]::IsNullOrWhiteSpace($InstallerPath)) {+ throw "-InstallerPath is required for VerifyInstaller."}$installer = (Resolve-Path -LiteralPath $InstallerPath).Path$installerSignature = Assert-Authenticode $installer@@ -250,35 +169,24 @@ function Verify-Installer {throw "Could not extract Windows installer '$installer'."}foreach ($entry in $manifest.entries) {- $included = @($entry.apps) -contains $App- $extracted = @(Get-ChildItem -LiteralPath $extractRoot -Recurse -File | Where-Object Name -eq $entry.name)- if (-not $included) {- if ($extracted.Count -ne 0) {- throw "The $App installer unexpectedly contains '$($entry.name)'."- }- continue- }if ([string]::IsNullOrWhiteSpace($entry.signedSha256)) {throw "Manifest entry '$($entry.name)' has no signed hash."}- if ($extracted.Count -ne 1) {- throw "Expected exactly one '$($entry.name)' in the $App installer, found $($extracted.Count)."- }- $signature = Assert-Authenticode $extracted[0].FullName- $actualHash = Get-Sha256 $extracted[0].FullName+ $extracted = Find-UniqueFile $extractRoot $entry.name+ $signature = Assert-Authenticode $extracted.FullName+ $actualHash = Get-Sha256 $extracted.FullNameif ($actualHash -ne $entry.signedSha256 -or $signature.SignerCertificate.Thumbprint -ne $entry.signerThumbprint) {throw "Installer payload '$($entry.name)' hash differs from the signed payload manifest."}}$manifest.verifiedInstallers = @($manifest.verifiedInstallers) + @([ordered]@{- app = $Appname = [System.IO.Path]::GetFileName($installer)sha256 = Get-Sha256 $installersignerThumbprint = $installerSignature.SignerCertificate.ThumbprintsignerSubject = $installerSignature.SignerCertificate.Subject})Write-Manifest $manifest- Write-Host "Verified the $App installer's Authenticode and signed payload hashes."+ Write-Host "Verified installer Authenticode and signed payload hashes."}finally {if (Test-Path -LiteralPath $extractRoot) {@@ -290,7 +198,5 @@ function Verify-Installer {switch ($Operation) {"Stage" { Stage-Payload }"Restore" { Restore-Payload }- "StageInstallers" { Stage-Installers }- "RestoreInstallers" { Restore-Installers }"VerifyInstaller" { Verify-Installer }}