1
1
Fork
You've already forked GradleZigBuild
0
A gradle plugin for integrating with the zig build system and zig toolchain management. https://plugins.gradle.org/plugin/com.falsepattern.zigbuild
  • Kotlin 88.3%
  • Zig 11.7%
Find a file
2026年02月10日 19:09:44 +01:00
gradle/wrapper build: update gradle to 9.3.0 2026年02月09日 23:35:38 +01:00
ZigBuild-plugin ci: 0.3.2 2026年02月10日 19:09:44 +01:00
ZigBuild-test test: add more test cases for env call 2026年02月09日 23:36:59 +01:00
.gitattributes Import into VCS 2025年05月05日 00:00:36 +02:00
.gitignore Import into VCS 2025年05月05日 00:00:36 +02:00
CHANGELOG.MD ci: 0.3.2 2026年02月10日 19:09:44 +01:00
COPYING Import into VCS 2025年05月05日 00:00:36 +02:00
COPYING.LESSER Import into VCS 2025年05月05日 00:00:36 +02:00
CREDITS Import into VCS 2025年05月05日 00:00:36 +02:00
gradle.properties Import into VCS 2025年05月05日 00:00:36 +02:00
gradlew chore: update gradle to 9.1.0 2025年10月27日 00:17:11 +01:00
gradlew.bat chore: update gradle to 9.1.0 2025年10月27日 00:17:11 +01:00
LICENSE Import into VCS 2025年05月05日 00:00:36 +02:00
README.MD ci: 0.3.1 2026年02月09日 23:42:48 +01:00
settings.gradle.kts Import into VCS 2025年05月05日 00:00:36 +02:00

Gradle ZigBuild

LGPLv3 logo

Author: FalsePattern

License: GNU LGPLv3.0-only

A gradle plugin that adds integration with zig toolchains, and preliminary integration with the zig build system.

Setup

You can install the plugin by adding it in your build.gradle like so:

plugins {
 id("com.falsepattern.zigbuild") version "VERSION_GOES_HERE"
}

The plugin also ships with a default repository for automatically downloading zig toolchains (https://ziglang.org/download/), however, you will need to add the above lines to your settings.gradle too.

If you don't add it to your settings.gradle, ZigBuild will look for zig toolchains in your PATH, and the following well-known locations:

  • Windows:
    • %LOCALAPPDATA%/zig
    • %LOCALAPPDATA%/zigup
    • %HOME%/.zig
  • Linux if XDG_DATA_HOME is set:
    • $XDG_DATA_HOME/zig
    • $XDG_DATA_HOME/zigup
    • ~/.zig
  • Linux if XDG_DATA_HOME is not set:
    • ~/.local/share/zig
    • ~/.local/share/zigup
    • ~/.zig
  • MacOS:
    • ~/Library/zig
    • ~/Library/zigup
    • ~/.zig

This is identical to the default toolchain search/installation logic of ZigBrains, so this effectively just integrates toolchain management with it.

If you want to disable this autodetection, you can set scanSystem inside the zig project extension to false:

zig {
 scanSystem = false
}

Specific toolchains can also be acquired using zig.compilerFor. This compiler can be used as-is for Exec tasks, or with some presets in the ZigCompileTask task.

For more information, you can check the ZigBuild-test subproject, which has a zig 0.14.0 example project hooked up to gradle.

Special Thanks

A large part of this plugin is based on ZigGradle ported to kotlin, and heavily tweaked for better build.zig integration.