Julia Bazel rules
Rules
Aspects
Module Extensions
julia_binary
load("@rules_julia//julia:defs.bzl", "julia_binary")
julia_binary(name, deps, srcs, data, env, main)
A Julia executable.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| deps | Other Julia libraries this target depends on | List of labels | optional | [] |
| srcs | Julia source files (.jl files). | List of labels | required | |
| data | Additional files needed at runtime | List of labels | optional | [] |
| env | Environment variables to set when running the binary. Supports $(location) expansion. | Dictionary: String -> String | optional | {} |
| main | The main entrypoint file. If not specified, defaults to the only file in srcs, or a file matching the target name. | Label | optional | None |
julia_format_test
load("@rules_julia//julia:defs.bzl", "julia_format_test")
julia_format_test(name, config, target)
A rule for running JuliaFormatter on a Julia target.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| config | The config file (.JuliaFormatter.toml) containing JuliaFormatter settings. | Label | optional | "@rules_julia//julia/settings:formatter_config" |
| target | The target to run JuliaFormatter on. | Label | required |
julia_library
load("@rules_julia//julia:defs.bzl", "julia_library")
julia_library(name, deps, srcs, data)
A sharable Julia library or module.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| deps | Other Julia libraries this target depends on | List of labels | optional | [] |
| srcs | Julia source files (.jl files) | List of labels | required | |
| data | Additional files needed at runtime | List of labels | optional | [] |
julia_standalone_binary
load("@rules_julia//julia:defs.bzl", "julia_standalone_binary")
julia_standalone_binary(name, binary)
A rule for converting a julia_binary to a standalone application.
This rule uses PackageCompiler.jl to create a standalone executable that includes the Julia runtime and all dependencies. The resulting application can be distributed and run on machines without Julia installed.
Dependencies are provided hermetically through Bazel - no network access required! PackageCompiler.jl and all Julia package dependencies are managed through the Bazel build system.
Example:
julia_binary(
name = "my_app_bin",
srcs = ["my_app.jl"],
deps = ["//my/lib"],
)
julia_standalone_binary(
name = "my_app",
binary = ":my_app_bin",
)
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| binary | The julia_binary target to convert into a standalone application | Label | required |
julia_test
load("@rules_julia//julia:defs.bzl", "julia_test")
julia_test(name, deps, srcs, data, env, main)
A Julia test executable.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| deps | Other Julia libraries this target depends on | List of labels | optional | [] |
| srcs | Julia test source files (.jl files). | List of labels | required | |
| data | Additional files needed at runtime for the test | List of labels | optional | [] |
| env | Environment variables to set when running the test. Supports $(location) expansion. | Dictionary: String -> String | optional | {} |
| main | The main test entrypoint file. If not specified, defaults to the only file in srcs, or a file matching the target name. | Label | optional | None |
julia_toolchain
load("@rules_julia//julia:defs.bzl", "julia_toolchain")
julia_toolchain(name, julia, version)
A toolchain for building Julia targets.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| julia | The path to the Julia binary (julia or julia.exe). | Label | required | |
| version | The Julia version string (e.g., '1.12.5'). | String | required |
julia_format_aspect
load("@rules_julia//julia:defs.bzl", "julia_format_aspect")
julia_format_aspect()
An aspect for running JuliaFormatter on targets with Julia sources.
ASPECT ATTRIBUTES
ATTRIBUTES
julia
julia = use_extension("@rules_julia//julia:defs.bzl", "julia")
Bzlmod extensions for Julia