Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/scripts/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ bazel_dep(name = "rules_zig", version = "$VERSION")
Optionally add the following to your \`MODULE.bazel\` file to install a specific Zig toolchain version:

\`\`\`starlark
zig = use_extension("//zig:extensions.bzl", "zig")
zig = use_extension("@rules_zig//zig:extensions.bzl", "zig")
zig.toolchain(zig_version = "0.16.0")
\`\`\`

You can call \`zig.toolchain\` multiple times to install multiple Zig versions.

Optionally add the following to your \`MODULE.bazel\` file to install a specific ZLS toolchain version and declare what Zig version it applies to:

\`\`\`starlark
zls = use_extension("@rules_zig//zig/zls:extensions.bzl", "zls")
zls.toolchain(zig_version = "0.16.0", zls_version = "0.16.0")
\`\`\`

You can call \`zls.toolchain\` multiple times to install multiple ZLS versions.

Note, rules_zig requires bzlmod, WORKSPACE mode is no longer supported.
EOF
13 changes: 6 additions & 7 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ register_toolchains("@rules_zig//zig/target:all")

register_toolchains("@zig_toolchains//:all")

zls = use_extension("//zig/zls:extensions.bzl", "zls")
zls.index(file = "//zig/zls/private:versions.json")
use_repo(zls, "zls_toolchains")

register_toolchains("@zls_toolchains//:all")

zig_dev = use_extension(
"//zig:extensions.bzl",
"zig",
Expand All @@ -48,7 +54,6 @@ zls_dev = use_extension(
"zls",
dev_dependency = True,
)
zls_dev.index(file = "//zig/zls/private:versions.json")
zls_dev.toolchain(
zig_version = "0.16.0",
zls_version = "0.16.0",
Expand All @@ -57,12 +62,6 @@ zls_dev.toolchain(
zig_version = "0.15.2",
zls_version = "0.15.1",
)
use_repo(zls_dev, "zls_toolchains")

register_toolchains(
"@zls_toolchains//:all",
dev_dependency = True,
)

bazel_dep(name = "toolchains_buildbuddy", version = "0.0.4", dev_dependency = True)

Expand Down
6 changes: 0 additions & 6 deletions zig/zls/private/bzlmod/zls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ def _toolchain_extension(module_ctx):
if err != None:
fail(*err)

if len(mappings) == 0:
fail("The zls extension requires at least one zls.toolchain tag.")

toolchain_names = []
toolchain_labels = []
toolchain_zig_versions = []
Expand Down Expand Up @@ -195,9 +192,6 @@ def _toolchain_extension(module_ctx):
platform = platform,
)

if len(toolchain_names) == 0:
fail("No ZLS toolchains were generated. Check that the requested ZLS versions have entries for supported platforms.")

toolchains_repo(
name = _DEFAULT_NAME + "_toolchains",
names = toolchain_names,
Expand Down
Loading