wails/v3/Taskfile.yaml
Lea Anthony 8eaed8c5f6
fix(linux): remove Screen typedef collision with X11 Xlib.h (#4979)
* fix(linux): remove unused C Screen typedef that collides with X11 Xlib.h

The GTK4 backend includes <gdk/x11/gdkx.h> for X11 window positioning,
which pulls in <X11/Xlib.h>. Xlib defines its own `Screen` typedef,
conflicting with the identically-named struct in linux_cgo_gtk4.h.

The C Screen struct was unused - the Go code constructs Go Screen structs
directly from GDK monitor data, never referencing C.Screen.

Fixes #4957

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* ci: run GTK4 build and tests on all v3-alpha PRs

The GTK4 CI steps were gated on github.head_ref == 'feature/webkit-gtk6-support',
meaning no other branch ever ran GTK4 compilation checks. This allowed the
Screen typedef collision to slip through undetected.

Now that GTK4 support has been merged, run GTK4 dependency installation,
example builds, and test suite on every PR targeting v3-alpha.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add GTK4 Screen typedef fix to unreleased changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix changelog

* fix changelog

* fix(ci): pass BUILD_TAGS through to go build in test:example:linux

The GTK4 CI step ran BUILD_TAGS=gtk4 task test:examples but the
Taskfile task ignored the env var, always building with no -tags flag.
Use shell parameter expansion so BUILD_TAGS flows through to go build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:44:03 +11:00

455 lines
14 KiB
YAML

# https://taskfile.dev
version: "3"
includes:
generator:
taskfile: ./internal/generator
dir: ./internal/generator
runtime:
taskfile: ./internal/runtime
dir: ./internal/runtime
website:
taskfile: ./website
dir: ./website
optional: true
docs:
taskfile: ../docs
dir: ../docs
optional: true
tasks:
recreate-template-dir:
dir: internal/templates
internal: true
silent: true
cmds:
- rm -rf {{.TEMPLATE_DIR}}
- mkdir -p {{.TEMPLATE_DIR}}
install:
dir: cmd/wails3
silent: true
cmds:
- go install
- echo "Installed wails CLI"
release:
summary: Release a new version of Wails. Call with `task v3:release -- <version>`
dir: tasks/release
cmds:
- go run release.go {{.CLI_ARGS}}
taskfile:upgrade:
cmds:
- go get -u github.com/go-task/task/v3
reinstall-cli:
dir: cmd/wails3
internal: true
silent: true
cmds:
- go install
- echo "Reinstalled wails CLI"
generate:events:
dir: tasks/events
cmds:
- go run generate.go
- go fmt ../../pkg/events/events.go
precommit:
cmds:
- go test ./...
- task: format
# - task: docs:update:api
test:example:darwin:
dir: 'examples/{{.DIR}}'
platforms:
- darwin
cmds:
- echo "Building example {{.DIR}} for Darwin"
- go mod tidy
- go build -o "testbuild-{{.DIR}}-darwin{{exeExt}}"
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
CGO_CFLAGS: -mmacosx-version-min=10.13
test:example:windows:
dir: 'examples/{{.DIR}}'
platforms:
- windows
cmds:
- echo "Building example {{.DIR}} for Windows"
- go mod tidy
- go build -o "testbuild-{{.DIR}}-windows.exe"
env:
GOOS: windows
GOARCH: amd64
test:example:linux:
summary: Build example for Linux (pass BUILD_TAGS env var to add -tags, e.g. BUILD_TAGS=gtk4)
dir: 'examples/{{.DIR}}'
platforms:
- linux
cmds:
- echo "Building example {{.DIR}} for Linux (${BUILD_TAGS:-GTK3})"
- go mod tidy
- go build ${BUILD_TAGS:+-tags $BUILD_TAGS} -o "testbuild-{{.DIR}}-linux"
test:example:linux:gtk4:
summary: Build example for Linux with GTK4 (experimental, opt-in via -tags gtk4)
dir: 'examples/{{.DIR}}'
platforms:
- linux
cmds:
- echo "Building example {{.DIR}} for Linux (GTK4 experimental)"
- go mod tidy
- go build -tags gtk4 -o "testbuild-{{.DIR}}-linux-gtk4"
test:example:linux:docker:arm64:
summary: Build a single example for Linux ARM64 using Docker (Ubuntu 24.04)
cmds:
- echo "Building example {{.DIR}} for Linux ARM64 using Docker"
- docker build --pull -f test/docker/Dockerfile.linux-arm64 -t wails-v3-linux-arm64 .
- docker run --rm wails-v3-linux-arm64 /build/build-linux-arm64.sh {{.DIR}}
test:example:linux:docker:x86_64:
summary: Build a single example for Linux x86_64 using Docker (Ubuntu 24.04)
cmds:
- echo "Building example {{.DIR}} for Linux x86_64 using Docker"
- docker build --pull -f test/docker/Dockerfile.linux-x86_64 -t wails-v3-linux-x86_64 .
- docker run --rm wails-v3-linux-x86_64 /build/build-linux-x86_64.sh {{.DIR}}
test:examples:linux:docker:arm64:
summary: Build all examples for Linux ARM64 using Docker (Ubuntu 24.04, GTK4)
cmds:
- echo "Building Docker image for Linux ARM64 compilation..."
- docker build --pull -f test/docker/Dockerfile.linux-arm64 -t wails-v3-linux-arm64 .
- echo "Running Linux ARM64 compilation in Docker container (GTK4)..."
- docker run --rm wails-v3-linux-arm64
test:examples:linux:docker:x86_64:
summary: Build all examples for Linux x86_64 using Docker (Ubuntu 24.04, GTK4)
cmds:
- echo "Building Docker image for Linux x86_64 compilation..."
- docker build --pull -f test/docker/Dockerfile.linux-x86_64 -t wails-v3-linux-x86_64 .
- echo "Running Linux x86_64 compilation in Docker container (GTK4)..."
- docker run --rm wails-v3-linux-x86_64
test:examples:linux:docker:x86_64:gtk3:
summary: Build all examples for Linux x86_64 using Docker with GTK3 (legacy)
cmds:
- echo "Building Docker image for Linux x86_64 compilation..."
- docker build --pull -f test/docker/Dockerfile.linux-x86_64 -t wails-v3-linux-x86_64 .
- echo "Running Linux x86_64 compilation in Docker container (GTK3 legacy)..."
- docker run --rm -e BUILD_TAGS=gtk3 wails-v3-linux-x86_64
test:examples:linux:docker:arm64:gtk3:
summary: Build all examples for Linux ARM64 using Docker with GTK3 (legacy)
cmds:
- echo "Building Docker image for Linux ARM64 compilation..."
- docker build --pull -f test/docker/Dockerfile.linux-arm64 -t wails-v3-linux-arm64 .
- echo "Running Linux ARM64 compilation in Docker container (GTK3 legacy)..."
- docker run --rm -e BUILD_TAGS=gtk3 wails-v3-linux-arm64
test:example:linux:docker:
summary: Build a single example for Linux using Docker (auto-detect architecture)
cmds:
- echo "Auto-detecting architecture for Linux Docker build..."
- |
if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
echo "Detected ARM64, using ARM64 Docker image"
task test:example:linux:docker:arm64 DIR={{.DIR}}
else
echo "Detected x86_64, using x86_64 Docker image"
task test:example:linux:docker:x86_64 DIR={{.DIR}}
fi
test:examples:linux:docker:
summary: Build all examples for Linux using Docker (auto-detect architecture)
cmds:
- echo "Auto-detecting architecture for Linux Docker build..."
- |
if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
echo "Detected ARM64, using ARM64 Docker image"
task test:examples:linux:docker:arm64
else
echo "Detected x86_64, using x86_64 Docker image"
task test:examples:linux:docker:x86_64
fi
test:examples:all:
summary: Builds all examples for all platforms (Mac + Windows + Linux via Docker)
vars:
EXAMPLEDIRS: |
badge
badge-custom
binding
build
cancel-async
cancel-chaining
clipboard
contextmenus
dev
dialogs
dialogs-basic
drag-n-drop
environment
events
events-bug
file-association
frameless
gin-example
gin-routing
gin-service
hide-window
ignore-mouse
keybindings
liquid-glass
menu
notifications
panic-handling
plain
raw-message
screen
services
show-macos-toolbar
single-instance
systray-basic
systray-custom
systray-menu
video
window
window-api
window-call
window-menu
wml
cmds:
- echo "Building all examples for all platforms..."
- echo "=== Building for Darwin ==="
- for: { var: EXAMPLEDIRS }
task: test:example:darwin
vars:
DIR: "{{.ITEM}}"
- echo "=== Building for Windows (cross-compile) ==="
- for: { var: EXAMPLEDIRS }
task: test:example:windows
vars:
DIR: "{{.ITEM}}"
- echo "=== Building for Linux (Docker) ==="
- task: test:examples:linux:docker
- echo "=== Testing CLI Code ==="
- task: test:cli
- echo "=== Cleaning Up Test Binaries ==="
- task: clean:test:binaries
test:cli:
summary: Test CLI-related code compilation
cmds:
- echo "Testing CLI appimage testfiles compilation..."
- cd internal/commands/appimage_testfiles && go mod tidy && go build
- echo "✅ CLI appimage testfiles compile successfully"
test:cli:all:
summary: Test all CLI components and critical test files
cmds:
- echo "Testing CLI appimage testfiles..."
- cd internal/commands/appimage_testfiles && go mod tidy && go build
- echo "Testing window visibility test..."
- cd tests/window-visibility-test && go mod tidy && go build
- echo "Testing service implementations..."
- cd pkg/services/badge && go build
- echo "✅ All CLI components compile successfully"
test:generator:
summary: Test code generator test cases compilation
cmds:
- echo "Testing generator test cases (sample)..."
- cd internal/generator/testcases/function_single && go mod tidy && go build
- cd internal/generator/testcases/complex_method && go mod tidy && go build
- cd internal/generator/testcases/struct_literal_single && go mod tidy && go build
- echo "✅ Generator test cases compile successfully"
test:templates:
summary: Test template generation for core templates
cmds:
- echo "Testing template generation (core templates)..."
- task: install
- echo "Testing lit template generation..."
- rm -rf ./test-template-lit && wails3 init -n test-template-lit -t lit
- mkdir -p ./test-template-lit/frontend/dist && touch ./test-template-lit/frontend/dist/.keep
- cd ./test-template-lit && go mod tidy && go build
- rm -rf ./test-template-lit
- echo "Testing react template generation..."
- rm -rf ./test-template-react && wails3 init -n test-template-react -t react
- mkdir -p ./test-template-react/frontend/dist && touch ./test-template-react/frontend/dist/.keep
- cd ./test-template-react && go mod tidy && go build
- rm -rf ./test-template-react
- echo "✅ Template generation tests completed successfully"
test:infrastructure:
summary: Test critical infrastructure components
cmds:
- echo "=== Testing CLI Components ==="
- task: test:cli:all
- echo "=== Testing Generator ==="
- task: test:generator
- echo "=== Testing Templates ==="
- task: test:templates
- echo "=== Testing pkg/application ==="
- cd pkg/application && go test -c -o /dev/null ./...
- echo "=== Cleaning Up Test Binaries ==="
- task: clean:test:binaries
- echo "✅ All infrastructure components test successfully"
test:examples:
summary: Builds the examples for current platform only
vars:
EXAMPLEDIRS: |
badge
badge-custom
binding
build
cancel-async
cancel-chaining
clipboard
contextmenus
dev
dialogs
dialogs-basic
drag-n-drop
environment
events
events-bug
file-association
frameless
gin-example
gin-routing
gin-service
hide-window
ignore-mouse
keybindings
liquid-glass
menu
notifications
panic-handling
plain
raw-message
screen
services
show-macos-toolbar
single-instance
systray-basic
systray-custom
systray-menu
video
window
window-api
window-call
window-menu
wml
cmds:
- echo "Testing examples compilation..."
- for: { var: EXAMPLEDIRS }
task: test:example:darwin
vars:
DIR: "{{.ITEM}}"
platforms: [darwin]
- for: { var: EXAMPLEDIRS }
task: test:example:linux
vars:
DIR: "{{.ITEM}}"
platforms: [linux]
# GTK4 example builds are handled in CI via: BUILD_TAGS=gtk4 task test:examples
- for: { var: EXAMPLEDIRS }
task: test:example:windows
vars:
DIR: "{{.ITEM}}"
platforms: [windows]
- echo "Testing CLI code..."
- task: test:cli
- echo "=== Cleaning Up Test Binaries ==="
- task: clean:test:binaries
clean:test:binaries:
summary: Clean up all test-generated binary files and directories (cross-platform)
cmds:
- echo "🧹 Cleaning up test binaries..."
- go run tasks/cleanup/cleanup.go
- echo "✅ Test binaries cleaned up"
test:all:
summary: Run all tests including examples, infrastructure, and Go unit tests
cmds:
- echo "=== Running Go Unit Tests ==="
- go test ./...
- echo "=== Testing Examples (Current Platform) ==="
- task: test:examples
- echo "=== Testing Infrastructure Components ==="
- task: test:infrastructure
- echo "=== Cleaning Up Test Binaries ==="
- task: clean:test:binaries
- echo "✅ All tests completed successfully"
sanity:
summary: Quick compilation sanity check for key examples (GTK3 default + GTK4 opt-in)
platforms:
- linux
cmds:
- echo "🔍 Running quick sanity check (GTK3 - default)..."
- cd examples/menu && go build -o /dev/null .
- cd examples/window && go build -o /dev/null .
- cd examples/events && go build -o /dev/null .
- cd examples/plain && go build -o /dev/null .
- cd examples/dialogs-basic && go build -o /dev/null .
- echo "✅ GTK3 sanity check passed"
- task: sanity:gtk4
sanity:gtk4:
summary: Quick compilation sanity check for GTK4 (experimental, opt-in via -tags gtk4)
platforms:
- linux
cmds:
- echo "🔍 Running GTK4 sanity check..."
- cd examples/menu && go build -tags gtk4 -o /dev/null .
- cd examples/window && go build -tags gtk4 -o /dev/null .
- cd examples/events && go build -tags gtk4 -o /dev/null .
- cd examples/plain && go build -tags gtk4 -o /dev/null .
- echo "✅ GTK4 sanity check passed"
build:server:
summary: Build an application in server mode (no GUI, HTTP server only)
desc: |
Builds a Wails application in server mode using the -tags server build tag.
Server mode enables running the application as a pure HTTP server without
native GUI dependencies.
Usage: task build:server DIR=examples/server
dir: '{{.DIR | default "."}}'
cmds:
- echo "Building {{.DIR | default `.`}} in server mode..."
- go build -tags server -o '{{.OUTPUT | default "server-app"}}' .
- echo "Server mode build complete"
test:example:server:
summary: Build and test the server mode example
dir: 'examples/server'
cmds:
- echo "Building server example with -tags server..."
- go mod tidy
- go build -tags server -o "testbuild-server"
- echo "✅ Server example builds successfully"
- rm -f testbuild-server
test:server:
summary: Run server mode unit tests
dir: 'pkg/application'
cmds:
- echo "Running server mode tests..."
- go test -tags server -v -run TestServerMode .
- echo "✅ Server mode tests passed"