This file describes how AI coding agents can effectively work with this repository.
This is a build automation repository for cross-platform static libraries. The primary artifacts are:
- Pre-built libraries (
.a,.libfiles) - Headers
- GitHub Actions workflows for CI/CD
When modifying build-skia.py, build-webp.py, or build-swc.py:
- Understand platform differences: Each platform has unique GN args, compiler flags, and SDK requirements
- Test locally first: Use
python3 build-skia.py <platform>before pushing - Update LIBS dict carefully: Platform-specific libraries (e.g., WASM disables skottie)
- Check GPU_LIBS and ANGLE_LIBS: Dawn availability varies by platform
Triggering builds:
gh workflow run build-skia.yml # Full build + release
gh workflow run build-skia.yml -f platforms=wasm # Single platform
gh workflow run build-skia.yml -f skip_release=true # No releaseDebugging failures:
gh run list --workflow=build-skia.yml
gh run view <run-id> --log-failed
gh api repos/mystralengine/library-builder/actions/artifacts --jq '.artifacts[].name'Creating releases from existing artifacts:
- The workflow only creates releases when all platforms succeed
- Individual artifacts can be downloaded from workflow runs
- Use
create-xcframework.ymlto build XCFramework from release
| Platform | Special Handling |
|---|---|
| visionOS | Uses target_os = "ios" with -target arm64-apple-xros1.0 flag workaround |
| Android | No Dawn (NDK C++20 issues), uses native Vulkan |
| WASM | No skottie/sksg, uses Emscripten, Ganesh only (no Graphite) |
| Windows | Dual CRT variants (static /MT and dynamic /MD) |
| iOS | Separate device and simulator builds, different SDK paths |
When adding a new platform:
- Add entry to
LIBSdict with platform-specific libraries - Add entry to
GPU_LIBSif Dawn is supported - Add entry to
ANGLE_LIBSif ANGLE is needed - Add
PLATFORM_GN_ARGSconfiguration - Update
get_default_archs()andvalidate_archs() - Add matrix entry in
.github/workflows/build-skia.yml - Update documentation in
CLAUDE.mdandREADME.md
Common patterns:
- "unknown target": Library not generated (check GN args vs LIBS dict)
- Linker errors: Missing dependencies or CRT mismatch
- SDK errors: Check SDK path generation in
generate_gn_args() - Timeout: Large builds may need extended timeouts
Debugging steps:
- Check which jobs failed:
gh run view <id> --json jobs - Get failed logs:
gh run view <id> --log-failed - Search for specific errors:
grep -i "error\|failed" <log> - Compare with successful runs to identify changes
ghCLI for GitHub Actions managementgitfor version control- File read/write for script modifications
- Bash execution for local testing
- GN build system (Google's meta-build system)
- Cross-platform compilation (different compilers, SDKs, flags)
- GitHub Actions workflow syntax
- Python scripting
- Identify failed job from
gh run list - Get logs with
gh run view <id> --log-failed - Identify root cause (GN args, LIBS dict, SDK paths)
- Make fix in Python script
- Trigger rebuild:
gh workflow run build-skia.yml -f platforms=<platform> -f skip_release=true - Verify success before full rebuild
- Ensure all platforms build successfully
- Trigger full build:
gh workflow run build-skia.yml - Monitor with
gh run watch <id>or check status periodically - Release created automatically with tag format
main-YYYYMMDD
- Check available branches:
git ls-remote --heads https://github.com/google/skia.git - Trigger build with new branch:
gh workflow run build-skia.yml -f skia_branch=chrome/m150 - Test for breaking changes in GN args or build process
- Update documentation if successful
Patches in patches/ are applied automatically during builds to fix upstream issues.
IMPORTANT: Never write patches manually. Manually-written patches have wrong line numbers, missing space prefixes on blank lines, or other format issues that cause "corrupt patch" errors.
Always generate patches using git diff:
# 1. Create temp repo with original files
mkdir /tmp/patch && cd /tmp/patch && git init
# 2. Download original from upstream (Dawn uses base64)
mkdir -p third_party/externals/dawn/src/dawn/native/d3d11
curl -sL "https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/native/d3d11/SomeFile.cpp?format=TEXT" \
| base64 -d > third_party/externals/dawn/src/dawn/native/d3d11/SomeFile.cpp
# 3. Commit original
git add . && git commit -m "Original"
# 4. Make changes (edit files)
# 5. Generate patch
git diff > /path/to/library-builder/patches/my-fix.patchSee docs/writingpatches.md for the complete guide.
| File | Purpose |
|---|---|
build-skia.py |
Main Skia build script (~1350 lines) |
build-webp.py |
libwebp build script |
build-swc.py |
SWC compiler build script |
.github/workflows/build-skia.yml |
Skia CI/CD workflow |
.github/workflows/build-webp.yml |
libwebp CI/CD workflow |
.github/workflows/build-swc.yml |
SWC CI/CD workflow |
.github/workflows/create-xcframework.yml |
XCFramework assembly from release |
patches/ |
Directory for patches to apply to Skia source |
Makefile |
Local build shortcuts |