Add Taskfile for unified dev workflow across all components (#6080)

## Add Taskfile for unified dev workflow

### Summary
- Introduces [Taskfile](https://taskfile.dev/) as the single CLI entry
point for all development workflows across backend, frontend, engine,
Docker, and desktop
- ~80 tasks organized into 6 namespaces: `backend:`, `frontend:`,
`engine:`, `docker:`, `desktop:`, plus root-level composites
- All CI workflows migrated to use Task
- Deletes `engine/Makefile` and `scripts/build-tauri-jlink.{sh,bat}` —
replaced by Task equivalents
- Removes redundant npm scripts (`dev`, `build`, `prep`, `lint`, `test`,
`typecheck:all`) from `package.json`
- Smart dependency caching: `sources`/`status`/`generates`
fingerprinting, CI-aware `npm ci` vs `npm install`, `run: once` for
parallel dep deduplication

### What this does NOT do
- Does not replace Gradle, npm, or Docker — Taskfile is a thin
orchestration wrapper
- Does not change application code or behavior

### Install
```
npm install -g @go-task/cli    # or: brew install go-task, winget install Task.Task
```

### Quick start
```
task --list       # discover all tasks
task install      # install all deps
task dev          # start backend + frontend
task dev:all      # also start AI engine
task test         # run all tests
task check        # quick quality gate (local dev)
task check:all    # full CI quality gate
```

### Test plan
- [ ] Install `task` CLI and run `task --list` — verify all tasks
display
- [ ] Run `task install` — verify frontend + engine deps install
- [ ] Run `task dev` — verify backend + frontend start, Ctrl+C exits
cleanly
- [ ] Run `task frontend:check` — verify typecheck + lint + test pass
- [ ] Run `task desktop:dev` — verify jlink builds are cached on second
run
- [ ] Verify CI passes on all workflows

---------

Co-authored-by: James Brunton <jbrunton96@gmail.com>
This commit is contained in:
ConnorYoh
2026-04-15 15:16:57 +01:00
committed by GitHub
parent 4cf797ab75
commit 702f4e5c2c
39 changed files with 1172 additions and 1302 deletions

View File

@@ -1,176 +0,0 @@
@echo off
REM Build script for Tauri with JLink runtime bundling
REM This script creates a self-contained Java runtime for Stirling-PDF
echo 🔧 Building Stirling-PDF with JLink runtime for Tauri...
echo ▶ Checking Java environment...
java -version >nul 2>&1
if errorlevel 1 (
echo ❌ Java is not installed or not in PATH
exit /b 1
)
jlink --version >nul 2>&1
if errorlevel 1 (
echo ❌ jlink is not available. Please ensure you have a JDK ^(not just JRE^) installed.
exit /b 1
)
echo ▶ Checking Java version...
set "JAVA_VERSION_STRING="
for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
set "JAVA_VERSION_STRING=%%g"
)
if not defined JAVA_VERSION_STRING (
echo ❌ Unable to capture Java version string from "java -version"
exit /b 1
)
set "JAVA_VERSION_STRING=%JAVA_VERSION_STRING:"=%"
set "JAVA_MAJOR_VERSION="
set "JAVA_MINOR_VERSION=0"
set "JAVA_EFFECTIVE_MAJOR="
for /f "tokens=1,2 delims=." %%a in ("%JAVA_VERSION_STRING%") do (
set "JAVA_MAJOR_VERSION=%%a"
set "JAVA_MINOR_VERSION=%%b"
if "%%a"=="1" (
set "JAVA_EFFECTIVE_MAJOR=%%b"
) else (
set "JAVA_EFFECTIVE_MAJOR=%%a"
)
)
if not defined JAVA_MAJOR_VERSION (
echo ❌ Unable to determine Java major version from "%JAVA_VERSION_STRING%"
exit /b 1
)
if not defined JAVA_EFFECTIVE_MAJOR (
echo ❌ Unable to determine an effective Java major version from "%JAVA_VERSION_STRING%"
exit /b 1
)
for /f "tokens=1 delims=.-" %%c in ("%JAVA_EFFECTIVE_MAJOR%") do set "JAVA_EFFECTIVE_MAJOR=%%c"
set /a "JAVA_EFFECTIVE_MAJOR_NUM=%JAVA_EFFECTIVE_MAJOR%" >nul 2>&1
if errorlevel 1 (
echo ❌ Java major version "%JAVA_EFFECTIVE_MAJOR%" could not be parsed as an integer. Detected string: "%JAVA_VERSION_STRING%"
exit /b 1
)
set "JAVA_EFFECTIVE_MAJOR=%JAVA_EFFECTIVE_MAJOR_NUM%"
if %JAVA_EFFECTIVE_MAJOR% LSS 21 (
echo ❌ Java 21 or higher is required. Found Java %JAVA_EFFECTIVE_MAJOR%
exit /b 1
)
echo ✅ Java %JAVA_EFFECTIVE_MAJOR% and jlink detected
echo ▶ Building Stirling-PDF JAR...
set DISABLE_ADDITIONAL_FEATURES=true
call gradlew.bat clean bootJar --no-daemon
if errorlevel 1 (
echo ❌ Failed to build Stirling-PDF JAR
exit /b 1
)
REM Find the built JAR(s)
echo ▶ Listing all built JAR files in app\core\build\libs:
dir /b app\core\build\libs\stirling-pdf-*.jar
for %%f in (app\core\build\libs\stirling-pdf-*.jar) do set STIRLING_JAR=%%f
if not exist "%STIRLING_JAR%" (
echo ❌ No Stirling-PDF JAR found in build/libs/
exit /b 1
)
echo ✅ Built JAR: %STIRLING_JAR%
echo ▶ Creating Tauri directories...
if not exist "frontend\src-tauri\libs" mkdir "frontend\src-tauri\libs"
if not exist "frontend\src-tauri\runtime" mkdir "frontend\src-tauri\runtime"
echo ▶ Copying JAR to Tauri libs directory...
copy "%STIRLING_JAR%" "frontend\src-tauri\libs\"
echo ✅ JAR copied to frontend\src-tauri\libs\
REM Log out all JAR files now in the Tauri libs directory
echo ▶ Listing all JAR files in frontend\src-tauri\libs after copy:
dir /b frontend\src-tauri\libs\stirling-pdf-*.jar
echo ▶ Creating custom JRE with jlink...
if exist "frontend\src-tauri\runtime\jre" rmdir /s /q "frontend\src-tauri\runtime\jre"
REM Use predefined module list for Windows (jdeps may not be available)
set MODULES=java.base,java.compiler,java.desktop,java.instrument,java.logging,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml,java.xml.crypto,jdk.crypto.ec,jdk.crypto.cryptoki,jdk.unsupported
echo ▶ Creating JLink runtime with modules: %MODULES%
jlink ^
--add-modules %MODULES% ^
--strip-debug ^
--compress=2 ^
--no-header-files ^
--no-man-pages ^
--output "frontend\src-tauri\runtime\jre"
if not exist "frontend\src-tauri\runtime\jre" (
echo ❌ Failed to create JLink runtime
exit /b 1
)
echo ✅ JLink runtime created at frontend\src-tauri\runtime\jre
echo ▶ Creating launcher scripts for testing...
REM Create Windows launcher script
echo @echo off > "frontend\src-tauri\runtime\launch-stirling.bat"
echo REM Launcher script for Stirling-PDF with bundled JRE >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo. >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo set SCRIPT_DIR=%%~dp0 >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo set JRE_DIR=%%SCRIPT_DIR%%jre >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo set LIBS_DIR=%%SCRIPT_DIR%%..\libs >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo. >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo REM Find the Stirling-PDF JAR >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo for %%%%f in ("%%LIBS_DIR%%\Stirling-PDF-*.jar") do set STIRLING_JAR=%%%%f >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo. >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo if not exist "%%STIRLING_JAR%%" ^( >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo echo ❌ Stirling-PDF JAR not found in %%LIBS_DIR%% >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo exit /b 1 >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo ^) >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo. >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo REM Launch with bundled JRE >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo "%%JRE_DIR%%\bin\java.exe" ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo -Xmx2g ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo -DBROWSER_OPEN=true ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo -jar "%%STIRLING_JAR%%" ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo %%* >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo ✅ Created launcher scripts for testing
echo ▶ Testing bundled JRE...
"frontend\src-tauri\runtime\jre\bin\java.exe" --version >nul 2>&1
if errorlevel 1 (
echo ❌ Bundled JRE test failed
exit /b 1
) else (
echo ✅ Bundled JRE works correctly
)
echo.
echo ✅ 🎉 JLink build setup completed successfully!
echo.
echo 📊 Summary:
echo • JAR: %STIRLING_JAR%
echo • Runtime: frontend\src-tauri\runtime\jre
echo • Modules: %MODULES%
echo.
echo 📋 Next steps:
echo 1. cd frontend
echo 2. npm run tauri-build
echo.
echo 💡 Testing:
echo • Test bundled runtime: frontend\src-tauri\runtime\launch-stirling.bat
echo • Tauri configuration already updated to include bundled JRE
echo.
echo 💡 Benefits:
echo • No external JRE dependency
echo • Smaller distribution size with custom runtime
echo • Better security with minimal required modules
echo • Consistent Java version across all deployments
echo.
echo ✅ The application will now run without requiring users to install Java!

View File

@@ -1,229 +0,0 @@
#!/bin/bash
# Build script for Tauri with JLink runtime bundling
# This script creates a self-contained Java runtime for Stirling-PDF
set -e
echo "🔧 Building Stirling-PDF with JLink runtime for Tauri..."
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_step() {
echo -e "${BLUE}$1${NC}"
}
print_success() {
echo -e "${GREEN}$1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}$1${NC}"
}
# Check if Java is installed and version
print_step "Checking Java environment..."
if ! command -v java &> /dev/null; then
print_error "Java is not installed or not in PATH"
exit 1
fi
if ! command -v jlink &> /dev/null; then
print_error "jlink is not available. Please ensure you have a JDK (not just JRE) installed."
exit 1
fi
JAVA_VERSION=$(java -version 2>&1 | head -n 1 | cut -d'"' -f2 | cut -d'.' -f1)
if [ "$JAVA_VERSION" -lt 21 ]; then
print_error "Java 21 or higher is required. Found Java $JAVA_VERSION"
exit 1
fi
print_success "Java $JAVA_VERSION detected with jlink support"
# Check if jpackage is available (Java 14+)
if command -v jpackage &> /dev/null; then
print_success "jpackage is available for native packaging"
else
print_warning "jpackage is not available - using jlink only"
fi
# Clean and build the Stirling-PDF JAR
print_step "Building Stirling-PDF JAR..."
export DISABLE_ADDITIONAL_FEATURES=true
./gradlew clean bootJar --no-daemon
if [ ! -f compgen -G "app/core/build/libs/stirling-pdf-*.jar" ]; then
print_error "Failed to build stirling-pdf JAR"
exit 1
fi
# Find the built JAR
STIRLING_JAR=$(ls app/core/build/libs/stirling-pdf-*.jar | head -n 1)
print_success "Built JAR: $STIRLING_JAR"
# Create directories for Tauri
TAURI_SRC_DIR="frontend/src-tauri"
TAURI_LIBS_DIR="$TAURI_SRC_DIR/libs"
TAURI_RUNTIME_DIR="$TAURI_SRC_DIR/runtime"
print_step "Creating Tauri directories..."
mkdir -p "$TAURI_LIBS_DIR"
mkdir -p "$TAURI_RUNTIME_DIR"
# Copy the JAR to Tauri libs directory
print_step "Copying JAR to Tauri libs directory..."
cp "$STIRLING_JAR" "$TAURI_LIBS_DIR/"
print_success "JAR copied to $TAURI_LIBS_DIR/"
# Create a custom JRE using jlink
print_step "Creating custom JRE with jlink..."
# Determine modules needed by analyzing the JAR
print_step "Analyzing JAR dependencies..."
# Use jdeps to analyze module dependencies if available
if command -v jdeps &> /dev/null; then
print_step "Running jdeps analysis..."
REQUIRED_MODULES=$(jdeps --print-module-deps --ignore-missing-deps "$STIRLING_JAR" 2>/dev/null || echo "")
if [ -n "$REQUIRED_MODULES" ]; then
print_success "jdeps detected modules: $REQUIRED_MODULES"
# Add additional modules we know Stirling-PDF needs
MODULES="$REQUIRED_MODULES,java.compiler,java.instrument,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml.crypto,jdk.crypto.ec,jdk.crypto.cryptoki,jdk.unsupported"
else
print_warning "jdeps analysis failed, using predefined module list"
MODULES="java.base,java.compiler,java.desktop,java.instrument,java.logging,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml,java.xml.crypto,jdk.crypto.ec,jdk.crypto.cryptoki,jdk.unsupported"
fi
else
print_warning "jdeps not available, using predefined module list"
MODULES="java.base,java.compiler,java.desktop,java.instrument,java.logging,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml,java.xml.crypto,jdk.crypto.ec,jdk.crypto.cryptoki,jdk.unsupported"
fi
print_step "Creating JLink runtime with modules: $MODULES"
# Remove existing runtime if present
rm -rf "$TAURI_RUNTIME_DIR/jre"
# Create the custom JRE
jlink \
--add-modules "$MODULES" \
--strip-debug \
--compress=2 \
--no-header-files \
--no-man-pages \
--output "$TAURI_RUNTIME_DIR/jre"
if [ ! -d "$TAURI_RUNTIME_DIR/jre" ]; then
print_error "Failed to create JLink runtime"
exit 1
fi
print_success "JLink runtime created at $TAURI_RUNTIME_DIR/jre"
# Calculate runtime size
RUNTIME_SIZE=$(du -sh "$TAURI_RUNTIME_DIR/jre" | cut -f1)
print_success "Runtime size: $RUNTIME_SIZE"
# Create launcher scripts for testing
print_step "Creating launcher scripts for testing..."
LAUNCHER_SCRIPT="$TAURI_RUNTIME_DIR/launch-stirling.sh"
cat > "$LAUNCHER_SCRIPT" << 'EOF'
#!/bin/bash
# Launcher script for Stirling-PDF with bundled JRE
# Get the directory of this script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
JRE_DIR="$SCRIPT_DIR/jre"
LIBS_DIR="$(dirname "$SCRIPT_DIR")/libs"
# Find the Stirling-PDF JAR
STIRLING_JAR=$(compgen -G "app/core/build/libs/stirling-pdf-*.jar")
if [ ! -f "$STIRLING_JAR" ]; then
echo "❌ Stirling-PDF JAR not found in $LIBS_DIR"
exit 1
fi
# Launch with bundled JRE
"$JRE_DIR/bin/java" \
-Xmx2g \
-DBROWSER_OPEN=true \
-jar "$STIRLING_JAR" \
"$@"
EOF
chmod +x "$LAUNCHER_SCRIPT"
# Create Windows launcher
LAUNCHER_BAT="$TAURI_RUNTIME_DIR/launch-stirling.bat"
cat > "$LAUNCHER_BAT" << 'EOF'
@echo off
REM Launcher script for Stirling-PDF with bundled JRE
set SCRIPT_DIR=%~dp0
set JRE_DIR=%SCRIPT_DIR%jre
set LIBS_DIR=%SCRIPT_DIR%..\libs
REM Find the Stirling-PDF JAR
for %%f in ("%LIBS_DIR%\Stirling-PDF-*.jar") do set STIRLING_JAR=%%f
if not exist "%STIRLING_JAR%" (
echo ❌ Stirling-PDF JAR not found in %LIBS_DIR%
exit /b 1
)
REM Launch with bundled JRE
"%JRE_DIR%\bin\java.exe" ^
-Xmx2g ^
-DBROWSER_OPEN=true ^
-jar "%STIRLING_JAR%" ^
%*
EOF
print_success "Created launcher scripts for testing"
# Test the bundled runtime
print_step "Testing bundled JRE..."
if [ -f "$TAURI_RUNTIME_DIR/jre/bin/java" ]; then
JAVA_VERSION_OUTPUT=$("$TAURI_RUNTIME_DIR/jre/bin/java" --version 2>&1 | head -n 1)
print_success "Bundled JRE works: $JAVA_VERSION_OUTPUT"
else
print_error "Bundled JRE executable not found"
exit 1
fi
# Display summary
echo ""
print_success "🎉 JLink build setup completed successfully!"
echo ""
echo -e "${BLUE}📊 Summary:${NC}"
echo " • JAR: $STIRLING_JAR"
echo " • Runtime: $TAURI_RUNTIME_DIR/jre ($RUNTIME_SIZE)"
echo " • Modules: $MODULES"
echo ""
echo -e "${BLUE}📋 Next steps:${NC}"
echo " 1. cd frontend"
echo " 2. npm run tauri-build"
echo ""
echo -e "${BLUE}💡 Testing:${NC}"
echo " • Test bundled runtime: $LAUNCHER_SCRIPT"
echo " • Tauri configuration already updated to include bundled JRE"
echo ""
echo -e "${BLUE}💡 Benefits:${NC}"
echo " • No external JRE dependency"
echo " • Smaller distribution size with custom runtime"
echo " • Better security with minimal required modules"
echo " • Consistent Java version across all deployments"
echo ""
print_success "The application will now run without requiring users to install Java!"