Description of the build process for WvdS FPC RAD Studio.
┌─────────────────────────────────────────────────────────────┐ │ BUILD PIPELINE │ ├─────────────────────────────────────────────────────────────┤ │ │ │ 1. PRE-BUILD │ │ ├── Policy-Check (wvds-lint) │ │ ├── Dependency Resolution │ │ └── Asset Preparation │ │ │ │ 2. COMPILE │ │ ├── pas2js / FPC invocation │ │ ├── Unit Resolution │ │ └── Code Generation │ │ │ │ 3. POST-BUILD │ │ ├── Bundle Assets │ │ ├── Generate Source Maps │ │ └── Copy to dist/ │ │ │ │ 4. PACKAGE (optional) │ │ ├── VSIX Creation │ │ └── Version Stamping │ │ │ └─────────────────────────────────────────────────────────────┘
wvds-lint policy --path sources/
Checks:
Dependencies are resolved from build.cfg and package.json:
# build.cfg [build] compiler=pas2js entry=extension_main.pas [dependencies] core=../../common/core vscode=../../common/web/vscode
pas2js \ -Jc \ # Compact output -Jirtl.js \ # RTL as external module -Jm \ # Generate Source Maps -Tbrowser \ # Target: Browser -Fu../../common \ # Unit paths -FE./dist \ # Output directory pas/extension_main.pas # Entry Point
fpc \ -Mobjfpc \ # Object Pascal Mode -Sh \ # Ansi Strings -O3 \ # Optimization Level 3 -Fu../../common \ # Unit paths -FE./bin \ # Output directory project.lpr # Project file
| Option | pas2js | FPC | Description |
|---|---|---|---|
| Debug | -Jc -Jm | -g -O0 | Debug symbols, no optimization |
| Release | -Jc -O3 | -O3 -Xs | Optimized, no symbols |
| Profile | -Jc -Jm | -g -O2 -pg | Profiling instrumentation |
Resources are copied to dist/:
dist/
├── extension_main.js # Compiled code
├── extension_main.js.map # Source Map
└── assets/ # Copied resources
├── templates/*.html
└── images/*.png
Source Maps enable debugging of Pascal code:
// extension_main.js.map
{
"version": 3,
"sources": ["../pas/extension_main.pas"],
"mappings": "..."
}
vsce package --out binaries/dist/
Produces: wvds-vscode-{name}-{version}.vsix
The version is read from package.json and embedded in the build:
const VERSION = {$I version.inc}; // Generated from package.json
| Mode | Usage | Optimization | Symbols |
|---|---|---|---|
| debug | Development | None | Yes |
| release | Production | Maximum | No |
| profile | Performance analysis | Medium | Yes + Profiling |
The build uses caching for faster compilation:
binaries/cache/ contains compiled units (.ppu, .o)wvds-build clean clears the cacheThe build toolchain consists of two main tools:
Compiles PXAML files for a specific target:
pxamlc compile \ --target <tui|desktop|web> \ --pxaml <file.pxaml> \ --packs ~/packs \ --out ~/binaries/out/<app>/<target>
| Option | Description |
|---|---|
--target | Target platform: tui, desktop, web |
--pxaml | Input PXAML file |
--packs | Path to pack registry |
--out | Output directory |
Orchestrates the entire build process:
wvds-build build <tui|desktop|web> \ --app ~/sources/applications/<app> \ --config ~/.wvds/wvds-build.json \ --out ~/binaries/out
| Option | Description |
|---|---|
--app | Application directory |
--config | Configuration file |
--out | Output directory |
# Delete all build artifacts wvds-build clean # Install pack wvds-build pack install --from <packdir> --to ~/vendor-packs --enable tui,web # Uninstall pack wvds-build pack uninstall --vendor <vendor> --pack <pack> # List installed packs wvds-build pack list
Path: ~/.wvds/wvds-build.json
{ "compilers": { "fpc": "%LAZARUS%/fpc/3.3.1/bin/fpc.exe", "pas2js": "%LAZARUS%/fpc/3.3.1/bin/pas2js.exe" }, "paths": { "packs": "~/packs", "common": "~/sources/common", "output": "~/binaries/out" }, "defaults": { "target": "web", "mode": "debug" }, "targets": { "tui": { "compiler": "fpc", "enabled": true }, "desktop": { "compiler": "fpc", "enabled": true }, "web": { "compiler": "pas2js", "enabled": true } } }
Tasks are automatically generated:
// .vscode/tasks.json (generated) { "version": "2.0.0", "tasks": [ { "label": "WVDS: Build TUI", "type": "shell", "command": "${workspaceFolder}/.wvds/bin/wvds-build", "args": ["build", "tui"] }, { "label": "WVDS: Build Desktop", "type": "shell", "command": "${workspaceFolder}/.wvds/bin/wvds-build", "args": ["build", "desktop"] }, { "label": "WVDS: Build Web", "type": "shell", "command": "${workspaceFolder}/.wvds/bin/wvds-build", "args": ["build", "web"] } ] }
wvds-build.
# .github/workflows/build.yml build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install FPC run: sudo apt-get install fpc - name: Install pas2js run: sudo apt-get install pas2js - name: Build run: wvds-build --mode release - name: Package run: wvds-build package