diff --git a/dev/macos/README.md b/dev/macos/README.md index aa796c79..20336368 100644 --- a/dev/macos/README.md +++ b/dev/macos/README.md @@ -2,10 +2,18 @@ ## Quick Start +### Setup and build ```bash dev/macos/setup.sh # First time: install dependencies dev/macos/build.sh # Build -dev/macos/run.sh # Run +``` +### Run the application +```bash +dev/macos/run.sh +``` +### Run the unit tests +```bash +dev/macos/test.sh ``` ## Prerequisites @@ -31,6 +39,7 @@ dev/macos/run.sh # Run - `build.sh` - Configure and build - `bundle.sh` - Create DMG for distribution - `run.sh` - Run the built app (passes arguments through) +- `test.sh` - Run unit tests (sets up Qt/mpv in PATH) - `common.sh` - Shared variables (sourced by other scripts) ## Clean Build diff --git a/dev/macos/common.sh b/dev/macos/common.sh index 68ed263d..cc4a22af 100755 --- a/dev/macos/common.sh +++ b/dev/macos/common.sh @@ -9,3 +9,18 @@ PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" DEPS_DIR="${SCRIPT_DIR}/deps" BUILD_DIR="${PROJECT_ROOT}/build" APP_NAME="Jellyfin Desktop.app" + +# Setup runtime environment for Qt libs from aqt installation (unbundled dev build). +# Call from run.sh / test.sh after sourcing this file. +setup_runtime() { + QTROOT="${DEPS_DIR}/qt/${QT_VERSION}/macos" + + if [ ! -d "${BUILD_DIR}" ]; then + echo "error: Build not found. Run build.sh first" >&2 + exit 1 + fi + + export DYLD_FRAMEWORK_PATH="${QTROOT}/lib" + export QT_PLUGIN_PATH="${QTROOT}/plugins" + export QML_IMPORT_PATH="${QTROOT}/qml" +} diff --git a/dev/macos/run.sh b/dev/macos/run.sh index 06d02861..3621aac6 100755 --- a/dev/macos/run.sh +++ b/dev/macos/run.sh @@ -5,18 +5,13 @@ set -eu SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)" . "${SCRIPT_DIR}/common.sh" +setup_runtime -QTROOT="${DEPS_DIR}/qt/${QT_VERSION}/macos" APP_PATH="${BUILD_DIR}/src/${APP_NAME}" -# Check build exists if [ ! -d "${APP_PATH}" ]; then - echo "error: Build not found. Run build.sh first" >&2 + echo "error: App bundle not found at ${APP_PATH}" >&2 exit 1 fi -# Run with Qt libs from aqt installation (unbundled dev build) -export DYLD_FRAMEWORK_PATH="${QTROOT}/lib" -export QT_PLUGIN_PATH="${QTROOT}/plugins" -export QML_IMPORT_PATH="${QTROOT}/qml" -exec "${APP_PATH}/Contents/MacOS/Jellyfin Desktop" "${@}" +exec "${APP_PATH}/Contents/MacOS/Jellyfin Desktop" ${1+"$@"} diff --git a/dev/macos/test.sh b/dev/macos/test.sh new file mode 100755 index 00000000..6ad6264f --- /dev/null +++ b/dev/macos/test.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh +# Jellyfin Desktop - Run unit tests +# Run build.sh first +set -eu + +SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)" +. "${SCRIPT_DIR}/common.sh" +setup_runtime + +cd "${BUILD_DIR}" +ctest --output-on-failure "$@" diff --git a/dev/windows/README.md b/dev/windows/README.md index 862b215d..816e4d47 100644 --- a/dev/windows/README.md +++ b/dev/windows/README.md @@ -2,10 +2,18 @@ ## Quick Start +### Setup and build ```cmd dev\windows\setup.bat # First time: download dependencies dev\windows\build.bat # Build -dev\windows\run.bat # Run +``` +### Run the application +```cmd +dev\windows\run.bat +``` +### Run the unit tests +```cmd +dev\windows\test.bat ``` ## Prerequisites @@ -31,6 +39,7 @@ dev\windows\run.bat # Run - `build.bat` - Configure and build - `bundle.bat` - Create installer and portable ZIP - `run.bat` - Run executable (sets up Qt/mpv in PATH) +- `test.bat` - Run unit tests (sets up Qt/mpv in PATH) - `common.bat` - Shared variables (sourced by other scripts) ## Clean Build diff --git a/dev/windows/common.bat b/dev/windows/common.bat index a7bcf56c..8d511b7a 100644 --- a/dev/windows/common.bat +++ b/dev/windows/common.bat @@ -24,3 +24,17 @@ if not defined VCVARS if exist "%VS_CM%" set "VCVARS=%VS_CM%" if not defined VCVARS if exist "%VS_PR%" set "VCVARS=%VS_PR%" if not defined VCVARS if exist "%VS_EN%" set "VCVARS=%VS_EN%" if not defined VCVARS if exist "%VS_BT86%" set "VCVARS=%VS_BT86%" + +if "%~1"=="" goto :eof +goto %~1 + +REM === Setup runtime PATH for DLLs === +REM Call with: call "%~dp0common.bat" :setup_runtime +:setup_runtime +if not exist "%BUILD_DIR%" ( + echo ERROR: Build not found. Run build.bat first + exit /b 1 +) +set "PATH=%DEPS_DIR%\mpv;%PATH%" +set "PATH=%DEPS_DIR%\qt\%QT_VERSION%\msvc2022_64\bin;%PATH%" +goto :eof diff --git a/dev/windows/run.bat b/dev/windows/run.bat index e7b0011d..210d4896 100644 --- a/dev/windows/run.bat +++ b/dev/windows/run.bat @@ -4,16 +4,7 @@ REM Run build.bat first setlocal call "%~dp0common.bat" - -REM === Check build exists === -if not exist "%BUILD_DIR%\src\%EXE_NAME%" ( - echo ERROR: Build not found. Run build.bat first - exit /b 1 -) - -REM === Setup PATH for DLLs === -set "PATH=%DEPS_DIR%\mpv;%PATH%" -set "PATH=%DEPS_DIR%\qt\%QT_VERSION%\msvc2022_64\bin;%PATH%" +call "%~dp0common.bat" :setup_runtime || exit /b 1 REM === Run === "%BUILD_DIR%\src\%EXE_NAME%" %* diff --git a/dev/windows/test.bat b/dev/windows/test.bat new file mode 100644 index 00000000..d37e306f --- /dev/null +++ b/dev/windows/test.bat @@ -0,0 +1,14 @@ +@echo off +REM Jellyfin Desktop - Run unit tests +REM Run build.bat first + +setlocal +call "%~dp0common.bat" +call "%~dp0common.bat" :setup_runtime || exit /b 1 + +REM === Run tests === +cd /d "%BUILD_DIR%" +ctest --output-on-failure %* +set EXIT_CODE=%ERRORLEVEL% + +endlocal & exit /b %EXIT_CODE%