A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.
C++
chore(build): add automation scripts for build, vcpkg setup, and packaging on Windows
philau2512f762fa1f2358
diff --git a/.gitignore b/.gitignoreindex bb2584b..f3bb875 100644--- a/.gitignore+++ b/.gitignore@@ -107,4 +107,6 @@ windows/vendor/webview2/windows/Gridex/GridexVersion.generated.hdist.wangler-.env.example\ No newline at end of file+.env.example++.tgrep/diff --git a/build-win.bat b/build-win.batnew file mode 100644index 0000000..a5c9964--- /dev/null+++ b/build-win.bat@@ -0,0 +1,36 @@+@echo off+setlocal++set "SCRIPT_DIR=%~dp0"+set "VERSION=%~1"+set "EXE_PATH=%SCRIPT_DIR%windows\Gridex\x64\Release\Gridex\Gridex.exe"+if not exist "%EXE_PATH%" set "EXE_PATH=%SCRIPT_DIR%windows\x64\Release\Gridex\Gridex.exe"++echo ========================================================+echo Building Gridex (Windows x64 Unpackaged)+echo ========================================================++if "%VERSION%"=="" (+ powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%windows\scripts\build-unpackaged.ps1"+) else (+ powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%windows\scripts\build-unpackaged.ps1" -Version "%VERSION%"+)++if %ERRORLEVEL% NEQ 0 (+ echo.+ echo [ERROR] Build failed with error code %ERRORLEVEL%!+ pause+ exit /b %ERRORLEVEL%+)++echo.+echo ========================================================+echo [SUCCESS] Build completed!+echo Output: %EXE_PATH%+echo ========================================================+echo.++if not "%2"=="--no-pause" (+ echo Press any key to exit...+ pause >nul+)diff --git a/build-win.sh b/build-win.shnew file mode 100644index 0000000..c2e83d9--- /dev/null+++ b/build-win.sh@@ -0,0 +1,47 @@+#!/usr/bin/env bash+# Quick build script for Gridex on Windows+# Usage:+# ./build-win.sh # Build dev version+# ./build-win.sh 0.1.13 # Build with specific version+# ./build-win.sh --run # Build and run Gridex.exe immediately++set -e++SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+VERSION=""+RUN_APP=false++for arg in "$@"; do+ if [ "$arg" == "--run" ] || [ "$arg" == "-r" ]; then+ RUN_APP=true+ else+ VERSION="$arg"+ fi+done++echo "==> Building Gridex (Windows x64 Unpackaged)..."+if [ -n "$VERSION" ]; then+ powershell -NoProfile -ExecutionPolicy Bypass -File "$SCRIPT_DIR/windows/scripts/build-unpackaged.ps1" -Version "$VERSION"+else+ powershell -NoProfile -ExecutionPolicy Bypass -File "$SCRIPT_DIR/windows/scripts/build-unpackaged.ps1"+fi++EXE_PATH="$SCRIPT_DIR/windows/Gridex/x64/Release/Gridex/Gridex.exe"+if [ ! -f "$EXE_PATH" ]; then+ EXE_PATH="$SCRIPT_DIR/windows/x64/Release/Gridex/Gridex.exe"+fi++if [ -f "$EXE_PATH" ]; then+ echo ""+ echo "========================================================"+ echo " [SUCCESS] Gridex.exe built successfully!"+ echo " Location: $EXE_PATH"+ echo "========================================================"+ if [ "$RUN_APP" = true ]; then+ echo "==> Launching Gridex.exe..."+ "$EXE_PATH" &+ fi+else+ echo "[ERROR] Gridex.exe not found at expected path: $EXE_PATH"+ exit 1+fidiff --git a/pack-win.bat b/pack-win.batnew file mode 100644index 0000000..632d018--- /dev/null+++ b/pack-win.bat@@ -0,0 +1,31 @@+@echo off+setlocal++set "SCRIPT_DIR=%~dp0"+set "VERSION=%~1"+if "%VERSION%"=="" set "VERSION=0.1.0"+set "CHANNEL=%~2"+if "%CHANNEL%"=="" set "CHANNEL=stable"++echo ========================================================+echo Packaging Gridex Installer (v%VERSION% - %CHANNEL%)+echo ========================================================++powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%windows\scripts\build-and-pack.ps1" -Version "%VERSION%" -Channel "%CHANNEL%"++if %ERRORLEVEL% NEQ 0 (+ echo.+ echo [ERROR] Packaging failed with error code %ERRORLEVEL%!+ pause+ exit /b %ERRORLEVEL%+)++echo.+echo ========================================================+echo [SUCCESS] Full installer created successfully!+echo Artifacts located at: %SCRIPT_DIR%windows\Releases\+echo - Installer: Gridex-%CHANNEL%-Setup.exe+echo - Portable: Gridex-%CHANNEL%-Portable.zip+echo ========================================================+echo.+pausediff --git a/pack-win.sh b/pack-win.shnew file mode 100644index 0000000..b40eea0--- /dev/null+++ b/pack-win.sh@@ -0,0 +1,33 @@+#!/usr/bin/env bash+# Pack full Gridex Windows Release (Setup.exe + Portable.zip + Velopack feeds)+# Usage:+# ./pack-win.sh # Pack with default version 0.1.0+# ./pack-win.sh 0.1.13 # Pack with specific version++set -e++SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+VERSION="${1:-0.1.0}"+CHANNEL="${2:-stable}"++echo "========================================================"+echo " Packaging Gridex Installer (v$VERSION - $CHANNEL)"+echo "========================================================"++powershell -NoProfile -ExecutionPolicy Bypass -File "$SCRIPT_DIR/windows/scripts/build-and-pack.ps1" -Version "$VERSION" -Channel "$CHANNEL"++OUTPUT_DIR="$SCRIPT_DIR/windows/Releases"+SETUP_EXE="$OUTPUT_DIR/Gridex-$CHANNEL-Setup.exe"++if [ -f "$SETUP_EXE" ]; then+ echo ""+ echo "========================================================"+ echo " [SUCCESS] Full installer created successfully!"+ echo " Artifacts located at: $OUTPUT_DIR"+ echo " - Installer: Gridex-$CHANNEL-Setup.exe"+ echo " - Portable: Gridex-$CHANNEL-Portable.zip"+ echo "========================================================"+else+ echo "[ERROR] Setup.exe not found at: $SETUP_EXE"+ exit 1+fidiff --git a/setup-vcpkg.bat b/setup-vcpkg.batnew file mode 100644index 0000000..34e7b2f--- /dev/null+++ b/setup-vcpkg.bat@@ -0,0 +1,48 @@+@echo off+setlocal enabledelayedexpansion++echo ========================================================+echo Setup vcpkg and dependencies for Gridex+echo ========================================================++if not exist "C:\vcpkg" (+ echo [1/3] Cloning vcpkg to C:\vcpkg...+ git clone https://github.com/microsoft/vcpkg.git C:\vcpkg+ if %ERRORLEVEL% NEQ 0 (+ echo [ERROR] Failed to clone vcpkg. Please check your internet connection or git installation.+ pause+ exit /b %ERRORLEVEL%+ )+) else (+ echo [1/3] C:\vcpkg already exists.+)++if not exist "C:\vcpkg\vcpkg.exe" (+ echo [2/3] Bootstrapping vcpkg...+ call C:\vcpkg\bootstrap-vcpkg.bat+ if %ERRORLEVEL% NEQ 0 (+ echo [ERROR] Failed to bootstrap vcpkg.+ pause+ exit /b %ERRORLEVEL%+ )+) else (+ echo [2/3] vcpkg.exe is ready.+)++echo [3/3] Installing required libraries (sqlite3, libpq, libmariadb, openssl, etc.)...+echo This may take a few minutes...+C:\vcpkg\vcpkg.exe install sqlite3 libpq libmariadb openssl hiredis libssh2 nlohmann-json cpp-httplib mongo-cxx-driver --triplet x64-windows++if %ERRORLEVEL% NEQ 0 (+ echo.+ echo [ERROR] vcpkg package installation failed!+ pause+ exit /b %ERRORLEVEL%+)++echo.+echo ========================================================+echo [SUCCESS] All vcpkg dependencies installed successfully!+echo You can now run 'build-win' or './build-win.sh'+echo ========================================================+pausediff --git a/setup-vcpkg.sh b/setup-vcpkg.shnew file mode 100644index 0000000..da5b3bd--- /dev/null+++ b/setup-vcpkg.sh@@ -0,0 +1,32 @@+#!/usr/bin/env bash+# Automated vcpkg setup script for Git Bash++set -e++echo "========================================================"+echo " Setup vcpkg and dependencies for Gridex"+echo "========================================================"++if [ ! -d "/c/vcpkg" ]; then+ echo "[1/3] Cloning vcpkg to C:/vcpkg..."+ git clone https://github.com/microsoft/vcpkg.git /c/vcpkg+else+ echo "[1/3] C:/vcpkg already exists."+fi++if [ ! -f "/c/vcpkg/vcpkg.exe" ]; then+ echo "[2/3] Bootstrapping vcpkg..."+ cmd.exe /c "C:\\vcpkg\\bootstrap-vcpkg.bat"+else+ echo "[2/3] vcpkg.exe is ready."+fi++echo "[3/3] Installing required libraries (sqlite3, libpq, libmariadb, openssl, etc.)..."+echo "This may take a few minutes..."+/c/vcpkg/vcpkg.exe install sqlite3 libpq libmariadb openssl hiredis libssh2 nlohmann-json cpp-httplib mongo-cxx-driver --triplet x64-windows++echo ""+echo "========================================================"+echo " [SUCCESS] All vcpkg dependencies installed successfully!"+echo " You can now run './build-win.sh'"+echo "========================================================"diff --git a/windows/scripts/install-vpk-tool.ps1 b/windows/scripts/install-vpk-tool.ps1index 7f8d3c5..f9a3036 100644--- a/windows/scripts/install-vpk-tool.ps1+++ b/windows/scripts/install-vpk-tool.ps1@@ -22,24 +22,53 @@ if (-not $dotnet) {throw "dotnet SDK not found on PATH. Install .NET 8 SDK from https://dot.net/download"}+# Ensure %USERPROFILE%\.dotnet\tools is on PATH for the current session+$dotnetToolsDir = Join-Path $env:USERPROFILE ".dotnet\tools"+if (Test-Path $dotnetToolsDir) {+ if ($env:PATH -notlike "*$dotnetToolsDir*") {+ $env:PATH = "$dotnetToolsDir;$env:PATH"+ }+}+Write-Host "Installing/upgrading vpk global tool..." -ForegroundColor Cyan-# Try install first; if already installed, fall back to update.-& dotnet tool install --global vpk --version "0.0.*" 2>$null-if ($LASTEXITCODE -ne 0) {- Write-Host "vpk already installed -- running update instead." -ForegroundColor Yellow- & dotnet tool update --global vpk --version "0.0.*"- if ($LASTEXITCODE -ne 0) { throw "vpk install/update failed" }+# Temporarily relax ErrorActionPreference so native stderr doesn't trigger NativeCommandError in PowerShell 5.1+$prevEap = $ErrorActionPreference+$ErrorActionPreference = "Continue"++try {+ $toolList = & dotnet tool list --global 2>&1 | Out-String+ if ($toolList -match "(?m)^\s*vpk\b") {+ Write-Host "vpk already installed -- running update..." -ForegroundColor Cyan+ & dotnet tool update --global vpk --version "0.0.*"+ } else {+ & dotnet tool install --global vpk --version "0.0.*"+ }+} finally {+ $ErrorActionPreference = $prevEap+}++# Re-ensure %USERPROFILE%\.dotnet\tools is on PATH in case it was just created+if (Test-Path $dotnetToolsDir) {+ if ($env:PATH -notlike "*$dotnetToolsDir*") {+ $env:PATH = "$dotnetToolsDir;$env:PATH"+ }}# Verify the binary is on PATH (dotnet global tools live in %USERPROFILE%\.dotnet\tools)$vpk = Get-Command vpk -ErrorAction SilentlyContinueif (-not $vpk) {- throw "vpk installed but not on PATH. Add %USERPROFILE%\.dotnet\tools to PATH and re-run."+ throw "vpk installed but not on PATH. Add $dotnetToolsDir to PATH and re-run."}# vpk has no --version flag; the first line of --help contains the version.-$help = & vpk --help 2>&1+$prevEap = $ErrorActionPreference+$ErrorActionPreference = "Continue"+try {+ $help = & vpk --help 2>&1+} finally {+ $ErrorActionPreference = $prevEap+}$verLine = $help | Select-String -Pattern "Velopack CLI" | Select-Object -First 1if ($verLine) {Write-Host "vpk: $verLine" -ForegroundColor Greendiff --git a/windows/scripts/pack-velopack.ps1 b/windows/scripts/pack-velopack.ps1index 068699b..5a92431 100644--- a/windows/scripts/pack-velopack.ps1+++ b/windows/scripts/pack-velopack.ps1@@ -57,6 +57,14 @@ $ErrorActionPreference = "Stop"# vpk 0.0.1298 targets net9.0; allow running on any newer .NET runtime.$env:DOTNET_ROLL_FORWARD = "Major"+# Ensure %USERPROFILE%\.dotnet\tools is on PATH for the current session+$dotnetToolsDir = Join-Path $env:USERPROFILE ".dotnet\tools"+if (Test-Path $dotnetToolsDir) {+ if ($env:PATH -notlike "*$dotnetToolsDir*") {+ $env:PATH = "$dotnetToolsDir;$env:PATH"+ }+}+$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")# vpk's --packDir / --outputDir resolve relative to CWD; pin CWD to repo root